testwhen
testwhen is a term used in software testing to describe conditional execution of tests based on a runtime predicate. The predicate can check operating system, environment variables, feature flags, availability of dependencies, or other state at test time. If the predicate evaluates to true, the test is executed; otherwise the test is skipped or marked as not applicable. This concept is commonly implemented in test frameworks as a decorator, annotation, or function that gates a test.
In practice, testwhen appears as skip-if or enable-if mechanisms. Examples include a skip-if condition that prevents
Use cases include platform-specific tests (only run on Windows), optional dependencies, experimental features behind flags, environment-specific
Advantages include reducing false failures when an environment does not meet requirements and speeding up test
See also: conditional test, skip, feature flag, environment marker.