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

Parameterized csvSource with body payload from reusable external JSON file #409

Closed
authorjapps opened this issue Jun 18, 2020 · 11 comments · Fixed by #476
Closed

Parameterized csvSource with body payload from reusable external JSON file #409

authorjapps opened this issue Jun 18, 2020 · 11 comments · Fixed by #476
Assignees
Labels

Comments

@authorjapps
Copy link
Owner

authorjapps commented Jun 18, 2020

Example or Sample Below

  • Implemented This Way:
"parameterized": {
        "csvSource":"parameterized_csv/params.csv"
    }

See a sample test scenario here:
https://github.com/authorjapps/zerocode/blob/master/http-testing/src/test/resources/parameterized_csv/hello_world_test_parameterized_csv_source_files.json


Ticket Description:

From Slack:
@dorian

Hello,
is it possible to use csv data in a reused son?

Because the ${0} like variables in the file aren't getting swapped with the values from the csv.

...
"body": "${JSON.FILE:notification-api/parameterizable_body_pos_csv.json}" 
...
"parameterized": {
    "csvSource": [
      "Amelia, Loska, 1969-02-06, female, Im Grunde 082, Thörnich, 54340",
      "Pauline, Brand, 1967-01-29, female, Schöneberger Str. 71, Strande, 24229"
    ]
  }

This looks like anew feature request which needs to be implemented.

Please recheck the behavior before implementing it.

Current:
Inline CSV data in the "parameterized" block work fine

Desired:
CSV data from external source should work in similar fashion.

AC Details

From the perspective of the changes, the following is a better way. e.g.
Currently, it works this way.

    "parameterized": {
        "csvSource":[
            "octocat,      The Octocat, San Francisco, 583231",
            "siddhagalaxy, Sidd,        UK,            33847730"
        ]
    }

What should be ideal is to source this from a CSV file e.g.

    "parameterized": {
        "csvSource":"${CSV.FILE:my_data/params.csv}"
    }

where the params.csv content will be e.g.

user,name,city,userid
octocat,The Octocat,San Francisco,583231
siddhagalaxy,Sidd,UK,33847730

The 1st line is the header which can be ignored while reading.

@authorjapps authorjapps added feature-request New feature which can be introduced good first issue help wanted labels Jun 18, 2020
@pradeeppg89
Copy link

I would like to help but am totally new to this project. Can you please elaborate more on this?

@authorjapps
Copy link
Owner Author

authorjapps commented Jul 8, 2020

@pradeeppg89, thanks.
Updated the description section.
Let us know if you are able to reproduce the issue!

@authorjapps
Copy link
Owner Author

@pradeeppg89, are you still looking into this?

@Sauhardstark
Copy link

Sauhardstark commented Jul 17, 2020

Hi @authorjapps
I'm trying to understand the above issue and I understood that something like the below might be required.


"parameterized": {
    "csvFileSource": {
     test.json
    }
  }

Now the csvFileSource can also be a list. I'm more or less sure that the above is wrong. Could you please correct my understanding here.

Also I'm a little unclear on the reused son part. Can we please have a chat regarding this on Slack

@authorjapps
Copy link
Owner Author

authorjapps commented Jul 17, 2020

@Sauhardstark
I think this is something I believe, should be reproduced as explained in the issue description.
From the changes perspective, the following is better way. e.g.
Currently, it works this way.

    "parameterized": {
        "csvSource":[
            "octocat,      The Octocat, San Francisco, 583231",
            "siddhagalaxy, Sidd,        UK,            33847730"
        ]
    }

What should be ideal is to source this from a CSV file e.g.

    "parameterized": {
        "csvSource":"${CSV.FILE:my_data/params.csv}"
    }

where the params.csv content will be e.g.

user,name,city,userid
octocat,The Octocat,San Francisco,583231
siddhagalaxy,Sidd,UK,33847730

The 1st line is the header which can be ignored while reading.

@ShubhamAnand2098
Copy link

Hi @authorjapps
Is this issue fixed? if not I would like to try solving this

@imprashant
Copy link
Collaborator

Hello @authorjapps
I have raised a PR for this, can you please let me know if the PR is as per the expectation?
Also is it OK to assign this to me?

@authorjapps
Copy link
Owner Author

Hello @imprashant , Apologies for the delay as we were slightly busy in our day jobs.
We will take a look soon.

@arjunjhnzpost
Copy link

This would be a cool feature to have, really.

@automationuser-m
Copy link

Similar requirement has been requested in authorjapps/zerocode-hello-world#29 as well.
Parameterization of external files will be important feature that could solve multiple challenges.

@authorjapps
Copy link
Owner Author

PR merged.

This feature is available in 1.3.36 (and higher version) when release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.