Alfresco / alfresco-sdk

The Alfresco In-Process SDK is based on Apache Maven, includes support for rapid and standard development, testing, packaging, versioning and release of your Alfresco integration and extension projects
Apache License 2.0
186 stars 113 forks source link

Cannot execute tests declared in abstract classes #495

Closed tartard closed 5 years ago

tartard commented 6 years ago

I'm submitting a ... (check one with "x")

[x ] bug report => search github for a similar issue or PR before submitting
[ ] feature request

Assume we have a test Class B which extends an abstract class A. A has a test method methodA.

Expected Behavior

When running test B#methodA using the AlfrescoTestRunner, the runner should instantiate the class being executed, i.e B.

Current Behavior

The remote AlfrescoTestRunner tries to instantiate the class A instead of B. Since A is abstract, an InstantiationException is thrown \:

RunTestWebScript: Start executing ... RunTestWebScript: clazzAndMethod = me.tartard.alfresco.demo.PR491.AbstractIT#test RunTestWebScript: [clazz=me.tartard.alfresco.demo.PR491.AbstractIT][method=test] RunTestWebScript: model = {result=FAILURE, throwables=[rO0ABXNyACBqYXZhLmxhbmcuSW5zdGFudGlhdGlvbkV4Y2VwdGlvborYPidN1YWKAgAAeHIAJmphdmE ...], failures=[test(me.tartard.alfresco.demo.PR491.AbstractIT): null], test=me.tartard.alfresco.demo.PR491.AbstractIT#test#test, ignoreCount=0, wasSuccessful=false, runTime=32, runCount=1, resultObject=org.junit.runner .Result@7ae67e6c, failureCount=1} RunTestWebScript: Stopped executing Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.104 sec <<< FAILURE! - in me.tartard.alfresco.demo.PR491.ChildIT test(me.tartard.alfresco.demo.PR491.ChildIT) Time elapsed: 0.424 sec <<< ERROR! java.lang.InstantiationException

Results :

Tests in error: ChildIT.test » Instantiation

Possible Solution

Merge Pull Request #491

Steps to Reproduce (for bugs)

  1. Run :
    $ git clone https://github.com/Alfresco/alfresco-sdk.git
    $ cd alfresco-sdk/modules/alfresco-rad
    $ mvn clean install -DskipTests
  2. Run :
    $ git clone https://github.com/tartard/test-sdk3.git
    $ cd test-sdk3
    $ mvn clean verify -Dit.test=ChildIT

Context

We are currently migrating our projects from SDK 2.1.1 to SDK 3.0.1 to prepare an Alfresco migration from v5.0.1 to v5.2. In our projects we have a lot of integration tests and are trying to make them pass using the AlfrescoTestRunner.

Your Environment

Additional information

ohej commented 5 years ago

We've merged #491, thanks for the contribution. This will be included in SDK 3.1