1

I tried to build a parameterized tests using Junit with about 15 different input, my test class itself has about 10 test methods, only 2 of them actually need the values from the parameters, and the rest actually only need to run once (like removing a value or empty the object), so the total run tests is 15*10 = 150 while Ideally, only 2*15 +8 tests are needed, is there a way to improve how the tests run?

guberland
  • 55
  • 6
  • 3
    Why don't you split the tests across two different classes - one with the parameterised tests and one with the single-run tests? – Dawood ibn Kareem Dec 12 '17 at 03:07
  • @DawoodibnKareem Thanks! that definitely works, but is there a way to keep only 1 class while solving the problem? – guberland Dec 12 '17 at 03:15
  • 1
    Do nested classes count as one class? There's a way to nest one test class inside another, which means you get one `.java` file - I'm not sure if this is adequate for your purposes. In any case, I don't understand why you wouldn't want to split your tests into separate files - they're easier to manage that way. – Dawood ibn Kareem Dec 12 '17 at 03:55

0 Answers0