Class SplitTestRunner
- java.lang.Object
-
- org.junit.runner.Runner
-
- org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>
-
- org.junit.runners.BlockJUnit4ClassRunner
-
- io.split.client.testing.runner.SplitTestRunner
-
- All Implemented Interfaces:
org.junit.runner.Describable,org.junit.runner.manipulation.Filterable,org.junit.runner.manipulation.Sortable
public class SplitTestRunner extends org.junit.runners.BlockJUnit4ClassRunnerSplit Test RunnerExtension of standard JUnit 4 Runner Leverages Split* Testing Annotations to automate unit testing across various Feature Flag treatments Only one Annotation is respected per Test (IE Can not combine @SplitTest with @SplitScenarios on a single Test method)
-
-
Constructor Summary
Constructors Constructor Description SplitTestRunner(Class<?> klass)Split Test Runner Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<org.junit.runners.model.FrameworkMethod>computeTestMethods()Run tests in Alphabetical Orderprotected org.junit.runner.DescriptiondescribeChild(org.junit.runners.model.FrameworkMethod method)Generate Test DescriptionSuitegenerateSuite(org.junit.runners.model.FrameworkMethod method)protected voidrunChild(org.junit.runners.model.FrameworkMethod method, org.junit.runner.notification.RunNotifier notifier)Run Suite of Scenarios for a Testprotected org.junit.runners.model.StatementwithBefores(org.junit.runners.model.FrameworkMethod method, Object target, org.junit.runners.model.Statement statement)Adds Split Application to the Test's Call Stack-
Methods inherited from class org.junit.runners.BlockJUnit4ClassRunner
collectInitializationErrors, createTest, getChildren, getTestRules, isIgnored, methodBlock, methodInvoker, possiblyExpectingExceptions, rules, testName, validateConstructor, validateFields, validateInstanceMethods, validateNoNonStaticInnerClass, validateOnlyOneConstructor, validateTestMethods, validateZeroArgConstructor, withAfters, withPotentialTimeout
-
-
-
-
Constructor Detail
-
SplitTestRunner
public SplitTestRunner(Class<?> klass) throws org.junit.runners.model.InitializationError
Split Test Runner ConstructorRunner is instantiated by using the @RunWith(SplitTestRunner.class) annotation. Not to be called directly.
- Parameters:
klass- The Test class to be run- Throws:
org.junit.runners.model.InitializationError- Error occurred during class initialization
-
-
Method Detail
-
computeTestMethods
protected List<org.junit.runners.model.FrameworkMethod> computeTestMethods()
Run tests in Alphabetical OrderRunner is instantiated by using the @RunWith(SplitTestRunner.class) annotation. Not to be called directly.
- Overrides:
computeTestMethodsin classorg.junit.runners.BlockJUnit4ClassRunner
-
runChild
protected void runChild(org.junit.runners.model.FrameworkMethod method, org.junit.runner.notification.RunNotifier notifier)Run Suite of Scenarios for a TestGenerates a Suite of Scenarios and then runs the test once for each permutation. If no Scenarios are defined, or the only defined Scenario has no Tests set, Run test normally
- Overrides:
runChildin classorg.junit.runners.BlockJUnit4ClassRunner- Parameters:
method- The Test function to be runnotifier- The notifier class tracking test execution
-
withBefores
protected org.junit.runners.model.Statement withBefores(org.junit.runners.model.FrameworkMethod method, Object target, org.junit.runners.model.Statement statement)Adds Split Application to the Test's Call StackThis Override method first adds the application of Splits to run before the test execution. Then calls the SuperClass's method to add all @Before annotations to the call stack
This is required to ensure the Tested code is using the same SplitClient that the Runner is using.
- Overrides:
withBeforesin classorg.junit.runners.BlockJUnit4ClassRunner- Returns:
- An instance of the Test Class being run
-
generateSuite
public Suite generateSuite(org.junit.runners.model.FrameworkMethod method)
-
describeChild
protected org.junit.runner.Description describeChild(org.junit.runners.model.FrameworkMethod method)
Generate Test DescriptionIf no Scenarios are on for that test, describe normally Otherwise Describe as a Suite of tests, showing the active splits for each Scenario in that run's description
- Overrides:
describeChildin classorg.junit.runners.BlockJUnit4ClassRunner- Parameters:
method- The Test method to be run- Returns:
- A formatted description of that Test
-
-