How to use stepPending method of net.serenitybdd.junit.runners.FailureDetectingStepListener class

Best Serenity JUnit code snippet using net.serenitybdd.junit.runners.FailureDetectingStepListener.stepPending

Run Serenity JUnit automation tests on LambdaTest cloud grid

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

copy
1package net.serenitybdd.junit.runners;
2
3import net.serenitybdd.core.collect.NewList;
4import net.thucydides.core.model.DataTable;
5import net.thucydides.core.model.Story;
6import net.thucydides.core.model.TestOutcome;
7import net.thucydides.core.steps.ExecutedStepDescription;
8import net.thucydides.core.steps.StepFailure;
9import net.thucydides.core.steps.StepListener;
10import net.thucydides.core.steps.TestFailureCause;
11
12import java.util.ArrayList;
13import java.util.List;
14import java.util.Map;
15
16public class FailureDetectingStepListener implements StepListener {
17
18    private boolean lastTestFailed = false;
19    private List<String> failureMessages = new ArrayList<>();
20    private TestFailureCause testFailureCause;
21
22    public void reset() {
23        lastTestFailed = false;
24        failureMessages.clear();
25    }
26
27    public boolean lastTestFailed() {
28        return lastTestFailed;
29    }
30
31    public void testFailed(TestOutcome testOutcome, Throwable cause) {
32        lastTestFailed = true;
33        String failingStep = testOutcome.getFailingStep().isPresent() ? testOutcome.getFailingStep().get().getDescription() + ":" : "";
34        failureMessages.add(failingStep + testOutcome.getErrorMessage());
35        testFailureCause = TestFailureCause.from(cause);
36    }
37
38    public void lastStepFailed(StepFailure failure) {
39
40    }
41
42    public void testSuiteStarted(Class<?> storyClass) {
43
44    }
45
46
47    public void testSuiteStarted(Story storyOrFeature) {
48
49    }
50
51
52    public void testSuiteFinished() {
53
54    }
55
56
57    public void testStarted(String description) {
58        lastTestFailed = false;
59    }
60
61    @Override
62    public void testStarted(String description, String id) {
63        lastTestFailed = false;
64    }
65
66
67    public void testFinished(TestOutcome result) {
68
69    }
70
71
72    public void testRetried() {
73
74    }
75
76
77    public void stepStarted(ExecutedStepDescription description) {
78
79    }
80
81
82    public void skippedStepStarted(ExecutedStepDescription description) {
83
84    }
85
86
87    public void stepFailed(StepFailure failure) {
88
89    }
90
91
92
93
94
95    public void stepIgnored() {
96
97    }
98
99
100    public void stepPending() {
101
102    }
103
104
105    public void stepPending(String message) {
106
107    }
108
109
110    public void stepFinished() {
111
112    }
113
114
115    public void testIgnored() {
116
117    }
118
119    @Override
120    public void testSkipped() {
121
122    }
123
124    @Override
125    public void testPending() {
126
127    }
128
129    @Override
130    public void testIsManual() {
131
132    }
133
134
135    public void notifyScreenChange() {
136
137    }
138
139
140    public void useExamplesFrom(DataTable table) {
141
142    }
143
144    @Override
145    public void addNewExamplesFrom(DataTable table) {
146
147    }
148
149
150    public void exampleStarted(Map<String, String> data) {
151
152    }
153
154
155    public void exampleFinished() {
156
157    }
158
159
160    public void assumptionViolated(String message) {
161
162    }
163
164    @Override
165    public void testRunFinished() {
166
167    }
168
169    public TestFailureCause getTestFailureCause(){
170        return testFailureCause;
171    }
172
173    public List<String> getFailureMessages() {
174        return NewList.copyOf(failureMessages);
175    }
176}
177
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 stepPending code on LambdaTest Cloud Grid

Execute automation tests with stepPending 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)