Results 1 to 3 of 3

Thread: TestContext is reloaded and not being cached

  1. #1
    Join Date
    Jun 2011
    Posts
    2

    Default 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

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,629

    Default

    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.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Jun 2011
    Posts
    2

    Default

    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
  •