Class AlfrescoTestRunner
- All Implemented Interfaces:
org.junit.runner.Describable,org.junit.runner.manipulation.Filterable,org.junit.runner.manipulation.Orderable,org.junit.runner.manipulation.Sortable
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- Since:
- 3.0
- Author:
- Bindu Wavell (bindu@ziaconsulting.com), martin.bergljung@alfresco.com (some editing)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanCheck if we are running this test in an Alfresco server instance.protected voidcallProxiedChild(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 StringgetContextRoot(org.junit.runners.model.FrameworkMethod method) Check the @Remote config on the test class to see where the Alfresco Repo is running.protected static ObjectobjectFromString(String string) protected voidrunChild(org.junit.runners.model.FrameworkMethod method, org.junit.runner.notification.RunNotifier notifier) static StringserializableToString(Serializable serializable) Methods inherited from class org.junit.runners.BlockJUnit4ClassRunner
collectInitializationErrors, computeTestMethods, createTest, createTest, describeChild, getChildren, getTestRules, isIgnored, methodBlock, methodInvoker, possiblyExpectingExceptions, rules, testName, validateConstructor, validateFields, validateInstanceMethods, validateNoNonStaticInnerClass, validateOnlyOneConstructor, validateTestMethods, validateZeroArgConstructor, withAfters, withBefores, withPotentialTimeoutMethods inherited from class org.junit.runners.ParentRunner
childrenInvoker, classBlock, classRules, createTestClass, filter, getDescription, getName, getRunnerAnnotations, getTestClass, order, run, runLeaf, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses, withInterruptIsolationMethods inherited from class org.junit.runner.Runner
testCount
-
Field Details
-
SUCCESS
- See Also:
-
FAILURE
- See Also:
-
-
Constructor Details
-
AlfrescoTestRunner
- Throws:
org.junit.runners.model.InitializationError
-
-
Method Details
-
serializableToString
- Throws:
IOException
-
runChild
protected void runChild(org.junit.runners.model.FrameworkMethod method, org.junit.runner.notification.RunNotifier notifier) - Overrides:
runChildin classorg.junit.runners.BlockJUnit4ClassRunner
-
callProxiedChild
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.- Parameters:
method- the test method to runnotifier- given @RunNotifierto notify the result of the testdesc- given @Descriptionof the test to run
-
objectFromString
- Throws:
IOExceptionClassNotFoundException
-
areWeRunningInAlfresco
protected boolean areWeRunningInAlfresco()Check if we are running this test in an Alfresco server instance.- Returns:
- true if we are running in an Alfresco server
-
getContextRoot
Check the @Remote config on the test class to see where the Alfresco Repo is running. If it is not present, check the ACS_ENDPOINT_PROP system property as an alternative location. If none of them has a value, then return the default location.- Parameters:
method- given @FrameworkMethodto be executed- Returns:
- the ACS endpoint
-