public class AlfrescoTestRunner
extends org.junit.runners.BlockJUnit4ClassRunner
This is a JUnit test runner that is designed to work with an Alfresco repository. It detects if it's executing a test inside of a running Alfresco instance. If that is the case the tests are all run normally. If however the test is being run from outside the repository, from the maven command line or from an IDE such as IntelliJ or STS/Eclipse for example, then instead of running the actual test an HTTP request is made to a Web Script in a running Alfresco instance. This Web Script runs the test and returns enough information to this class so we can emulate having run the test locally.
By doing this, we are able to create Integration Tests (IT) using standard JUnit capabilities. These can then be run from our IDEs with the associated visualizations, support for re-running failed tests, etc.
Integration testing framework donated by Zia Consulting| Modifier and Type | Field and Description |
|---|---|
static String |
FAILURE |
static String |
SUCCESS |
| Constructor and Description |
|---|
AlfrescoTestRunner(Class<?> klass) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
areWeRunningInAlfresco()
Check if we are running this test in an Alfresco server instance.
|
protected void |
callProxiedChild(org.junit.runners.model.FrameworkMethod method,
org.junit.runner.notification.RunNotifier notifier,
org.junit.runner.Description desc)
Call a remote Alfresco server and have the test run there.
|
protected String |
getContextRoot(org.junit.runners.model.FrameworkMethod method)
Check the @Remote config on the test class to see where the
Alfresco Repo is running.
|
protected static Object |
objectFromString(String string) |
protected void |
runChild(org.junit.runners.model.FrameworkMethod method,
org.junit.runner.notification.RunNotifier notifier) |
static String |
serializableToString(Serializable serializable) |
collectInitializationErrors, computeTestMethods, createTest, describeChild, getChildren, getTestRules, isIgnored, methodBlock, methodInvoker, possiblyExpectingExceptions, rules, testName, validateConstructor, validateFields, validateInstanceMethods, validateNoNonStaticInnerClass, validateOnlyOneConstructor, validateTestMethods, validateZeroArgConstructor, withAfters, withBefores, withPotentialTimeoutpublic static final String SUCCESS
public static final String FAILURE
public AlfrescoTestRunner(Class<?> klass) throws org.junit.runners.model.InitializationError
org.junit.runners.model.InitializationErrorpublic static String serializableToString(Serializable serializable) throws IOException
IOExceptionprotected void runChild(org.junit.runners.model.FrameworkMethod method,
org.junit.runner.notification.RunNotifier notifier)
runChild in class org.junit.runners.BlockJUnit4ClassRunnerprotected void callProxiedChild(org.junit.runners.model.FrameworkMethod method,
org.junit.runner.notification.RunNotifier notifier,
org.junit.runner.Description desc)
method - the test method to runnotifier - given @RunNotifier to notify the result of the testdesc - given @Description of the test to runprotected static Object objectFromString(String string) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionprotected boolean areWeRunningInAlfresco()
protected String getContextRoot(org.junit.runners.model.FrameworkMethod method)
method - given @FrameworkMethod to be executedCopyright © 2019. All rights reserved.