Cucumber + Java
Introduction to Cucumber Installation of CucumberAdding Cucumber dependency to Java project Writing first cucumber test Executing Cucumber tests using Cucumber class Cucumber options Tagging the scenarios Using name option Passing parameters to steps Key – Value pair Datatable Multiple column datatable in Cucumber Scenario Background Scenario outline Running multiple feature files in Cucumber Sharing selenium Webdriver instance using PicoContainer Embedding the screenshot Writing to Cucumber HTML reports Cucumber dependency for using Lambda expressions in Java 8 Cucumber test using Lambda expressionsHow to run multiple feature files in cucumber
We can execute scenarios in multiple feature files as shown in below example. We are running 2 feature files – multicolumn and outline. Note that to execute all feature files, we can also use * operator.
package org.softpost;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(
features = {"classpath:multicolumn.feature","classpath:outline.feature"},
glue = "classpath:org.softpost",
plugin = "html:target/selenium-reports"
)
public class MultipleFeatureTest {
}
Here is the HTML report generated after execution of above test class.
Web development and Automation testing
solutions delivered!!