|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectorg.junit.runner.Runner
org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>
patterntesting.runtime.junit.SmokeRunner
public class SmokeRunner
This is the eXtended Runner for JUnit 4 which handles the SmokeTest and
other annotations. In previous (intermediate) version it was called
"XRunner". But because this may be a little bit confusing name it was
renamed to "SmokeRunner" for the final version.
It can be used together with the @RunWith annotation of JUnit 4.
| Constructor Summary | |
|---|---|
SmokeRunner(Class<?> klass)
Creates a SmokeRunner to run klass methods in parallel. |
|
| Method Summary | |
|---|---|
protected void |
addFailure(org.junit.runner.notification.RunNotifier notifier,
Throwable targetException,
org.junit.runner.Description description)
This method was inspired from an internal JUnit class (EachTestNotifier#addFailure(Throwable)). |
protected org.junit.runner.Description |
describeChild(org.junit.runners.model.FrameworkMethod child)
Create a Description of a single test named
name in the class clazz. |
protected static void |
fireTestAssumptionFailed(org.junit.runner.notification.RunNotifier notifier,
org.junit.runner.Description description,
Exception ex)
In JUnit 4.5 and newer we can use the fireTestAssumptionFailed(..) |
protected List<org.junit.runners.model.FrameworkMethod> |
getChildren()
Returns the methods that run tests. |
protected SmokeFilter |
getFilter()
The ParentRunner allows us no access to the filter. |
static List<org.junit.runners.model.FrameworkMethod> |
getJUnit3TestMethods(Class<?> testClass)
Here we look after public void methods with "test" as prefix and with no arguments. |
protected void |
logStatement(org.junit.runners.model.Statement stmt)
We will give a subclass (like e.g. |
protected org.junit.runners.model.Statement |
methodBlock(org.junit.runners.model.FrameworkMethod method)
Creates a RunStatement for the given test method. |
protected void |
runChild(org.junit.runners.model.FrameworkMethod method,
org.junit.runner.notification.RunNotifier notifier)
Runs the test corresponding to child, which can be assumed to be
an element of the list returned by ParentRunner.getChildren(). |
protected boolean |
shouldBeIgnored(org.junit.runners.model.FrameworkMethod method)
Here we handle annotations like @Ignore where the execution of
the test method should be ignored. |
protected boolean |
shouldBeRun(org.junit.runners.model.FrameworkMethod method)
Should be run. |
protected org.junit.runners.model.Statement |
withAfterClasses(org.junit.runners.model.Statement statement)
Checks the annotation of the method marked as "@AfterClass" and add (or filters out) the afterClass method (needed to solve. |
protected org.junit.runners.model.Statement |
withBeforeClasses(org.junit.runners.model.Statement statement)
Checks the annotation of the method marked as "@BeforeClass" and add (or filters out) the beforeClass method (needed to solve. |
| Methods inherited from class org.junit.runners.ParentRunner |
|---|
childrenInvoker, classBlock, classRules, collectInitializationErrors, filter, getDescription, getName, getRunnerAnnotations, getTestClass, run, runLeaf, setScheduler, sort, validatePublicVoidNoArgMethods |
| Methods inherited from class org.junit.runner.Runner |
|---|
testCount |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SmokeRunner(Class<?> klass)
throws org.junit.runners.model.InitializationError
klass - the test class to run
org.junit.runners.model.InitializationError - if the test class is malformed| Method Detail |
|---|
protected final SmokeFilter getFilter()
protected List<org.junit.runners.model.FrameworkMethod> getChildren()
@Test on this
class and superclasses that are not overridden.
getChildren in class org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>protected org.junit.runner.Description describeChild(org.junit.runners.model.FrameworkMethod child)
Description of a single test named
name in the class clazz. Generally, this will
be a leaf Description. (see also
BlockJUnit4ClassRunner)
describeChild in class org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>child - the name of the test (a method name for test annotated with
Test)
ParentRunner.describeChild(java.lang.Object)protected org.junit.runners.model.Statement withBeforeClasses(org.junit.runners.model.Statement statement)
withBeforeClasses in class org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>statement - the statement(s) before
ParentRunner.withBeforeClasses(org.junit.runners.model.Statement)protected org.junit.runners.model.Statement withAfterClasses(org.junit.runners.model.Statement statement)
withAfterClasses in class org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>statement - the statement(s) before
ParentRunner.withAfterClasses(org.junit.runners.model.Statement)
protected void runChild(org.junit.runners.model.FrameworkMethod method,
org.junit.runner.notification.RunNotifier notifier)
child, which can be assumed to be
an element of the list returned by ParentRunner.getChildren().
Subclasses are responsible for making sure that relevant test events are
reported through notifier
runChild in class org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>method - the methodnotifier - the notifier
protected static void fireTestAssumptionFailed(org.junit.runner.notification.RunNotifier notifier,
org.junit.runner.Description description,
Exception ex)
RunNotifier class. But JUnit 4.4 does not provide this
method.
RunNotifier.fireTestFailure(Failure)
method - but this does not work for JUnit 4.5 (some internal JUnit tests
will fail if you try that).
We could compile with JUnit 4.5, run the tests with JUnit 4.4 and see
what will happen. Perhaps we can catch the exception and call the
RunNotifier.fireTestFailure(Failure) method.
We could also give up because the architecture of JUnit has changed too
much between 4.4 and 4.5 - this is, what we do now.
notifier - the notifierdescription - the descriptionex - the exprotected void logStatement(org.junit.runners.model.Statement stmt)
stmt - the stmt to be loggedprotected final boolean shouldBeIgnored(org.junit.runners.model.FrameworkMethod method)
@Ignore where the execution of
the test method should be ignored.
method - the test method
protected final boolean shouldBeRun(org.junit.runners.model.FrameworkMethod method)
method - the method
protected final void addFailure(org.junit.runner.notification.RunNotifier notifier,
Throwable targetException,
org.junit.runner.Description description)
notifier - the notifiertargetException - the target exceptiondescription - the descriptionprotected org.junit.runners.model.Statement methodBlock(org.junit.runners.model.FrameworkMethod method)
method - the test method
public static List<org.junit.runners.model.FrameworkMethod> getJUnit3TestMethods(Class<?> testClass)
testClass - the test class
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||