开发者

Extending JUnit4

I would like to run a series of integration tests against a system. I would like to ditch the boilerplate @Before and @After code that just involves getting and releasing a session. What is the best way to achieve this? The session should also be exposed to the test methods via getSession() method as well. This was very straightforward in JUnit3 - but it's not so obvious to开发者_如何学运维 me in JUnit4.


Implement an (abstract) parent class which contains your "boilerplate" code and make your concrete test classes extend that parent class (this solution seems very obvious for me but maybe I did not understand your use case correct - what do you mean by "very straightforward in JUnit3"?).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜