How to use CucumberScenarioVisualiser class of net.serenitybdd.cucumber.suiteslicing package

Best Serenity Cucumber code snippet using net.serenitybdd.cucumber.suiteslicing.CucumberScenarioVisualiser

Run Serenity Cucumber automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

copy
1package net.serenitybdd.cucumber.suiteslicing;
2
3import net.thucydides.core.annotations.Narrative;
4import net.thucydides.core.guice.Injectors;
5import net.thucydides.core.util.EnvironmentVariables;
6
7import org.junit.Before;
8import org.junit.Test;
9
10import java.net.URI;
11import java.net.URL;
12
13@Narrative(text = "There are no assertions in this test, but this is a useful tool for generating a visualisation of how a specific test slicing "
14                  + "configuration will be executed as part of a running test. The test methods below allow a number of parameters to be input and when the test is run"
15                  + "a json file will be produced into the serenity output directory that shows how the tests have been sliced."
16                  + "Note that test slicing will always be 100% deterministic given the same set of inputs "
17                  + "which makes this mechanism an excellent choice for running on grid of multiple servers, each running a mutually exclusive slice."
18                  + "Variables that can be input here include feature root, number of slices, number of forks and test statistics (line count based or actual run data)")
19public class CucumberSliceVisualiserTest {
20
21    private TestStatistics HISTORIC_RUN_STATISTICS;
22    private TestStatistics LINE_COUNT_STATISTICS;
23    private EnvironmentVariables environmentVariables;
24    private CucumberScenarioVisualiser cucumberScenarioVisualiser;
25    private static final String FEATURE_ROOT = "classpath:smoketests";
26
27
28    @Before
29    public void setUp() throws Exception{
30        HISTORIC_RUN_STATISTICS = MultiRunTestStatistics.fromRelativePath("/statistics");
31        LINE_COUNT_STATISTICS = ScenarioLineCountStatistics.fromFeaturePath(new URI(FEATURE_ROOT));
32        environmentVariables = Injectors.getInjector().getInstance(EnvironmentVariables.class);
33        cucumberScenarioVisualiser = new CucumberScenarioVisualiser(environmentVariables);
34    }
35
36    @Test
37    public void visualise1SliceWith4Forks() throws Exception {
38        cucumberScenarioVisualiser.visualise(new URI(FEATURE_ROOT), 4, 2, HISTORIC_RUN_STATISTICS);
39    }
40
41    @Test
42    public void visualise4SlicesWith2Forks() throws Exception {
43        cucumberScenarioVisualiser.visualise(new URI(FEATURE_ROOT), 4, 2, HISTORIC_RUN_STATISTICS);
44    }
45
46    @Test
47    public void visualise5SlicesWith1ForkBasedOnRunStats() throws Exception {
48        cucumberScenarioVisualiser.visualise(new URI(FEATURE_ROOT), 5, 1, HISTORIC_RUN_STATISTICS);
49    }
50
51    @Test
52    public void visualise5SlicesWith1ForkBasedOnLineCount() throws Exception {
53        cucumberScenarioVisualiser.visualise(new URI(FEATURE_ROOT), 5, 1, LINE_COUNT_STATISTICS);
54    }
55
56
57}
58
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

...Most popular Stackoverflow questions on CucumberScenarioVisualiser

    No relevant questions found for this class 😞

Most used methods in CucumberScenarioVisualiser

Run Selenium Automation Tests on LambdaTest Cloud Grid

Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)