-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle TestNG SkipException correctly, fixes #355
- Loading branch information
Jan Schäfer
committed
Jul 28, 2018
1 parent
ea411a0
commit fe0975f
Showing
3 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
jgiven-testng/src/test/java/com/tngtech/jgiven/testng/SkipExceptionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.tngtech.jgiven.testng; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.assertj.core.api.Assertions; | ||
|
||
import com.tngtech.jgiven.annotation.Description; | ||
import com.tngtech.jgiven.report.model.ScenarioCaseModel; | ||
import com.tngtech.jgiven.report.model.StepStatus; | ||
import org.testng.SkipException; | ||
import org.testng.annotations.Test; | ||
|
||
@Description( "SkipException are handled correctly" ) | ||
public class SkipExceptionTest extends SimpleScenarioTest<TestNgTest.TestSteps> { | ||
|
||
@Test | ||
public void TestNG_skipped_exceptions_should_be_treated_correctly() throws Throwable { | ||
try { | ||
given().skipped_exception_is_thrown(); | ||
Assertions.fail( "SkipException should have been thrown" ); | ||
} catch( SkipException e ) {} | ||
|
||
getScenario().finished(); | ||
|
||
ScenarioCaseModel aCase = getScenario().getModel().getLastScenarioModel().getCase( 0 ); | ||
assertThat( aCase.getStep( 0 ).getStatus() ).isEqualTo( StepStatus.PASSED ); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters