Skip to content

Commit 1be2e8b

Browse files
More safety
1 parent 852a750 commit 1be2e8b

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/test/java/com/applitools/example/AcmeBankTests.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ public void cleanUpTest() {
150150
// If you want to wait synchronously for all checkpoints to complete, then use `eyes.close()`.
151151
}
152152

153+
public void abortTests() {
154+
// Abort tests if things go wrong.
155+
eyes.abortAsync();
156+
}
157+
153158
public void printResults() {
154159

155160
// Close the batch and report visual differences to the console.
@@ -174,10 +179,18 @@ public static void main(String [] args) {
174179
catch (Exception e) {
175180
e.printStackTrace();
176181
}
177-
finally {
182+
183+
try {
178184
// No matter what, perform cleanup
179185
tests.cleanUpTest();
180186
tests.printResults();
187+
}
188+
catch (Exception e) {
189+
e.printStackTrace();
190+
tests.abortTests();
191+
}
192+
finally {
193+
// Always force execution to end
181194
System.exit(0);
182195
}
183196
}

0 commit comments

Comments
 (0)