Re: Side effects between test cases
| Newsgroups | gmane.comp.java.junit.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Tobi, thanks for the description of your setup. Regarding your alternative b) you can use ant and JUnit task [1] with fork=On and forkMode=perTest and threads=1 which will trade "correctness" for total execution time. If you write a test class for each time-sensitive test each of them will be executed in a seperate JVM and cannot interfere with others regarding timeout or memory. Note that this setup will increase total execution time because a JVM is started for each test. Stefan [1] http://ant.apache.org/manual/Tasks/junit.html Am 28.07.2014 um 09:09 schrieb Tobias Werth [email protected] [junit]: > > Hi Stefan, > > *Stefan Penndorf [email protected] [junit] <[email protected]> > [14/07/25]: > > I think it's really hard to address those things. I agree with Esko > that those > > concerns are rare in "every-day" projects. > > [...] > > Maybe you could explain further why timing is an issue for you. And > maybe you > > can also describe the code and project that causes the issue. > > Yes, both of you are probably right and I overestimated the generality > of my problem. > > What we are doing is a bit different: we evaluate student exercises. > E.g. students have to implement an interface, and we test their code > with JUnit tests for grading purposes. We also restrict timings since > the students may code infinite loops or just choose the wrong > algorithmic complexities. > > What might happen currently is: a student might fail on more cases as he > should fail on. However, we have probably to work around that and > a) either use that deprecated Thread.stop() method (since we don't test > multithreaded code) > b) start each test case in a separate run > > Cheers, > Tobi > >