I have some common set up code that I've factored out to a method marked with @Before
. However, it is not necessary for all this code to run for every single test. Is there a way to mark it so the @Before
method only runs before certain tests?
views:
70answers:
2
+5
A:
Just move out the tests that don't need the setup code into a separate test class. If you have some other code common to the tests that would be helpful to keep, move that out into a helper class.
Kirschstein
2009-10-10 16:55:18
+1 in other words, don't use @Before if you don't want the behavior of @Before :)
Pascal Thivent
2009-10-10 17:39:08