I created some sample tests based on the sample integration tests in the
sling repository (at path sling\testing\samples\integration-tests), and I'm
currently trying to use a local Adobe CQ instance to run the tests.  The
first test run succeeds, but subsequent test runs without restarting the
container fail in various ways.  The most common errors are:

com.my.package.sling.junit.runners.ServerSideSampleTest >
initializationError FAILED
    java.lang.AssertionError: POST request to
http://localhost:4502/system/sling/junit/com.my.package.sling.junit.tests.json:
expecting status 200 expected:<200> but was:<500>

and

com.my.package.sling.junit.runners.ServerSideSampleTest >
initializationError FAILED
    java.lang.AssertionError: expected:<7> but was:<4>
        at org.junit.Assert.fail(Assert.java:88)
        at org.junit.Assert.failNotEquals(Assert.java:743)
        at org.junit.Assert.assertEquals(Assert.java:118)
        at org.junit.Assert.assertEquals(Assert.java:555)
        at org.junit.Assert.assertEquals(Assert.java:542)
        at
com.my.package.sling.junit.runners.ServerSideSampleTest.checkNumberOfTests(ServerSideSampleTest.java:45)

I also converted the Maven project to a Gradle project, and I was getting
weird test failures using the sling launchpad if I didn't have Gradle delete
the launchpad directory between test runs.

I noticed that the sling junit runner doesn't delete the bundles after the
tests run, and they're left in active state.  Could this have something to
do with it?



--
View this message in context: 
http://apache-sling.73963.n3.nabble.com/Subsequent-runs-of-the-same-tests-fail-if-OSGi-environment-not-restarted-tp4032920.html
Sent from the Sling - Users mailing list archive at Nabble.com.

Reply via email to