You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<plugin>
<groupId>io.github.rsshekhawat</groupId>
<artifactId>cucumber-parallel-xbrowser-testing</artifactId>
<version>latest_version</version>
<executions>
<execution>
<id>parallel</id>
<phase>generate-test-resources</phase>
<goals>
<goal>xbrowser</goal>
</goals>
<configuration>
// This is mandatory tag. Give the path of your 'xbrowser.template' file
<templateRunnerPath>path_to_test_runner_template</templateRunnerPath>
// This is mandatory tag. Give the path of your feature files directory
<featureFilesPath>path_to_feature_files_directory</featureFilesPath>
// This is mandatory tag. Give the path of your config.xml file
<configurationFilePath>path_to_config_file</configurationFilePath>
// This is mandatory tag. Leave it empty if you are not using tags like <includedTags></includedTags>
// You can also use combinations of tags as well, as per the cucumber tags rules.
<includedTags>@Smoke</includedTags>
</configuration>
</execution>
</executions>
</plugin>
STEP 2 : Create config.xml file to provide the details of different configurations (OS/Browser) on which to execute plugin.
Change below tags and configurations according to your projects. You can provide as many configurations as you want to execute tests on different given configurations.
STEP 3 : Create xbrowser.template file which is exactly the replica of the test runner you want to run for each configuration
import io.cucumber.testng.AbstractTestNGCucumberTests;
import io.cucumber.testng.CucumberOptions;
import org.testng.Reporter;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import java.io.File;
import java.io.IOException;
import io.github.rsshekhawat.CreateTestRunners;
@CucumberOptions(
features = {"FEATURE_FILES_PATH"},
monochrome = true,
tags = "FEATURE_FILES_TAGS",
glue="",
plugin = {"json:target/parallel-xbrowser/cucumber-report/TEST_RUNNER_CLASS_NAME.json"}
)
public class TEST_RUNNER_CLASS_NAME extends AbstractTestNGCucumberTests {
@BeforeClass
public void init() throws IOException {
// This code section is not necessary to include
// ------------------------------------------------------------------------------------------------------------------------------------
String directoryPath = System.getProperty("user.dir")+File.separator+"target"+File.separator+"parallel-xbrowser"+File.separator+"data";
String filePath = directoryPath + File.separator + "TEST_RUNNER_CLASS_NAME.properties";
PropFileHandler.filePath = filePath;
// ------------------------------------------------------------------------------------------------------------------------------------
// below function will set system properties to run this test runner on given configuration in config.xml
new CreateTestRunners().setSystemVariables("TEST_RUNNER_CLASS_NAME.properties");
}
@AfterClass
public void closeSession(){
// Write your own code to close the session as per your project
Reporter.log("Closing browser",true);
try {
driver.quit();
}catch(Exception exception){
Reporter.log(exception.getMessage());
}
}
}
STEP 4 : Execute plugin with mvn command
mvn clean verify
About
This plugin enables parallel cross browser testing on multiple configurations.