0

I am using JUnit 3 and I have a test class which had 4 test methods. CLass A: test1() test2() test3() test4()

Now I have written another test class B, which has the following methods: test10() test11() test12()

Now, test10() requires test1() (of class A) as a pre requisite. SO I would like to run only test1() from Class A, when inside test10() of class B.

Could someone please hep me with this?

Thanks and regards, Sunny

Sunny
  • 7,444
  • 22
  • 63
  • 104
  • I would suggest you to remove this link between the tests. Unit tests should always run independently. – boskop Oct 29 '13 at 11:15

1 Answers1

0

This sounds like code that should be extracted to a helper class. But if you must do this, it is just regular Java code.

In test B:

public void test100() {
  ClassA helper = new ClassA("");
  helper.setUp();
  helper.test1();
  // your actual logic for test100
}

Also, consider better names if your tests are really named test100(), test101(), etc.

Jeanne Boyarsky
  • 12,156
  • 2
  • 49
  • 59