Does JUnit 3 run multithreaded ?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Chris_Miles
Posted On:   Wednesday, August 6, 2008 05:18 AM

I am using JUnit 3 through intellij 5 an having problems which look like cuncurrent access to member variables of my test class. A quick example of the problem I am having private List list = null; private MyClass classUnderTest = null; public void setUp() { list = new ArrayList ; classUnderTest = new MyClass(); } public void test1() { list = myObj.getList(10); assertEquals(10, list.size()); } public void test2() { list = myObj.getList(0); assertTrue(0, list.size()); } I am running into the situation where both tests are failing, the first one with    More>>

I am using JUnit 3 through intellij 5 an having problems which look like cuncurrent access to member variables of my test class.



A quick example of the problem I am having



			
private List list = null;
private MyClass classUnderTest = null;

public void setUp() {
list = new ArrayList ;
classUnderTest = new MyClass();
}

public void test1() {
list = myObj.getList(10);
assertEquals(10, list.size());
}

public void test2() {
list = myObj.getList(0);
assertTrue(0, list.size());
}


I am running into the situation where both tests are failing, the first one with



AssertionFailedError: expected: <10> but was: <0>



and the second with



AssertionFailedError: expected: <0> but was: <10>



This is a simplified cut down of my code, but these are the types of assertions which fail - failing on the result of a previous test method in that class rather than the result of its own invocation.



This only happens when I run all my tests in one go (there are thousands of tests), and not when I run the test individually.



any ideas?



Chris    <<Less
About | Sitemap | Contact