I need to test a program that first preprocesses some data and then computes several different results using this preprocessed data -- it makes sense to write separate test for each computation.
Official JUnit policy seems to be that I should run preprocessing before each computation test. How can I set up my test so that I could run the preparation only once (it's quite slow) before running remaining tests?
Use the annotation @BeforeClass to annotate the method which will be run once before all test methods.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With