Class RandomizedRunner
- java.lang.Object
-
- org.junit.runner.Runner
-
- com.carrotsearch.randomizedtesting.RandomizedRunner
-
- All Implemented Interfaces:
org.junit.runner.Describable,org.junit.runner.manipulation.Filterable
public final class RandomizedRunner extends org.junit.runner.Runner implements org.junit.runner.manipulation.FilterableARunnerimplementation for running randomized test cases with predictable and repeatable randomness.Supports the following JUnit4 features:
BeforeClass-annotated methods (before all tests of a class/superclass),Before-annotated methods (before each test),Test-annotated methods,After-annotated methods (after each test),AfterClass-annotated methods (after all tests of a class/superclass),Rule-annotated fields implementingMethodRuleandTestRule.
Contracts:
BeforeClass,Beforemethods declared in superclasses are called before methods declared in subclasses,AfterClass,Aftermethods declared in superclasses are called after methods declared in subclasses,BeforeClass,Before,AfterClass,Aftermethods declared within the same class are called in randomized order derived from the master seed (repeatable with the same seed),
Deviations from "standard" JUnit:
- test methods are allowed to return values (the return value is ignored),
- hook methods need not be public; in fact, it is encouraged to make them private to avoid accidental shadowing which silently drops parent hooks from executing (applies to class hooks mostly, but also to instance hooks).
- all exceptions raised during hooks or test case execution are reported to the notifier, there is no suppression or chaining of exceptions,
- a test method must not leave behind any active threads; this is detected
using
ThreadGroupactive counts and is sometimes problematic (many classes in the standard library leave active threads behind without waiting for them to terminate). One can use theThreadLeakScope,ThreadLeakActionand other annotations to control how aggressive the detection strategy is and if it fails the test or not. - uncaught exceptions from any of children threads will cause the test to fail.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classRandomizedRunner.NewInstanceProvider(package private) static classRandomizedRunner.QueueUncaughtExceptionsHandlerQueue uncaught exceptions.private static classRandomizedRunner.SameInstanceProvider(package private) classRandomizedRunner.TestCandidateTest candidate (model).private static classRandomizedRunner.TestMethodExecutionHelper tuple (Method, instance params).(package private) static classRandomizedRunner.UncaughtException
-
Field Summary
Fields Modifier and Type Field Description private booleanappendSeedParameterstatic java.lang.StringAUGMENTED_SEED_PACKAGEFake package of a stack trace entry inserted into exceptions thrown by test methods.private java.util.List<org.junit.runner.notification.RunListener>autoListenersprivate ClassModelclassModelClass model.private RunnerContainercontainerRunnerThe container we're running in.static intDEFAULT_ITERATIONSThe default number of test repeat iterations.static intDEFAULT_KILLATTEMPTSThe default number of first interrupts, then Thread.stop attempts.static intDEFAULT_KILLWAITTime in between interrupt retries or stop retries.private static java.util.List<java.lang.String>DEFAULT_STACK_FILTERSstatic intDEFAULT_TIMEOUTDefault timeout for a single test case.static intDEFAULT_TIMEOUT_SUITEDefault timeout for an entire suite.GroupEvaluatorgroupEvaluator(package private) RandomizedRunner.QueueUncaughtExceptionsHandlerhandlerThread.UncaughtExceptionHandlerfor capturing uncaught exceptions from the test group and globally.private java.lang.IntegeriterationsOverrideThe number of each test's randomized iterations.(package private) static java.util.logging.LoggerloggerPackage scope logger.(package private) static java.lang.ThreadGroupmainThreadGroupThe "main" thread group we will be tracking (including subgroups).private RandomSupplierrandomSupplierRandom class implementation supplier.private java.util.Map<java.lang.String,java.lang.String>restoreProperties(package private) RandomnessrunnerRandomnessThe runner's seed (master).(package private) RunnerThreadGrouprunnerThreadGroupAll tests are executed under a specified thread group so that we can have some control over how many threads have been started/ stopped.private static java.util.concurrent.atomic.AtomicLongsequencerA sequencer for affecting the initial seed in case of rapid succession of this class instance creations.private java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.util.List<java.lang.reflect.Method>>shuffledMethodsCacheMethods cache.private java.lang.Class<?>suiteClassThe class with test methods (suite).private org.junit.runner.DescriptionsuiteDescriptionClass suite description.private java.util.List<RandomizedRunner.TestCandidate>testCandidatesAll test candidates, processed (seeds assigned) and flattened.private RandomnesstestCaseRandomnessOverrideIf#SYSPROP_RANDOM_SEEDproperty is used with two arguments (master:method) then this field contains method-level override.private TraceFormattingtracesStack trace filtering/ dumping.(package private) static java.util.concurrent.atomic.AtomicBooleanzombieMarkerA marker for flagging zombie threads (leaked threads that couldn't be killed).
-
Constructor Summary
Constructors Constructor Description RandomizedRunner(java.lang.Class<?> testClass)Creates a new runner for the given class.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.util.List<RandomizedRunner.TestCandidate>applyFilters(java.lang.Class<?> suiteClass, java.util.List<RandomizedRunner.TestCandidate> testCandidates, java.util.Collection<org.junit.runner.manipulation.Filter> testFilters)(package private) static <T extends java.lang.Throwable>
TaugmentStackTrace(T e, Randomness... seeds)Augment stack trace of the given exception with seed infos.private java.util.List<RandomizedRunner.TestCandidate>collectCandidatesForMethod(java.util.Map<java.lang.String,java.lang.Integer> descriptionRepetitions, java.lang.reflect.Constructor<?> constructor, RandomizedRunner.TestMethodExecution testCase)Collect test candidates for a single method and the given seed.java.util.List<RandomizedRunner.TestMethodExecution>collectMethodExecutions(java.lang.reflect.Constructor<?> constructor, java.util.List<java.lang.reflect.Method> testMethods)Collect test method executions from list of test methods and potentially parameters from parameter factory methods.private java.util.List<RandomizedRunner.TestCandidate>collectTestCandidates(org.junit.runner.Description classDescription)Collect all test candidates, regardless if they will be executed or not.private RandomizedContextcreateContext(java.lang.ThreadGroup tg)Create randomized context for the run.private static java.lang.StringcreateDefaultArgumentFormatting(java.lang.reflect.Constructor<?> constructor)Default formatting string for constructor arguments.private static RunnerContainerdetectContainer()Attempt to detect the container we're running under.private java.util.Map<RandomizedRunner.TestCandidate,java.lang.Boolean>determineIgnoredTests(java.util.List<RandomizedRunner.TestCandidate> tests)Determine the set of ignored tests.private intdetermineMethodIterationCount(java.lang.reflect.Method method)private long[]determineMethodSeeds(java.lang.reflect.Method method)Determine a given method's initial random seed.private RandomSupplierdetermineRandomSupplier(java.lang.Class<?> testClass)(package private) static java.lang.StringemptyToNull(java.lang.String value)Normalize empty strings to nulls.voidfilter(org.junit.runner.manipulation.Filter filter)ImplementFilterablebecause GUIs depend on it to run tests selectively.private voidfireTestFailure(org.junit.runner.notification.RunNotifier notifier, org.junit.runner.Description description, java.lang.Throwable t)private <T> java.util.List<T>getAnnotatedFieldValues(java.lang.Object test, java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass, java.lang.Class<T> valueClass)private static <T extends java.lang.annotation.Annotation>
java.util.List<T>getAnnotationsFromClassHierarchy(java.lang.Class<?> clazz, java.lang.Class<T> annotation)Collect all annotations from a clazz hierarchy.org.junit.runner.DescriptiongetDescription()Return the current tree of test descriptions (filtered).private InstanceProvidergetInstanceProvider(java.lang.reflect.Constructor<?> constructor, java.lang.Object[] args)Determine instance provider.private java.util.List<java.lang.reflect.Method>getShuffledMethods(java.lang.Class<? extends java.lang.annotation.Annotation> ann)Construct a list of ordered framework methods.TraceFormattinggetTraceFormatting()Stack trace formatting utilities.private booleanhasIgnoreAnnotation(RandomizedRunner.TestCandidate c)Returns true if we should ignore this test candidate.static booleanhasZombieThreads()Returns true if any previous (or current) suite marked withThreadLeakZombies.Consequence.IGNORE_REMAINING_TESTShas left zombie threads.(package private) voidinvoke(java.lang.reflect.Method m, java.lang.Object instance, java.lang.Object... args)Invoke a given method on a suiteClass instance (can be null for static methods).private booleanisConstantSeedForAllIterations(java.lang.reflect.Method method)Determine if a given method's iterations should run with a fixed seed or not.private booleanisTestFiltered(GroupEvaluator ev, RandomizedRunner.TestCandidate c)static java.lang.StringmethodName(org.junit.runner.Description description)Attempts to extract just the method name from parameterized notation.private voidprocessSystemProperties()private static voidprune(org.junit.runner.Description suite, java.util.Set<org.junit.runner.Description> permitted)(package private) voidreportAsIgnored(org.junit.runner.notification.RunNotifier notifier, GroupEvaluator ge, RandomizedRunner.TestCandidate c)private voidrestoreSystemProperties()voidrun(org.junit.runner.notification.RunNotifier notifier)Runs all tests and hooks.(package private) voidrunSingleTest(org.junit.runner.notification.RunNotifier notifier, RandomizedRunner.TestCandidate c, ThreadLeakControl threadLeakControl)Runs a single test in the "master" test thread.private voidrunSuite(RandomizedContext context, org.junit.runner.notification.RunNotifier notifier)Test execution logic for the entire suite, executing under designatedRunnerThreadGroup.private voidrunSuite(org.junit.runner.notification.RunNotifier notifier)Test execution logic for the entire suite.private org.junit.runners.model.StatementrunTestsStatement(org.junit.runner.notification.RunNotifier notifier, java.util.List<RandomizedRunner.TestCandidate> tests, java.util.Map<RandomizedRunner.TestCandidate,java.lang.Boolean> ignored, ThreadLeakControl threadLeakControl)private long[]seedFromAnnot(java.lang.reflect.AnnotatedElement element, long randomSeed)Get an annotated element'sSeedannotation and determine if it's fixed or not.static java.lang.StringseedFromThrowable(java.lang.Throwable t)RandomizedRunneraugments stack traces of test methods that ended in an exception and inserts a fake entry starting withAUGMENTED_SEED_PACKAGE.private voidsubscribeListeners(org.junit.runner.notification.RunNotifier notifier)Subscribe annotation listeners to the notifier.private voidunsubscribeListeners(org.junit.runner.notification.RunNotifier notifier)Unsubscribe listeners.private voidvalidateTarget()Validate methods and hooks in the suiteClass.private voidvalidateTestMethods(java.util.List<java.lang.reflect.Method> testMethods)Perform additional checks on methods returned from the providers.private org.junit.runners.model.StatementwithClassAfters(org.junit.runners.model.Statement s)private org.junit.runners.model.StatementwithClassBefores(org.junit.runners.model.Statement s)Decorate aStatementwithBeforeClasshooks.private org.junit.runners.model.StatementwithClassRules(org.junit.runners.model.Statement s)Wrap withClassRules.private static org.junit.runners.model.StatementwithCloseContextResources(org.junit.runners.model.Statement s, LifecycleScope scope)Wrap with a rule to close context resources.private org.junit.runners.model.StatementwrapBeforeAndAfters(org.junit.runners.model.Statement s, RandomizedRunner.TestCandidate c, java.lang.Object instance)Wrap before and after hooks.private org.junit.runners.model.StatementwrapExpectedExceptions(org.junit.runners.model.Statement s, RandomizedRunner.TestCandidate c)Wrap the given statement into another catching the expected exception, if declared.private org.junit.runners.model.StatementwrapMethodRules(org.junit.runners.model.Statement s, RandomizedRunner.TestCandidate c, java.lang.Object instance)Wrap the given statement in any declared MethodRules (old style rules).private static intzeroForNull(java.lang.Integer v)Replace null with zero.
-
-
-
Field Detail
-
AUGMENTED_SEED_PACKAGE
public static final java.lang.String AUGMENTED_SEED_PACKAGE
Fake package of a stack trace entry inserted into exceptions thrown by test methods. These stack entries contain additional information about seeds used during execution.- See Also:
- Constant Field Values
-
DEFAULT_TIMEOUT
public static final int DEFAULT_TIMEOUT
Default timeout for a single test case. By default the timeout is disabled. Use global system propertySysGlobals.SYSPROP_TIMEOUTor an annotationTimeoutif you need to set timeouts or expect some test cases may hang. This will slightly slow down the tests because each test case is executed in a forked thread.
-
DEFAULT_TIMEOUT_SUITE
public static final int DEFAULT_TIMEOUT_SUITE
Default timeout for an entire suite. By default the timeout is disabled. Use the global system propertySysGlobals.SYSPROP_TIMEOUT_SUITEor an annotationTimeoutSuiteif you need to set timeouts or expect some tests (hooks) may hang.
-
DEFAULT_KILLATTEMPTS
public static final int DEFAULT_KILLATTEMPTS
The default number of first interrupts, then Thread.stop attempts.- See Also:
- Constant Field Values
-
DEFAULT_KILLWAIT
public static final int DEFAULT_KILLWAIT
Time in between interrupt retries or stop retries.- See Also:
- Constant Field Values
-
DEFAULT_ITERATIONS
public static final int DEFAULT_ITERATIONS
The default number of test repeat iterations.- See Also:
- Constant Field Values
-
logger
static final java.util.logging.Logger logger
Package scope logger.
-
sequencer
private static final java.util.concurrent.atomic.AtomicLong sequencer
A sequencer for affecting the initial seed in case of rapid succession of this class instance creations. Not likely, but can happen two could get the same seed.
-
DEFAULT_STACK_FILTERS
private static final java.util.List<java.lang.String> DEFAULT_STACK_FILTERS
-
suiteClass
private final java.lang.Class<?> suiteClass
The class with test methods (suite).
-
runnerRandomness
final Randomness runnerRandomness
The runner's seed (master).
-
testCaseRandomnessOverride
private Randomness testCaseRandomnessOverride
If#SYSPROP_RANDOM_SEEDproperty is used with two arguments (master:method) then this field contains method-level override.
-
iterationsOverride
private final java.lang.Integer iterationsOverride
The number of each test's randomized iterations.- See Also:
#SYSPROP_ITERATIONS
-
testCandidates
private java.util.List<RandomizedRunner.TestCandidate> testCandidates
All test candidates, processed (seeds assigned) and flattened.
-
suiteDescription
private org.junit.runner.Description suiteDescription
Class suite description.
-
runnerThreadGroup
RunnerThreadGroup runnerThreadGroup
All tests are executed under a specified thread group so that we can have some control over how many threads have been started/ stopped. System daemons shouldn't be under this group.
-
autoListeners
private final java.util.List<org.junit.runner.notification.RunListener> autoListeners
- See Also:
subscribeListeners(RunNotifier)
-
appendSeedParameter
private boolean appendSeedParameter
- See Also:
#SYSPROP_APPEND_SEED
-
traces
private final TraceFormatting traces
Stack trace filtering/ dumping.
-
containerRunner
private RunnerContainer containerRunner
The container we're running in.
-
handler
RandomizedRunner.QueueUncaughtExceptionsHandler handler
Thread.UncaughtExceptionHandlerfor capturing uncaught exceptions from the test group and globally.
-
classModel
private ClassModel classModel
Class model.
-
randomSupplier
private final RandomSupplier randomSupplier
Random class implementation supplier.
-
shuffledMethodsCache
private java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.util.List<java.lang.reflect.Method>> shuffledMethodsCache
Methods cache.
-
zombieMarker
static java.util.concurrent.atomic.AtomicBoolean zombieMarker
A marker for flagging zombie threads (leaked threads that couldn't be killed).
-
mainThreadGroup
static final java.lang.ThreadGroup mainThreadGroup
The "main" thread group we will be tracking (including subgroups).
-
restoreProperties
private final java.util.Map<java.lang.String,java.lang.String> restoreProperties
-
groupEvaluator
public GroupEvaluator groupEvaluator
-
-
Method Detail
-
determineRandomSupplier
private RandomSupplier determineRandomSupplier(java.lang.Class<?> testClass)
-
detectContainer
private static RunnerContainer detectContainer()
Attempt to detect the container we're running under.
-
getDescription
public org.junit.runner.Description getDescription()
Return the current tree of test descriptions (filtered).- Specified by:
getDescriptionin interfaceorg.junit.runner.Describable- Specified by:
getDescriptionin classorg.junit.runner.Runner
-
filter
public void filter(org.junit.runner.manipulation.Filter filter) throws org.junit.runner.manipulation.NoTestsRemainExceptionImplementFilterablebecause GUIs depend on it to run tests selectively.- Specified by:
filterin interfaceorg.junit.runner.manipulation.Filterable- Throws:
org.junit.runner.manipulation.NoTestsRemainException
-
prune
private static void prune(org.junit.runner.Description suite, java.util.Set<org.junit.runner.Description> permitted)
-
run
public void run(org.junit.runner.notification.RunNotifier notifier)
Runs all tests and hooks.- Specified by:
runin classorg.junit.runner.Runner
-
restoreSystemProperties
private void restoreSystemProperties()
-
processSystemProperties
private void processSystemProperties()
-
runSuite
private void runSuite(org.junit.runner.notification.RunNotifier notifier)
Test execution logic for the entire suite.
-
runSuite
private void runSuite(RandomizedContext context, org.junit.runner.notification.RunNotifier notifier)
Test execution logic for the entire suite, executing under designatedRunnerThreadGroup.
-
determineIgnoredTests
private java.util.Map<RandomizedRunner.TestCandidate,java.lang.Boolean> determineIgnoredTests(java.util.List<RandomizedRunner.TestCandidate> tests)
Determine the set of ignored tests.
-
withCloseContextResources
private static org.junit.runners.model.Statement withCloseContextResources(org.junit.runners.model.Statement s, LifecycleScope scope)Wrap with a rule to close context resources.
-
runTestsStatement
private org.junit.runners.model.Statement runTestsStatement(org.junit.runner.notification.RunNotifier notifier, java.util.List<RandomizedRunner.TestCandidate> tests, java.util.Map<RandomizedRunner.TestCandidate,java.lang.Boolean> ignored, ThreadLeakControl threadLeakControl)
-
reportAsIgnored
void reportAsIgnored(org.junit.runner.notification.RunNotifier notifier, GroupEvaluator ge, RandomizedRunner.TestCandidate c)
-
fireTestFailure
private void fireTestFailure(org.junit.runner.notification.RunNotifier notifier, org.junit.runner.Description description, java.lang.Throwable t)
-
withClassBefores
private org.junit.runners.model.Statement withClassBefores(org.junit.runners.model.Statement s)
Decorate aStatementwithBeforeClasshooks.
-
withClassAfters
private org.junit.runners.model.Statement withClassAfters(org.junit.runners.model.Statement s)
-
withClassRules
private org.junit.runners.model.Statement withClassRules(org.junit.runners.model.Statement s)
Wrap withClassRules.
-
runSingleTest
void runSingleTest(org.junit.runner.notification.RunNotifier notifier, RandomizedRunner.TestCandidate c, ThreadLeakControl threadLeakControl)Runs a single test in the "master" test thread.
-
wrapBeforeAndAfters
private org.junit.runners.model.Statement wrapBeforeAndAfters(org.junit.runners.model.Statement s, RandomizedRunner.TestCandidate c, java.lang.Object instance)Wrap before and after hooks.
-
wrapExpectedExceptions
private org.junit.runners.model.Statement wrapExpectedExceptions(org.junit.runners.model.Statement s, RandomizedRunner.TestCandidate c)Wrap the given statement into another catching the expected exception, if declared.
-
wrapMethodRules
private org.junit.runners.model.Statement wrapMethodRules(org.junit.runners.model.Statement s, RandomizedRunner.TestCandidate c, java.lang.Object instance)Wrap the given statement in any declared MethodRules (old style rules).
-
getAnnotatedFieldValues
private <T> java.util.List<T> getAnnotatedFieldValues(java.lang.Object test, java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass, java.lang.Class<T> valueClass)
-
createContext
private RandomizedContext createContext(java.lang.ThreadGroup tg)
Create randomized context for the run. The context is shared by all threads in a given thread group (but the source ofRandomnessis assigned per-thread).
-
subscribeListeners
private void subscribeListeners(org.junit.runner.notification.RunNotifier notifier)
Subscribe annotation listeners to the notifier.
-
unsubscribeListeners
private void unsubscribeListeners(org.junit.runner.notification.RunNotifier notifier)
Unsubscribe listeners.
-
applyFilters
private static java.util.List<RandomizedRunner.TestCandidate> applyFilters(java.lang.Class<?> suiteClass, java.util.List<RandomizedRunner.TestCandidate> testCandidates, java.util.Collection<org.junit.runner.manipulation.Filter> testFilters)
-
emptyToNull
static java.lang.String emptyToNull(java.lang.String value)
Normalize empty strings to nulls.
-
hasIgnoreAnnotation
private boolean hasIgnoreAnnotation(RandomizedRunner.TestCandidate c)
Returns true if we should ignore this test candidate.
-
isTestFiltered
private boolean isTestFiltered(GroupEvaluator ev, RandomizedRunner.TestCandidate c)
-
getShuffledMethods
private java.util.List<java.lang.reflect.Method> getShuffledMethods(java.lang.Class<? extends java.lang.annotation.Annotation> ann)
Construct a list of ordered framework methods. Minor tweaks are done depending on the annotation (reversing order, etc.).
-
collectTestCandidates
private java.util.List<RandomizedRunner.TestCandidate> collectTestCandidates(org.junit.runner.Description classDescription)
Collect all test candidates, regardless if they will be executed or not. At this point individual test methods are also expanded into multiple executions corresponding to the number of iterations (#SYSPROP_ITERATIONS) and the initial method seed is preassigned.The order of test candidates is shuffled based on the runner's random.
- See Also:
Rants.RANT_1
-
collectCandidatesForMethod
private java.util.List<RandomizedRunner.TestCandidate> collectCandidatesForMethod(java.util.Map<java.lang.String,java.lang.Integer> descriptionRepetitions, java.lang.reflect.Constructor<?> constructor, RandomizedRunner.TestMethodExecution testCase)
Collect test candidates for a single method and the given seed.
-
zeroForNull
private static int zeroForNull(java.lang.Integer v)
Replace null with zero.
-
collectMethodExecutions
public java.util.List<RandomizedRunner.TestMethodExecution> collectMethodExecutions(java.lang.reflect.Constructor<?> constructor, java.util.List<java.lang.reflect.Method> testMethods)
Collect test method executions from list of test methods and potentially parameters from parameter factory methods.
-
getInstanceProvider
private InstanceProvider getInstanceProvider(java.lang.reflect.Constructor<?> constructor, java.lang.Object[] args)
Determine instance provider.
-
createDefaultArgumentFormatting
private static java.lang.String createDefaultArgumentFormatting(java.lang.reflect.Constructor<?> constructor)
Default formatting string for constructor arguments.
-
isConstantSeedForAllIterations
private boolean isConstantSeedForAllIterations(java.lang.reflect.Method method)
Determine if a given method's iterations should run with a fixed seed or not.
-
determineMethodIterationCount
private int determineMethodIterationCount(java.lang.reflect.Method method)
-
determineMethodSeeds
private long[] determineMethodSeeds(java.lang.reflect.Method method)
Determine a given method's initial random seed.
-
invoke
void invoke(java.lang.reflect.Method m, java.lang.Object instance, java.lang.Object... args) throws java.lang.ThrowableInvoke a given method on a suiteClass instance (can be null for static methods).- Throws:
java.lang.Throwable
-
validateTestMethods
private void validateTestMethods(java.util.List<java.lang.reflect.Method> testMethods)
Perform additional checks on methods returned from the providers.
-
validateTarget
private void validateTarget()
Validate methods and hooks in the suiteClass. Follows "standard" JUnit rules, with some exceptions on return values and more rigorous checking of shadowed methods and fields.
-
augmentStackTrace
static <T extends java.lang.Throwable> T augmentStackTrace(T e, Randomness... seeds)Augment stack trace of the given exception with seed infos.
-
getAnnotationsFromClassHierarchy
private static <T extends java.lang.annotation.Annotation> java.util.List<T> getAnnotationsFromClassHierarchy(java.lang.Class<?> clazz, java.lang.Class<T> annotation)Collect all annotations from a clazz hierarchy. Superclass's annotations come first.Inheritedannotations are removed (hopefully, the spec. isn't clear on this whether the same object is returned or not for inherited annotations).
-
seedFromAnnot
private long[] seedFromAnnot(java.lang.reflect.AnnotatedElement element, long randomSeed)Get an annotated element'sSeedannotation and determine if it's fixed or not. If it is fixed, return the seeds. Otherwise returnrandomSeed.
-
getTraceFormatting
public TraceFormatting getTraceFormatting()
Stack trace formatting utilities. These may be initialized to filter out certain packages.
-
seedFromThrowable
public static java.lang.String seedFromThrowable(java.lang.Throwable t)
RandomizedRunneraugments stack traces of test methods that ended in an exception and inserts a fake entry starting withAUGMENTED_SEED_PACKAGE.- Returns:
- A string is returned with seeds combined, if any. Null is returned if no augmentation can be found.
-
methodName
public static java.lang.String methodName(org.junit.runner.Description description)
Attempts to extract just the method name from parameterized notation.
-
hasZombieThreads
public static boolean hasZombieThreads()
Returns true if any previous (or current) suite marked withThreadLeakZombies.Consequence.IGNORE_REMAINING_TESTShas left zombie threads.
-
-