This discussion is archived
3 Replies Latest reply: Mar 1, 2013 12:51 PM by Aacc RSS

Does Junit run each test suite in separate classLoader?

Aacc Newbie
Currently Being Moderated
Does Junit run each test suite in separate classLoader or even separate JVM?

Here is a situation. I have multiple test suites (say suite 1 and suite 2). I'm using ant to run Junit on these suites.
test cases in each suite depends on a class (say classA) in thier own class path but the classA has diffrent version:
Suite 1:
classpath for suite 1: has classA (version 1)

Suite 2:
classpath for suite 2: has classA (version 2)

the 2 versions of classA has same package name and class name but content is diffrent (diffrent version). suite 1 and 2 have thire own class path.

Question is, does Junit run (through ant) each test suite in separate classLoader? the concern is, if not, the suite 1 load classA version 1, then before running suite2, it won't unload version 1 of classA and reload version 2 of classA - is this a valid concern? if so, is there any way to ensure the correct version of classA load for each test suite?
Thanks

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points