-
Jun 1st, 2011, 09:09 AM
#1
TestContext is reloaded and not being cached
Hi,
I have a set of tests which use TestContext Framework (Spring 3.0.0 RELEASE). They extend AbstractTransactionalJUnit4SpringContextTests and use following annotations: @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:somefolder/application-context.xml"})
I am using JUnit 4.6 and Ant 1.8.2.
When I run tests on my PC laptop (tried both from eclipse everything works fine, context is cached both between test methods of the same class and between test classes in the batchtest element of an Ant junit task.
But for some reason when I am running the same Ant build on the build server (both from bamboo and from command line) the test methods of the same class reuse the context, but when it comes to other class it starts reloading it.
I've tried to enable debug logging, but now news, it says that the context is not dirty, but for some reason tries to reload it anyway.
Do you have solutions or ideas what needs to be checked?
Your help will be highly appreciated.
Thanks,
Vadim
-
Jun 1st, 2011, 02:07 PM
#2
You don't need the @RunWIth annotation that is already on the super class. When running on the server make sure that the tests don't fork a new thread/java process (which might not be the case with a local config). If each test runs in a new proces there is no caching over classes.
-
Jun 1st, 2011, 02:57 PM
#3
Hi, thanks for your answer. I have a super class and sublasses do not have any specific annotation. What comes about forking - configuration on both systems is the same - junit Ant target is run without fork.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules