All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.cucumber.testng.AbstractTestNGCucumberTests Maven / Gradle / Ivy

There is a newer version: 7.19.0
Show newest version
package io.cucumber.testng;

import org.apiguardian.api.API;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

/**
 * Abstract TestNG Cucumber Test
 * 

* Runs each cucumber scenario found in the features as separated test. * * @see TestNGCucumberRunner */ @API(status = API.Status.STABLE) public abstract class AbstractTestNGCucumberTests { private TestNGCucumberRunner testNGCucumberRunner; @BeforeClass(alwaysRun = true) public void setUpClass() { testNGCucumberRunner = new TestNGCucumberRunner(this.getClass()); } @SuppressWarnings("unused") @Test(groups = "cucumber", description = "Runs Cucumber Scenarios", dataProvider = "scenarios") public void runScenario(PickleWrapper pickleWrapper, FeatureWrapper featureWrapper) throws Throwable { // the 'featureWrapper' parameter solely exists to display the feature file in a test report testNGCucumberRunner.runScenario(pickleWrapper.getPickle()); } /** * Returns two dimensional array of {@link PickleWrapper}s * with their associated {@link FeatureWrapper}s. * * @return a two dimensional array of scenarios features. */ @DataProvider public Object[][] scenarios() { if (testNGCucumberRunner == null) { return new Object[0][0]; } return testNGCucumberRunner.provideScenarios(); } @AfterClass(alwaysRun = true) public void tearDownClass() { if (testNGCucumberRunner == null) { return; } testNGCucumberRunner.finish(); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy