Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 5 commits into from
Jun 15, 2024

Conversation

luke-zhou
Copy link
Collaborator

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

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
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
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
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!

Copy link
Collaborator

@a1shadows a1shadows left a comment

Choose a reason for hiding this comment

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

LGTM

@nirmalchandra
Copy link
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
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
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
1 check passed
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.

None yet

4 participants