Good day,
After performing unit tests on the classes, I need to write some integration tests that pull data from a test database and then make sure that the code is working.
I have tried to do this in multiple different ways but I think it comes down to the test not knowing when to shutdown the server session.
I have used the following test annotations.
@RunWithSubject("anonymous")
@RunWith(ServerTestRunner.class)
@RunWithServerSession(ServerSession.class)
I then perform some database operation.
BEANS.get(ISqlService.class)
.selectInto(
DB.SELECT_INTO_OBJECT,
new NVPair("object", messages));
An then the unit test hangs for some time after test completion and then reports the following exception.
java.lang.AssertionError: Test failed because some jobs did not complete yet. [context=Test method, jobs=[Managing SQL connection pool for xx.xx.xx.rose.server.sql.SqlService]]
at org.junit.Assert.fail(Assert.java:88)
at org.eclipse.scout.rt.testing.platform.runner.statement.AssertNoRunningJobsStatement.assertNoRunningJobs(AssertNoRunningJobsStatement.java:86)
How can I shut down the server session in a way that accommodates whether I am executing 1 or multiple tests as part of a batch. I have found that if I resolve it for a single unit test that the unit tests fail when executing them as part of a Maven build.
Kind regards,
Mark Ashworth