Skip to content

Commit

Permalink
Documents SkipTestException (#806)
Browse files Browse the repository at this point in the history
Part of #522
  • Loading branch information
LeoColman authored and sksamuel committed Jul 21, 2019
1 parent 4e45acc commit 829ea9f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions doc/reference.md
Expand Up @@ -780,6 +780,22 @@ class BangExample : StringSpec({
})
```

### SkipTestException
Sometimes you want to interrupt a test in runtime, as perhaps you don't know at compile-time if the test should be executed. For this, KotlinTest provides a way to interrupt it by throwing an exception: The `SkipTestException`.

```kotlin
class SkipTestExceptionExample : StringSpec({

"Test should be skipped" {
if(isLocalEnvironment()) {
throw SkipTestException("Cannot run this test in local environment.")
}
}

})
```

`SkipTestException` is an open class, so you may extend it and customize it if you need it.


Grouping Tests with Tags
Expand Down

0 comments on commit 829ea9f

Please sign in to comment.