How to use testAborted method of net.thucydides.junit.listeners.TestCountListener class

Best Serenity JUnit code snippet using net.thucydides.junit.listeners.TestCountListener.testAborted

Run Serenity JUnit automation tests on LambdaTest cloud grid

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

copy
1package net.thucydides.junit.listeners;
2
3import net.thucydides.core.logging.LoggingLevel;
4import net.thucydides.core.model.DataTable;
5import net.thucydides.core.model.Story;
6import net.thucydides.core.model.TestOutcome;
7import net.thucydides.core.statistics.TestCount;
8import net.thucydides.core.steps.ExecutedStepDescription;
9import net.thucydides.core.steps.StepFailure;
10import net.thucydides.core.steps.StepListener;
11import net.thucydides.core.util.EnvironmentVariables;
12import org.slf4j.Logger;
13import org.slf4j.LoggerFactory;
14
15import java.util.Map;
16
17import static net.thucydides.core.ThucydidesSystemProperty.SERENITY_DISPLAY_TEST_NUMBERS;
18
19public class TestCountListener implements StepListener {
20
21    private final Logger logger;
22    private final EnvironmentVariables environmentVariables;
23    private final TestCount testCount;
24    private final boolean reportTestCount;
25
26    protected TestCountListener(EnvironmentVariables environmentVariables, Logger logger, TestCount testCount) {
27        this.logger = logger;
28        this.environmentVariables = environmentVariables;
29        this.testCount = testCount;
30        this.reportTestCount = SERENITY_DISPLAY_TEST_NUMBERS.booleanFrom(environmentVariables,false);
31    }
32
33    public TestCountListener(EnvironmentVariables environmentVariables, TestCount testCount) {
34        this(environmentVariables, LoggerFactory.getLogger(""), testCount);
35    }
36
37    protected Logger getLogger() {
38        return logger;
39    }
40
41    public void testSuiteStarted(Class<?> storyClass) {
42    }
43
44
45    public void testSuiteStarted(Story storyOrFeature) {
46    }
47
48
49    public void testSuiteFinished() {
50    }
51
52
53    public void testStarted(String description) {
54        int currentTestCount = testCount.getNextTest();
55        if (reportTestCount && LoggingLevel.definedIn(environmentVariables).isAtLeast(LoggingLevel.VERBOSE)) {
56            getLogger().info("TEST NUMBER: {}", currentTestCount);
57        }
58    }
59
60    @Override
61    public void testStarted(String description, String id) {
62        testStarted(description);
63    }
64
65
66    public void testFinished(TestOutcome result) {
67    }
68
69    public void testRetried() {
70    }
71
72    public void stepStarted(ExecutedStepDescription description) {
73    }
74
75
76    public void skippedStepStarted(ExecutedStepDescription description) {
77    }
78
79
80    public void stepFailed(StepFailure failure) {
81    }
82
83
84    public void lastStepFailed(StepFailure failure) {
85    }
86
87
88    public void stepIgnored() {
89    }
90
91    public void stepPending() {
92    }
93
94
95    public void stepPending(String message) {
96    }
97
98
99    public void stepFinished() {
100    }
101
102
103    public void testFailed(TestOutcome testOutcome, Throwable cause) {
104    }
105
106
107    public void testIgnored() {
108    }
109
110    @Override
111    public void testSkipped() {
112
113    }
114
115    @Override
116    public void testAborted() {
117
118    }
119
120    @Override
121    public void testPending() {
122
123    }
124
125    @Override
126    public void testIsManual() {
127
128    }
129
130
131    public void notifyScreenChange() {
132    }
133
134    public void useExamplesFrom(DataTable table) {
135    }
136
137    @Override
138    public void addNewExamplesFrom(DataTable table) {
139
140    }
141
142    public void exampleStarted(Map<String, String> data) {
143    }
144
145    public void exampleFinished() {
146    }
147
148    @Override
149    public void assumptionViolated(String message) {
150    }
151
152    @Override
153    public void testRunFinished() {
154
155    }
156}
157
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

Trigger testAborted code on LambdaTest Cloud Grid

Execute automation tests with testAborted on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

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)