开发者

How to prepare state for several JUnit tests only once

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开发者_如何学JAVA 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜