Package org.togglz.junit.vary
Class FeatureVariations
java.lang.Object
org.junit.runner.Runner
org.junit.runners.ParentRunner<org.junit.runner.Runner>
org.junit.runners.Suite
org.togglz.junit.vary.FeatureVariations
- All Implemented Interfaces:
org.junit.runner.Describable
,org.junit.runner.manipulation.Filterable
,org.junit.runner.manipulation.Orderable
,org.junit.runner.manipulation.Sortable
public class FeatureVariations
extends org.junit.runners.Suite
This class is custom JUnit runner that allows to run tests against different feature combinations. A usecase for this runner would be for example to test feature toggles that enable caching behavior. The runner can be configured to run the tests two times. Once with the flag enabled and once with the flag being disabled.
Tests executed with this runner must implement a public static method annotated with Variations
. This method must
return a VariationSet
set specifies which features should be varied.
Usage example:
@RunWith(FeatureVariations.class) public class FeatureVariationsTest { @Variations public static VariationSet<MyFeatures> getPermutations() { return VariationSetBuilder.create(MyFeatures.class) .enable(MyFeatures.FEATURE_ONE) .vary(MyFeatures.FEATURE_TWO); } @Test public void test() { // do the tests } }
In this example the test is executed two times. Once with FEATURE_TWO
being active and once with
FEATURE_TWO
being inactive. In both runs FEATURE_ONE
is enabled.
- Author:
- Christian Kaltepoth
-
Nested Class Summary
Nested classes/interfaces inherited from class org.junit.runners.Suite
org.junit.runners.Suite.SuiteClasses
-
Field Summary
-
Constructor Summary
-
Method Summary
Methods inherited from class org.junit.runners.Suite
describeChild, emptySuite, runChild
Methods inherited from class org.junit.runners.ParentRunner
childrenInvoker, classBlock, classRules, collectInitializationErrors, createTestClass, filter, getDescription, getName, getRunnerAnnotations, getTestClass, isIgnored, order, run, runLeaf, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses, withInterruptIsolation
Methods inherited from class org.junit.runner.Runner
testCount
-
Field Details
-
runners
-
-
Constructor Details
-
FeatureVariations
- Throws:
org.junit.runners.model.InitializationError
-
-
Method Details
-
getChildren
- Overrides:
getChildren
in classorg.junit.runners.Suite
-