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

Add dataSet in session API #624

Open
ewmartinez opened this issue May 21, 2023 · 3 comments
Open

Add dataSet in session API #624

ewmartinez opened this issue May 21, 2023 · 3 comments

Comments

@ewmartinez
Copy link

It is possible to add a parameter to accept dataSet in session creation API like below?
When it is passed won't be taken the file of data folder, it will take the data passed by the API.

{
    "actorTags": [],
    "environment": null,
    "maxIterations": 1,
    "sessionLabel": "Test session 1",
    "template": {
        "path": ".",
        "name": "Template 1"
    },
    "tests": [
        {
            "path": ".",
            "name": "Test 1",
            "dataSet": [{"a":"a1","b":"b1","c":"c1"},{"a":"a2","b":"b2","c":"c2"}]
        },
        {
            "path": "web",
            "name": "Web test 1",
            "dataSet": [{"d":"d1","e":"e1","f":"f1"}]
        },
        {
            "path": "api",
            "name": "API test 1",
            "dataSet": [{"g":"g1","h":"h1"},{"g":"g2","h":"h2"},{"g":"g3","h":"h3"}]
        }
    ]
}

https://getopentest.org/reference/web-api.html#creating-a-test-session

@ewmartinez
Copy link
Author

@adrianth could this feature be added at some time, or you see any consern about it

@adrianth
Copy link
Contributor

Try to see if you can use execution environments instead. Here are some quick suggestions, using the example you provided.

Test repo folder structure:

data
   ...
data-env
   prod
      ...
   variation1
      dataset1.yaml
   variation2
      dataset1.yaml
   variation3
      someOtherDataset.yaml
...

In file "Test 1", specify the dataSet value by reading it from the data files:

dataSet: $data("dataset1")

You can then specify the environment to work with in the command line, thus altering the data set used in the test.

opentest session create -t Template1 --env variation1

opentest session create -t Template1 --env variation2

If necessary, you can also combine multiple environments by using the syntax env1+env2+env3. For example:

opentest session create -t Template1 --env prod+variation1+variation3

The command line above will use all the data files from the prod directory and will override them with whatever it finds in the variation1 directory, then do the same with the variation3 directory.

I hope this gives you some ideas on how to proceed with your specific use case.

@ewmartinez
Copy link
Author

Hi @adrianth
The environment feature we already are using to separate the systems target, so I won't use it to solve this.

This approach will give me more options thanks.
dataSet: $data("dataset1")

But in this case, we alredy have an application that is in charge of provide cleanned test data, and we want to obtain the test data from this application to start test sesions.
Thats why I am asking to modify the API to recibe data in the calls.

If this will be possible, would be great.

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

No branches or pull requests

2 participants