Conditional tests with annotations
If we wish to completely disable a Spec and all tests included in the spec, we can do this using annotations.
An advantage to this approach, instead of disabling each test one by one, is that the spec will not be instantiated. If a spec has expensive resource setup/teardown, then that time can be avoided by this approach.
JVM Only
These annotations are only available for specs executing on the JVM.
@Ignored​
If we wish to simply disable a spec completely, then we can use the @Ignored annotation.
@Ignored
class IgnoredSpec : FunSpec() {
init {
error("boom") // spec will not be created, so this error will not happen
}
}