public class SpincastJUnitRunner
extends org.junit.runners.BlockJUnit4ClassRunner
Only creates one instance of the test class for all the tests.
If the class is annotated with BeforeAfterClassMethodsProvider, then
a beforeClass() and afterClass() methods will be
called.
You can use the ExpectingBeforeClassException annotation on the test
class to indicate that an exception is expected from the beforeClass()
method.
If you try to debug a test that only fails sometimes (those are the
worst!), you can use the Repeat annotation on the test or on
its test class. This allows you to run the test or the whole test class multiple times.
| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
logger |
static String |
SPINCAST_TEST_NAME_AFTER_CLASS_ANNOTATIONS_VALIDATION |
static String |
SPINCAST_TEST_NAME_AFTER_CLASS_LOOPS_EXCEPTION |
static String |
SPINCAST_TEST_NAME_AFTER_CLASS_METHOD_VALIDATION |
static String |
SPINCAST_TEST_NAME_BEFORE_CLASS_ANNOTATIONS_VALIDATION |
static String |
SPINCAST_TEST_NAME_BEFORE_CLASS_METHOD_VALIDATION |
static String |
SPINCAST_TEST_NAME_NO_TESTS_AND_NO_EXPECTION_EXCEPTION_ANNOTATION |
| Constructor and Description |
|---|
SpincastJUnitRunner(Class<?> klass) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addTestFailureListener(org.junit.runner.notification.RunNotifier notifier) |
protected List<org.junit.runners.model.FrameworkMethod> |
computeTestMethods() |
Object |
createTest()
JUnit calls that method to create an instance of the
test class for each individual test.
|
protected int |
getCurrentClassLoopPosition() |
protected int |
getLoopsNbr(Repeat repeatAnnotation) |
protected int |
getLoopsSleep(Repeat repeatAnnotation) |
protected int |
getMethodLoopsNbr(Method method) |
protected int |
getMethodLoopsSleep(Method method) |
protected String |
getName()
Test class display name.
|
protected org.junit.runner.notification.RunNotifier |
getRunNotifier() |
protected String |
getStackTrace(Throwable ex) |
protected Object |
getTestClassInstance() |
protected int |
getTestClassLoopsNbr() |
protected int |
getTestClassLoopsSleep() |
protected boolean |
isExceptionInBeforeClass() |
boolean |
isExpectingBeforeClassException() |
protected boolean |
isIgnoreRemainingTests() |
void |
run(org.junit.runner.notification.RunNotifier notifier)
Runs the test class.
|
protected void |
runChild(org.junit.runners.model.FrameworkMethod method,
org.junit.runner.notification.RunNotifier notifier)
Runs a specific test
|
protected void |
runPreClassLoopsSpincastTests() |
protected void |
setCurrentClassLoopPosition(int currentClassLoopPosition) |
protected void |
setExceptionInBeforeClass() |
protected void |
setIgnoreRemainingTests() |
protected void |
spincastTestError(String testName,
String errorMessage) |
protected void |
spincastTestError(String testName,
Throwable exception) |
protected void |
validateNoAfterClassAnnotations() |
protected void |
validateNoBeforeClassAnnotations() |
protected void |
validateNoTestsAndNoExpectingBeforeClassExceptionAnnotation() |
collectInitializationErrors, describeChild, getChildren, getTestRules, isIgnored, methodBlock, methodInvoker, possiblyExpectingExceptions, rules, testName, validateConstructor, validateFields, validateInstanceMethods, validateNoNonStaticInnerClass, validateOnlyOneConstructor, validateTestMethods, validateZeroArgConstructor, withAfters, withBefores, withPotentialTimeoutprotected final org.slf4j.Logger logger
public static final String SPINCAST_TEST_NAME_BEFORE_CLASS_ANNOTATIONS_VALIDATION
public static final String SPINCAST_TEST_NAME_AFTER_CLASS_ANNOTATIONS_VALIDATION
public static final String SPINCAST_TEST_NAME_BEFORE_CLASS_METHOD_VALIDATION
public static final String SPINCAST_TEST_NAME_AFTER_CLASS_METHOD_VALIDATION
public static final String SPINCAST_TEST_NAME_NO_TESTS_AND_NO_EXPECTION_EXCEPTION_ANNOTATION
public static final String SPINCAST_TEST_NAME_AFTER_CLASS_LOOPS_EXCEPTION
public SpincastJUnitRunner(Class<?> klass) throws org.junit.runners.model.InitializationError
org.junit.runners.model.InitializationErrorprotected org.junit.runner.notification.RunNotifier getRunNotifier()
protected void setIgnoreRemainingTests()
protected boolean isIgnoreRemainingTests()
protected void setExceptionInBeforeClass()
protected boolean isExceptionInBeforeClass()
protected int getCurrentClassLoopPosition()
protected void setCurrentClassLoopPosition(int currentClassLoopPosition)
public Object createTest() throws Exception
createTest in class org.junit.runners.BlockJUnit4ClassRunnerExceptionprotected Object getTestClassInstance()
protected String getName()
getName in class org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>protected final List<org.junit.runners.model.FrameworkMethod> computeTestMethods()
computeTestMethods in class org.junit.runners.BlockJUnit4ClassRunnerpublic void run(org.junit.runner.notification.RunNotifier notifier)
run in class org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>protected void runChild(org.junit.runners.model.FrameworkMethod method,
org.junit.runner.notification.RunNotifier notifier)
runChild in class org.junit.runners.BlockJUnit4ClassRunnerprotected void addTestFailureListener(org.junit.runner.notification.RunNotifier notifier)
protected void runPreClassLoopsSpincastTests()
protected void validateNoBeforeClassAnnotations()
protected void validateNoAfterClassAnnotations()
protected void validateNoTestsAndNoExpectingBeforeClassExceptionAnnotation()
public boolean isExpectingBeforeClassException()
protected int getTestClassLoopsNbr()
protected int getMethodLoopsNbr(Method method)
protected int getLoopsNbr(Repeat repeatAnnotation)
protected int getMethodLoopsSleep(Method method)
protected int getTestClassLoopsSleep()
protected int getLoopsSleep(Repeat repeatAnnotation)
Copyright © 2017. All rights reserved.