public class SpincastJUnitRunner
extends org.junit.runners.BlockJUnit4ClassRunner
Only creates one instance of the test class for all its tests.
If the class implements 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 @RepeatUntilFail annotation on the test or on
its test class. This allows you to run the test or the whole test class multiple times.
You can also use @RepeatUntilSuccess instead to repeat
the test class (or a single test) multiple time until it succeeds (or the maximum
number of tries is reached).
| Modifier and Type | Field and Description |
|---|---|
protected static 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_EXPECTING_FAILURE_BUT_ONLY_SUCCESSES |
static String |
SPINCAST_TEST_NAME_NO_TESTS_AND_NO_EXPECTION_EXCEPTION_ANNOTATION |
static String |
SPINCAST_TEST_NAME_REPEAT_ANNOTATIONS_VALIDATION |
| Constructor and Description |
|---|
SpincastJUnitRunner(Class<?> clazz) |
| Modifier and Type | Method and Description |
|---|---|
protected org.junit.runners.model.Statement |
addCustomErrorHandling(org.junit.runners.model.Statement baseStatement,
org.junit.runners.model.FrameworkMethod method) |
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 org.junit.runners.model.Statement |
customizeStatement(org.junit.runners.model.Statement statement,
org.junit.runners.model.FrameworkMethod method) |
protected Integer |
geRepeatUntilFailureAnnotationLoopsNbr(RepeatUntilFailure repeatUntilFailureAnnotation)
Will be
null if there if no
RepeatUntilFailure annotation. |
protected Integer |
geRepeatUntilSuccessAnnotationLoopsNbr(RepeatUntilSuccess repeatUntilSuccessAnnotation)
Will be
null if there if no
RepeatUntilSuccess annotation. |
protected int |
getCurrentClassLoopPosition() |
protected Integer |
getMethodRepeatUntilFailureAnnotationLoopsNbr(Method method)
Will be
null if there if no
RepeatUntilFailure annotation. |
protected Integer |
getMethodRepeatUntilFailureAnnotationLoopsSleep(Method method)
Will be
null if there if no
RepeatUntilFailure annotation. |
protected Integer |
getMethodRepeatUntilSuccessAnnotationLoopsNbr(Method method)
Will be
null if there if no
RepeatUntilSuccess annotation. |
protected Integer |
getMethodRepeatUntilSuccessAnnotationLoopsSleep(Method method)
Will be
null if there if no
RepeatUntilSuccess annotation. |
protected String |
getName()
Test class display name.
|
protected Integer |
getRepeatUntilFailureAnnotationLoopsSleep(RepeatUntilFailure repeatAnnotation)
Will be
null if there if no
RepeatUntilFailure annotation. |
protected Integer |
getRepeatUntilSuccessAnnotationLoopsSleep(RepeatUntilSuccess repeatUntilSuccessAnnotation)
Will be
null if there if no
RepeatUntilSuccess annotation. |
protected org.junit.runner.notification.RunNotifier |
getRunNotifier() |
protected String |
getStackTrace(Throwable ex) |
protected Object |
getTestClassInstance() |
protected Integer |
getTestClassRepeatUntilFailureAnnotationLoopsNbr()
Will be
null if there if no
RepeatUntilFailure annotation. |
protected Integer |
getTestClassRepeatUntilFailureAnnotationLoopsSleep()
Will be
null if there if no
RepeatUntilFailure annotation. |
protected Integer |
getTestClassRepeatUntilSuccessAnnotationLoopsNbr()
Will be
null if there if no
RepeatUntilSuccess annotation. |
protected Integer |
getTestClassRepeatUntilSuccessAnnotationLoopsSleep()
Will be
null if there if no
RepeatUntilSuccess annotation. |
protected boolean |
isExceptionInBeforeClass() |
boolean |
isExpectingBeforeClassException() |
boolean |
isExpectingFailure() |
protected boolean |
isIgnoreRemainingTests() |
protected boolean |
isLastInstanceOfThisTestToRun() |
protected void |
logTestFailure(org.junit.runner.notification.Failure failure) |
protected org.junit.runners.model.Statement |
methodBlock(org.junit.runners.model.FrameworkMethod method) |
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 |
setExceptionInBeforeClass() |
protected void |
setIgnoreRemainingTests() |
protected void |
spincastTestError(String testName,
String errorMessage) |
protected void |
spincastTestError(String testName,
Throwable exception) |
protected void |
testFailureCustomHandling(org.junit.runner.notification.Failure failure) |
protected void |
validateNoAfterClassAnnotations() |
protected void |
validateNoBeforeClassAnnotations() |
protected void |
validateNoTestsAndNoExpectingBeforeClassExceptionAnnotation() |
protected void |
validateTestClassRepeateAnnotations() |
collectInitializationErrors, describeChild, getChildren, getTestRules, isIgnored, methodInvoker, possiblyExpectingExceptions, rules, testName, validateConstructor, validateFields, validateInstanceMethods, validateNoNonStaticInnerClass, validateOnlyOneConstructor, validateTestMethods, validateZeroArgConstructor, withAfters, withBefores, withPotentialTimeoutprotected static 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 static final String SPINCAST_TEST_NAME_REPEAT_ANNOTATIONS_VALIDATION
public static final String SPINCAST_TEST_NAME_EXPECTING_FAILURE_BUT_ONLY_SUCCESSES
public SpincastJUnitRunner(Class<?> clazz) 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()
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 org.junit.runners.model.Statement methodBlock(org.junit.runners.model.FrameworkMethod method)
methodBlock in class org.junit.runners.BlockJUnit4ClassRunnerprotected org.junit.runners.model.Statement customizeStatement(org.junit.runners.model.Statement statement,
org.junit.runners.model.FrameworkMethod method)
protected org.junit.runners.model.Statement addCustomErrorHandling(org.junit.runners.model.Statement baseStatement,
org.junit.runners.model.FrameworkMethod method)
protected void addTestFailureListener(org.junit.runner.notification.RunNotifier notifier)
protected void testFailureCustomHandling(org.junit.runner.notification.Failure failure)
protected void logTestFailure(org.junit.runner.notification.Failure failure)
protected boolean isLastInstanceOfThisTestToRun()
protected void runPreClassLoopsSpincastTests()
protected void validateNoBeforeClassAnnotations()
protected void validateNoAfterClassAnnotations()
protected void validateNoTestsAndNoExpectingBeforeClassExceptionAnnotation()
protected void validateTestClassRepeateAnnotations()
public boolean isExpectingBeforeClassException()
public boolean isExpectingFailure()
protected Integer getTestClassRepeatUntilFailureAnnotationLoopsNbr()
null if there if no
RepeatUntilFailure annotation.protected Integer getMethodRepeatUntilFailureAnnotationLoopsNbr(Method method)
null if there if no
RepeatUntilFailure annotation.protected Integer geRepeatUntilFailureAnnotationLoopsNbr(RepeatUntilFailure repeatUntilFailureAnnotation)
null if there if no
RepeatUntilFailure annotation.protected Integer getTestClassRepeatUntilFailureAnnotationLoopsSleep()
null if there if no
RepeatUntilFailure annotation.protected Integer getMethodRepeatUntilFailureAnnotationLoopsSleep(Method method)
null if there if no
RepeatUntilFailure annotation.protected Integer getRepeatUntilFailureAnnotationLoopsSleep(RepeatUntilFailure repeatAnnotation)
null if there if no
RepeatUntilFailure annotation.protected Integer getTestClassRepeatUntilSuccessAnnotationLoopsNbr()
null if there if no
RepeatUntilSuccess annotation.protected Integer getMethodRepeatUntilSuccessAnnotationLoopsNbr(Method method)
null if there if no
RepeatUntilSuccess annotation.protected Integer geRepeatUntilSuccessAnnotationLoopsNbr(RepeatUntilSuccess repeatUntilSuccessAnnotation)
null if there if no
RepeatUntilSuccess annotation.protected Integer getTestClassRepeatUntilSuccessAnnotationLoopsSleep()
null if there if no
RepeatUntilSuccess annotation.protected Integer getMethodRepeatUntilSuccessAnnotationLoopsSleep(Method method)
null if there if no
RepeatUntilSuccess annotation.protected Integer getRepeatUntilSuccessAnnotationLoopsSleep(RepeatUntilSuccess repeatUntilSuccessAnnotation)
null if there if no
RepeatUntilSuccess annotation.Copyright © 2019. All rights reserved.