1
votes

I have a cucumber test runner class in which i write my test suite to run like below

@CucumberOptions( features={"Feature_Files/featues" } ,glue={ "com.automation.stepdef" } ,monochrome=true ,dryRun= false ,plugin = {"html:target/cucumber-html-report" } ,tags = {"@Startup" } )

If I wish to customize this tag option on successful completion of @startup feature, is it possible ?

2

2 Answers

0
votes

The most common way of running two or more dependant test suites is creation of triggers for two or more jobs in your CI. This can be done with various plugins as described here.

Otherwise, if that's some test preparation actions you can use @Before or realted JUnit @BeforeClass annotation.

0
votes

Seems not possible with current Cucumber. What you are asking for is the dependency among test scenarios, which IMO is a very good feature. For example, we have some login feature and some other functional features. It would not make any sense and would actually be a waste of time to run other features if the login feature does not work in the first place. To make things worse, you will see a lot of failures in test report in which you could not easily spot the root cause which is non-working login feature.

TestNG supports "dependsOnMethod" feature. However, TestNG is not a BDD tool.

QAF https://qmetry.github.io/qaf/qaf-2.1.7b/scenario.html#meta-data supports this as a BDD tool. However, it would be too heavy to introduce a new tool for such a simple feature.

All we need is some addition to Cucumber syntax and a customized test runner to build up the scenarios execution order as per dependencies and skip the features if the feature they depends on fails.

I would love to see if someone can put some effort into this :)

BTW, CI could workaround this issue, but again it's too heavy and clumsy. Imagine you have multi-dependencies among test scenarios, how many CI pipelines will you need then? Also, you can not workaround this in local dev env with CI because simply you would not set CI locally.