开发者

JUnit Custom Rules

开发者 https://www.devze.com 2022-12-29 02:20 出处:网络
JUnit 4.7 introduced the concept of custom rules: http://www.infoq.com/news/2009/07/junit-4.7-rules There are a number of built in JUnit rules including TemporaryFolder which helps by clearing up fo

JUnit 4.7 introduced the concept of custom rules:

http://www.infoq.com/news/2009/07/junit-4.7-rules

There are a number of built in JUnit rules including TemporaryFolder which helps by clearing up folders after a test has been run:

@Rule
public TemporaryFolder tempFolder = new TemporaryFolder();

There's a full list of built in rules here:

http://kentbeck.github.com/junit/javadoc/latest/org/junit/rules/package-summary.html

I'm interested in finding out what custom rules are in place where you work or what useful custom rules开发者_如何学Go you currently use?


I used @Rule for repeated test: @Rule: 在JUnit4中利用Rule

Sorry, It's Chinese, but code and comment are English:)

0

精彩评论

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

关注公众号