Skipping Tests on Condition

Use onlyWhen if you need to skip tests based on a condition. package scenarios.concept import static org.testingisdocumenting.webtau.WebTauGroovyDsl.* String emailHost = cfg.emailHost onlyWhen('email server is internal', { -> emailHost.contains('internal.server')}) { scenario('confirmation emails should be sent') { // ... http.get(emailHost) { subjects.should contain('my message') } } } Tests will still appear as part of your report but will be marked as skipped.

Skipping Tests Based on Env

Use the skipForEnv and onlyForEnv shortcuts if you need to skip or enable tests for a certain environment. package scenarios.concept import static org.testingisdocumenting.webtau.WebTauGroovyDsl.* onlyForEnv('experimental') { scenario('this scenario will only be executed in "experimental" env') { http.get('/new-endpoint') { price.shouldBe > 0 } } } skipForEnv('experimental') { scenario('this scenario will not be executed in "experimental" env') { http.get('/new-endpoint') { price.shouldBe > 0 } } }

Custom Shortcuts

Consider creating your project specific shortcuts to avoid boilerplate. Here is an example of onlyForEnv shortcut definition. static void onlyForEnv(String env, Closure registrationCode) { onlyWhen("only for <$env> environment", { -> cfg.getEnv() == env }, registrationCode) }

Unconditionally Skipping Tests

Instead of scenario , use dscenario or disabledScenario to always skip a test. This is analogous to Junit's @Ignore or @Disabled . package scenarios.concept import static org.testingisdocumenting.webtau.WebTauGroovyDsl.* dscenario('do not execute this scenario') { http.get('/non-existing-endpoint') { price.shouldBe > 0 } } disabledScenario('do not execute this scenario either') { http.get('/non-existing-endpoint') { price.shouldBe > 0 } } Alternatively, if you name file as <fileName>.disabled.groovy WebTau will skip all the scenarios inside.