org.gcube.common.mycontainer
Class MyContainerTestRunner
java.lang.Object
org.junit.runner.Runner
org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>
org.junit.runners.BlockJUnit4ClassRunner
org.gcube.common.mycontainer.MyContainerTestRunner
- All Implemented Interfaces:
- org.junit.runner.Describable, org.junit.runner.manipulation.Filterable, org.junit.runner.manipulation.Sortable
public class MyContainerTestRunner
- extends org.junit.runners.BlockJUnit4ClassRunner
A JUnit Runner for integration tests in MyContainer.
The runner offer transparencies over standard usese of MyContainer API in the JUnit framework, including:
- lifetime management: the runner will start and stop an instance of
the container on a per test suite basis. All methods annotated with
Test,
Before, BeforeClass, After, and AfterClass are guaranteed to
occurred within a running container
- deployment: the runner will deploy in the container instance any static
field of type
Gar which is annotated with Deployment
- container injection: the runner will inject the container into any static field
of type
MyContainer which is annotated with Inject
- port-type injection: the runner will inject the implementation of a portytpe of type
T into
any static field of type T which is annotated with Named and qualified with the name of the port-type
- endpoint reference injection: the runner will inject a reference to a service endpoint into
any static field of type
EndpointReferenceType which is annotated with Named and qualified with the name of
the corresponding port-type.
In addition, the runner will surround the logs of each test with their name, for increased readability
in test reports and during interactive testing.
Usage may be illustrated with the following example:
- Author:
- Fabio Simeoni
|
Method Summary |
protected void |
runChild(org.junit.runners.model.FrameworkMethod method,
org.junit.runner.notification.RunNotifier notifier)
|
protected org.junit.runners.model.Statement |
withAfterClasses(org.junit.runners.model.Statement statement)
|
protected org.junit.runners.model.Statement |
withBeforeClasses(org.junit.runners.model.Statement statement)
|
| Methods inherited from class org.junit.runners.BlockJUnit4ClassRunner |
collectInitializationErrors, computeTestMethods, createTest, describeChild, getChildren, methodBlock, methodInvoker, possiblyExpectingExceptions, testName, validateConstructor, validateInstanceMethods, validateOnlyOneConstructor, validateTestMethods, validateZeroArgConstructor, withAfters, withBefores, withPotentialTimeout |
| Methods inherited from class org.junit.runners.ParentRunner |
childrenInvoker, classBlock, filter, getDescription, getName, getTestClass, run, 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 |
MyContainerTestRunner
public MyContainerTestRunner(Class<?> klass)
throws org.junit.runners.model.InitializationError
- Creates an instance for a test class.
- Parameters:
klass - the test class
- Throws:
org.junit.runners.model.InitializationError - if the test class is not well formed
runChild
protected void runChild(org.junit.runners.model.FrameworkMethod method,
org.junit.runner.notification.RunNotifier notifier)
-
- Overrides:
runChild in class org.junit.runners.BlockJUnit4ClassRunner
withBeforeClasses
protected org.junit.runners.model.Statement withBeforeClasses(org.junit.runners.model.Statement statement)
-
- Overrides:
withBeforeClasses in class org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>
withAfterClasses
protected org.junit.runners.model.Statement withAfterClasses(org.junit.runners.model.Statement statement)
-
- Overrides:
withAfterClasses in class org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>
Copyright © 2012. All Rights Reserved.