Skip to content

ISSUE-659 # add ability to refer CSV source value by header - #667

Merged
authorjapps merged 5 commits into
authorjapps:masterfrom
luke-zhou:master
Jun 15, 2024
Merged

authorjapps merged 5 commits into
authorjapps:masterfrom
luke-zhou:master

Conversation

@luke-zhou

@luke-zhou luke-zhou commented Jun 9, 2024 •

Copy link
Copy Markdown
Collaborator

Fixes Issue

  • Which issue or ticket was(will be) fixed by this PR? ISSUE-659

PR Branch

Motivation and Context

This PR is aiming to solve the ISSUE-659

Checklist:

  • New Unit tests were added

    • Covered in existing Unit tests
  • Integration tests were added

    • Covered in existing Integration tests
  • Test names are meaningful

  • Feature manually tested and outcome is successful

  • PR doesn't break any of the earlier features for end users

    • WARNING! This might break one or more earlier earlier features, hence left a comment tagging all reviewrs
  • Branch build passed in CI

  • No 'package.*' in the imports

  • Relevant DOcumentation page added or updated with clear instructions and examples for the end user

    • Not applicable. This was only a code refactor change, no functional or behaviourial changes were introduced
  • Http test added to http-testing module(if applicable) ?

    • Not applicable. The changes did not affect HTTP automation flow
  • Kafka test added to kafka-testing module(if applicable) ?

    • Not applicable. The changes did not affect Kafka automation flow

@nirmalchandra

Copy link
Copy Markdown
Collaborator

Hi @luke-zhou πŸ‘‹ ,
Thank you for the PR. Great work!

There is a minor failure here in CI , can you take care please ?
Just bump the count by 1 I think should pass.

Error:  Failures: 
Error:    SmartUtilsTest.willReadAllfileNamesFrom_TestResource:79 
Expected: is <22>
     but: was <23>

@luke-zhou

Copy link
Copy Markdown
Collaborator Author

Thanks for pointing that out, I have updated the code, that test should pass.
Also I am wonderig whether there are some way to run those CI test locally, just want to fix those broken tests before I submit PR.
Thanks

@a1shadows

Copy link
Copy Markdown
Collaborator

@luke-zhou hey you can refer the BUILDING.md file for steps to run the tests locally. Let me know in case of any other issues you face. Thanks for the PR!

@a1shadows a1shadows left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nirmalchandra

Copy link
Copy Markdown
Collaborator

Hi @luke-zhou πŸ‘‹ , we'll be adding you as a collaborator soon. Then you can merge this PR yourself, and futures PRs once they are approved.

@authorjapps

Copy link
Copy Markdown
Owner

Hi @luke-zhou πŸ‘‹ , we'll be adding you as a collaborator soon. Then you can merge this PR yourself, and futures PRs once they are approved.

Done, you can now join via this link!

@nirmalchandra

Copy link
Copy Markdown
Collaborator

Adding a test run console log here for the evidence:

Scenario file:

core/src/test/resources/integration_test_files/parameterized/parameterized_sample_csv_with_headers_test.json

Runner:

core/src/test/java/org/jsmart/zerocode/parameterized/ParameterisedCsvDemoTest.java

Scenario:

{
    "scenarioName": "Parameterized test scenario demo",
    "steps": [
        {
            "name": "get_user",
            "url": "",
            "operation": "",
            "request": {
                "status": "${2}",
                "body": {
                    "login": "octocat-${PARAM.id}-${PARAM.AddressId}"
                }
            },
            "assertions": {
                "status": "${$.get_user.response.status}",
                "body": {
                    "login": "octocat-${PARAM.id}-${PARAM.AddressId}"
                }
            }
        }
    ],
    "parameterized": {
        "csvSource":[
            "|id|,              |AddressId|,        |status|",
            "${RANDOM.NUMBER},  ${RANDOM.NUMBER},   200",
            "11,                22,                 400"
        ]
    }
}

Result:

https://github.com/authorjapps/zerocode/pull/667/checks#step:5:13520
Line No:13520(onwards)

[INFO] Running org.jsmart.zerocode.parameterized.ParameterisedCsvDemoTest
2024-06-11 00:50:26,567 [main] WARN org.jsmart.zerocode.core.runner.ZeroCodeMultiStepsScenarioRunnerImpl - 
-----------------------------------------------------------------------------------

Scenario:
+++++++++

Parameterized test scenario demo 

-----------------------------------------------------------------------------------
2024-06-11 00:50:26,571 [main] INFO org.jsmart.zerocode.core.runner.ZeroCodeMultiStepsScenarioRunnerImpl - 
-------------------------------------------------------------------------
     Executing Scenario Count No. or parameter No. or Row No. | 0 | 
-------------------------------------------------------------------------
2024-06-11 00:50:26,585 [main] WARN org.jsmart.zerocode.core.runner.StepNotificationHandler - 
***Step PASSED - Scenario:Parameterized test scenario demo -> get_user
2024-06-11 00:50:26,585 [main] WARN org.jsmart.zerocode.core.runner.ZeroCodeMultiStepsScenarioRunnerImpl - 
--------- TEST-STEP-CORRELATION-ID: 60559e5e-138b-40b5-8f54-d576fe3c434d ---------
*requestTimeStamp:2024-06-11T00:50:26.583
step:get_user
id:None
url:
method:
request:
{
  "status" : "200",
  "body" : {
    "login" : "octocat-5520924861888609935-252991273977338780"
  }
} 
--------- TEST-STEP-CORRELATION-ID: 60559e5e-138b-40b5-8f54-d576fe3c434d ---------
Response:
{
  "status" : "200",
  "body" : {
    "login" : "octocat-5520924861888609935-252991273977338780"
  }
}
*responseTimeStamp:2024-06-11T00:50:26.584 
*Response delay:1.0 milli-secs 
---------> Expected Response: <----------
{
  "status" : "200",
  "body" : {
    "login" : "octocat-5520924861888609935-252991273977338780"
  }
} 
 
-done-

Looks good and works as expected πŸ‘

@authorjapps
authorjapps merged commit bf3ffb6 into authorjapps:master Jun 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants