Reputation: 633
@RunWith(Cucumber.class)
@CucumberOptions( plugin = {"pretty","html:target/html/automation"},
features = {"resource/***.feature"},
glue={},
tags={"@login","@Products"}
)
This is my feature files
@login
Feature: Login to Application
Scenario: this is verify the application is logged successfully Given Navigate to Panasonic application Then Verify the title of the application Then Logout the application
@Products
Feature: Login to Application
Background: user should be navigate to home page of application
Given User login to home page with valid credentials
When click the catalog link on home page
Scenario : To verify whether able to create more than ten products in products page
And check the sub menu of catalog is displaying in header
And check the My product catalog table
Upvotes: 0
Views: 59332
Reputation: 1
import static io.cucumber.testng.CucumberOptions.SnippetType.CAMELCASE;
import io.cucumber.testng.AbstractTestNGCucumberTests;
import io.cucumber.testng.CucumberOptions;
@CucumberOptions(
features = {"classpath:FeatureFiles"}, // Where mentions the path of our feature files
glue = {"stepDefinitions"}, // Where mentions the path of our steps and hooks and links them with our feature files
plugin = {"pretty", "io.qameta.allure.cucumber7jvm.AllureCucumber7Jvm", "summary"},// Mentions and adds reporting
tags = "@Smoke or @Regression", // Helps to run specific annotated feature files, scenarios etc
snippets = CAMELCASE, // It provides us step definitions in the form of camel case instead of cucumber forms
monochrome = true, // If = true ==> It helps us to provide our console with clear and more readable
dryRun = false // If = true ===> It helps us to check and deliver undefined steps for our feature steps
)
public class TestRunner extends AbstractTestNGCucumberTests{
enter code here
}
Upvotes: -1
Reputation: 1
@RunWith(Cucumber.class)
@CucumberOptions(
features = "src/test/resources/features",
glue = "stepDefinitions",
tags="@grup1 or @grup2",
dryRun = false
)
Upvotes: 0
Reputation: 1
@CucumberOptions(
/* tags = {"@SmokeTest","@Register"},*/
features = "src/test/Features",
glue = "",
plugin = { "pretty","json:target/stepdefinition.json"})
I commented the tags line and the test cases ran in order for me. Try this and let me know.
Upvotes: -1
Reputation: 71
For multiple tags Cucumber uses logical AND and logical OR. For example, the below works fine for me.
@RunWith(Cucumber.class)
@CucumberOptions(plugin = {"pretty", "html:target/cucumber-report.html"},
features= "Features",
glue= {"com.cucumber.stepdefinition"},
tags= "@RegressionTest or @SmokeTest"
)
public class TestRunner {
}
Upvotes: 7
Reputation: 23
See the below implemtation of multi tag form cucumber rummer:
@CucumberOptions( features = "src/test/java/features", glue="stepDefinations", tags = "@Test_Working_Calendar,@Test_email_tempalte", plugin = {"pretty","html:target/cucumber" ,"json:target/cucumber.json" ,"junit:target/cukes.xml" ,"com.cucumber.listener.ExtentCucumberFormatter:target/cucumber-reports/report.html"})
Upvotes: 1
Reputation: 4683
Here's a sample cucumber Junit runner template:
@RunWith(Cucumber.class)
@CucumberOptions(features = { "classpath:features/*.feature" }, glue = "packagename(s) or class name(s) containing the step definitions", plugin = {
"pretty:target/prettyReport.txt", "html:target/cucumber", "json:target/cucumber.json", "rerun:target/rerun.txt",
"junit:target/junit-report.xml", "testng:target/testng-output.xml" }, monochrome = true, tags = {"~@Ignore"})
public class FeatureRunnerTest {
}
Hope this helps!!
EDIT: "~" symbol..is used for negation..that is run all the features except one's marked with Ignore tag..On the other hand u can specify list of tags in the tags attribute comma seperated to run only those tests
Upvotes: 0