Stefan Egli created SLING-3760:
----------------------------------
Summary: Improvements for rerunning serverside tests
Key: SLING-3760
URL: https://issues.apache.org/jira/browse/SLING-3760
Project: Sling
Issue Type: Bug
Components: Testing
Reporter: Stefan Egli
Assignee: Stefan Egli
As reported to the users@felix list at [0] there is an issue with the sling
serverside testing. Namely, when running a serverside test against an existing
server (be it sling launchpad or CQ) it works fine the first time, but any
subsequent run fails with "No runnable methods" due to the fact that the
junit-4.8.2.jar which is embedded in org.apache.sling.junit.core causes
classloading problems: when the tests are run the second time, the
sling.junit.core bundle is (re)installed via webconsoleclient.installBundle -
which does a POST to the /system/console/bundles with action=install. This
seems to cause the effects reported at [0] which are that
Class.forName("org.junit.runner.RunWith", false, newBundleClassLoader) returns
a class of which the classloader is the oldBundleClassLoader - and that in turn
causes the getAnnotation() lookup to fail - and that causes "No runnable
methods" to be reported.
Long story short: it looks like repeatedly doing POST /system/console/bundles
(action=install) leaves garbage around.
Thus - besides analyzing this on the felix level - the quicker, suggested fix
is to improve sling.testing.tools with the ability to:
* check if a bundle (that is part of the 'sling.additional.bundle' test
configuration) is already installed - if so, then skip it
* skip above skip if the bundle in question is a SNAPSHOT one - to support
developement - ie the actual test bundle, which is typically of SNAPSHOT
version, should be repeatedly deployed
* upon reinstalling, first do a proper uninstall, then an install
With these changes, I got my setup working. So I suggest to include this fix.
I'm attaching a patch with the changes for review first though.
[0] - http://markmail.org/thread/mwockachypg7liwu
--
This message was sent by Atlassian JIRA
(v6.2#6252)