@@ -551,14 +551,20 @@ private void runTests(Set<Class<? extends AbstractSmackIntTest>> classes)
551
551
LOGGER .info (sb .toString ());
552
552
553
553
for (PreparedTest test : tests ) {
554
- test .run ();
554
+ boolean successful = test .run ();
555
+ // Will only be not successful if a test failed and config.failFast is enabled.
556
+ if (!successful ) {
557
+ break ;
558
+ }
555
559
}
556
560
557
- // Assert that all tests in the 'tests' list produced a result.
558
- assert numberOfAvailableTests == testRunResult .getNumberOfAvailableTests ();
561
+ if (!config .failFast ) {
562
+ // Assert that all tests in the 'tests' list produced a result.
563
+ assert numberOfAvailableTests == testRunResult .getNumberOfAvailableTests ();
564
+ }
559
565
}
560
566
561
- private void runConcreteTest (ConcreteTest concreteTest )
567
+ private boolean runConcreteTest (ConcreteTest concreteTest )
562
568
throws InterruptedException , XMPPException , IOException , SmackException {
563
569
LOGGER .info (concreteTest + " Start" );
564
570
var testStart = ZonedDateTime .now ();
@@ -576,7 +582,7 @@ private void runConcreteTest(ConcreteTest concreteTest)
576
582
LOGGER .info (concreteTest + " is not possible" );
577
583
testRunResult .impossibleIntegrationTests .add (new TestNotPossible (concreteTest , testStart , testEnd ,
578
584
null , (TestNotPossibleException ) cause ));
579
- return ;
585
+ return true ;
580
586
}
581
587
Throwable nonFatalFailureReason ;
582
588
// junit asserts throw an AssertionError if they fail, those should not be
@@ -593,7 +599,7 @@ private void runConcreteTest(ConcreteTest concreteTest)
593
599
sinttestDebugger .onTestFailure (concreteTest , testEnd , nonFatalFailureReason );
594
600
}
595
601
LOGGER .log (Level .SEVERE , concreteTest + " Failed" , e );
596
- return ;
602
+ return false ;
597
603
}
598
604
catch (IllegalArgumentException | IllegalAccessException e ) {
599
605
throw new AssertionError (e );
@@ -605,6 +611,7 @@ private void runConcreteTest(ConcreteTest concreteTest)
605
611
}
606
612
LOGGER .info (concreteTest + " Success" );
607
613
testRunResult .successfulIntegrationTests .add (new SuccessfulTest (concreteTest , testStart , testEnd , null ));
614
+ return true ;
608
615
}
609
616
610
617
private static void verifyLowLevelTestMethod (Method method ,
@@ -769,23 +776,29 @@ private PreparedTest(AbstractSmackIntTest test, List<ConcreteTest> concreteTests
769
776
afterClassMethod = getSinttestSpecialMethod (testClass , AfterClass .class );
770
777
}
771
778
772
- public void run () throws InterruptedException , XMPPException , IOException , SmackException {
779
+ public boolean run () throws InterruptedException , XMPPException , IOException , SmackException {
773
780
try {
774
781
// Run the @BeforeClass methods (if any)
775
782
executeSinttestSpecialMethod (beforeClassMethod );
776
783
777
784
for (ConcreteTest concreteTest : concreteTests ) {
778
785
TEST_UNDER_EXECUTION = concreteTest ;
786
+ boolean successful ;
779
787
try {
780
- runConcreteTest (concreteTest );
788
+ successful = runConcreteTest (concreteTest );
781
789
} finally {
782
790
TEST_UNDER_EXECUTION = null ;
783
791
}
792
+
793
+ if (config .failFast && !successful ) {
794
+ return false ;
795
+ }
784
796
}
785
797
}
786
798
finally {
787
799
executeSinttestSpecialMethod (afterClassMethod );
788
800
}
801
+ return true ;
789
802
}
790
803
791
804
private void executeSinttestSpecialMethod (Method method ) {
0 commit comments