Feature file(s) Execution in Cucumber
Hello World,
On this post, we will understand the Execution of the cucumber's feature file(s). Normally we just create the feature file according to the application's feature/main_functional_category and most of the time(basically depending on our automation framework) its just independent from other features.
But, what if...if we want to execute our cucumber framework with a proper defined sequence of feature files ?
Now this situation arise when we are having following case:
On this post, we will understand the Execution of the cucumber's feature file(s). Normally we just create the feature file according to the application's feature/main_functional_category and most of the time(basically depending on our automation framework) its just independent from other features.
But, what if...if we want to execute our cucumber framework with a proper defined sequence of feature files ?
Now this situation arise when we are having following case:
- the features(or the steps inside features) are inter-related.
- Or, we just want to execute them as we want to.
So, basically cucumber has its own default way to pickup the feature file for execution, which is of-course Alphabetical order (it also applied to sub-folder names). But we can also override this default method of feature file selection for execution.
So below are the methods/ways to override the default way of cucumber feature files...
#1: Specify in @CucumberOptions (or @Cucumber.Options) under features option.
@CucumberOptions(
features={"feature1.feature", "feature2.feature", and so on}
)
#2: Name your feature file with the prefix of alphabates in a order.
(Well, this is not a method to override. Its just a hack)
A_beforeSmoketest.feature, B_smoketest.feature, C_batch_Subfolder_for_Features
#3: If you are running cucumber from the command line then you can pass the feature files as argument, and cucumber will follow those files order as they were passed.
:$ cucumber file3.feature file2.feture file1.feature
Reference:
https://stackoverflow.com/questions/41239378/testing-with-cucumber-and-seleniumhow-can-i-break-the-sequence-of-feature-file
https://stackoverflow.com/questions/41239378/testing-with-cucumber-and-seleniumhow-can-i-break-the-sequence-of-feature-file
Comments
Post a Comment