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

How to run scenario outline multiple time for list of data #1458

Closed
sumit-global opened this issue Nov 20, 2018 · 6 comments
Closed

How to run scenario outline multiple time for list of data #1458

sumit-global opened this issue Nov 20, 2018 · 6 comments
Labels

Comments

@sumit-global
Copy link

Hi @wakaleo

I know it's not a right platform to ask questions.
I want to run my scenario outline examples with different set of data and data is dynamic for examples.

For eg:
I am having java List say L which contains values of country like USA, INDIA UK and so on.(which will generated dynamically) and I want to run my examples with set of data for eg:

Examples:
|Country| State| Region|
|USA | ABC | DEF |
|USA | GHI | JKL |
|USA | MNO | PQR |

Now I want above examples will run for first USA and then for INDIA and so on(as per data in list)

I tried to make it run by using following

public class ABC {
@test
public void run() throws Throwable {
for(String s: L){
net.serenitybdd.cucumber.cli.Main.main(new String[] { "-g", "Path of Step Defs","Path of feature file" });
}
}
}

and running above class as "clean verify -Dit.test=Abc.java"

It is running fine for first data from list and report generated successfully, but it is not running for rest of data. Please suggest how can I achieve above part.

Thanks in advance.

@wakaleo
Copy link
Member

wakaleo commented Nov 20, 2018

Cucumber doesn't support dynamic example lists. It would be more usual just to have multiple examples tables in the same feature file, e.g.

Examples: USA
|Country| State| Region|
|USA | ABC | DEF |
|USA | GHI | JKL |
|USA | MNO | PQR |

Examples: India
|Country| State| Region|
| India | ABC | DEF |
| India | GHI | JKL |
| India | MNO | PQR |

@sumit-global
Copy link
Author

Thanks for reply. But size of list isn’t fixed so i think multi examples will not work here..

@wakaleo
Copy link
Member

wakaleo commented Nov 21, 2018

You could do it easily enough in Screenplay by making a dynamic list of tasks or consequences. If you are trying to do it with Cucumber, you are probably using the wrong tool - what you are doing is test scripting, and Cucumber is not a test scripting tool.

@sumit-global
Copy link
Author

thanks @wakaleo for reply could you please share some examples of screenplay.

Thanks in advance.

@sumit-global
Copy link
Author

Can I refer "https://github.com/serenity-bdd/serenity-screenplay-train-demo" for screenplay functionality?

@wakaleo
Copy link
Member

wakaleo commented Dec 19, 2018

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

No branches or pull requests

2 participants