Forum Discussion

AlexEscri's avatar
AlexEscri
New Contributor
3 years ago
Solved

Run Scenario when ends another other one (JAVA)

Hello!

I'm running in parallel some scenarios, but i need run one when other ends...

 

I don't know if it is possible... I don't want do a so long scenario in gherkin, i want to start the second when the first was ended.

 

My run file:

import io.cucumber.testng.AbstractTestNGCucumberTests;
import io.cucumber.testng.CucumberOptions;
import org.testng.annotations.DataProvider;


@CucumberOptions(
features = {"src/main/resources/features"},
plugin = {
"pretty",
"json:target/cucumber-reports/cucumber.json",
"html:target/cucumber-reports/cucumber-pretty.html",
"rerun:target/cucumber-reports/rerun.txt",
"junit:target/cucumber-reports/cucumber.xml",
},
glue = {"steps"},
tags = "@a",
monochrome = true
)
//@RunWith(Cucumber.class)
public class runParallel extends AbstractTestNGCucumberTests {
@Override
@DataProvider(parallel = true)
public Object[][] scenarios() {
return super.scenarios();
}

}

Thanks for all! 

  • Finally i found a solution for my scenario.

     

    With a boolean, loop wihle and wait for element i do it.

     

    Thanks!

2 Replies

  • aslakhellesoy's avatar
    aslakhellesoy
    SmartBear Alumni (Retired)

    It's not possible to have one scenario depend on another Scenario in Cucumber. This is a deliberate design decision since coupling scenarios relies on side-effects, and this is known to produce non-deterministic behaviour for scenarios. (They can no longer be run in isolation).

  • AlexEscri's avatar
    AlexEscri
    New Contributor

    Finally i found a solution for my scenario.

     

    With a boolean, loop wihle and wait for element i do it.

     

    Thanks!