Executing tests in cucumber

To write the tests using JUnit @RunWith annotation, we need below dependencies. cucumber.api.junit.Cucumber – This class is present in the cucumber-junit artifact library.


Then you can add below test class. After running the below test, cucumber generates the report at target/selenium-reports. Cucumber.class contains main method that reads the feature file and executes scenario in it.
package org.softpost;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;

        features = "classpath:abc.feature",
        glue = "classpath:org.softpost",
        plugin = "html:target/selenium-reports"

public class MyTests {

Web development and Automation testing

solutions delivered!!