差異處
這裏顯示兩個版本的差異處。
下次修改 | 前次修改 | ||
java:junit:tech:ignore [2015/10/21 23:16] tony 建立 |
java:junit:tech:ignore [2023/06/25 09:48] (目前版本) |
||
---|---|---|---|
行 42: | 行 42: | ||
</code> | </code> | ||
{{:java:junit:tech:junit_cond_ignore_assume_in_test.png|}} | {{:java:junit:tech:junit_cond_ignore_assume_in_test.png|}} | ||
+ | ==== JUnit-Ext (不成功) ==== | ||
+ | 我另外試了JUnit-Ext這個API,範例如下: | ||
+ | <code java> | ||
+ | class RunOnWinows implements Checker { | ||
+ | @Override | ||
+ | public boolean satisfy() { | ||
+ | return Platform.isWindows(); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | @RunIf(RunOnWinows.class) | ||
+ | @Test | ||
+ | public void test() { | ||
+ | System.out.println("run test"); | ||
+ | } | ||
+ | </code> | ||
+ | 結果是失敗的,我沒繼續往下追原因,畢竟目前透過Assume足以達到我的需求。 | ||
+ | |||
===== Reference ===== | ===== Reference ===== | ||
* [[http://stackoverflow.com/questions/1689242/conditionally-ignoring-tests-in-junit-4|conditionally-ignoring-tests-in-junit-4]] | * [[http://stackoverflow.com/questions/1689242/conditionally-ignoring-tests-in-junit-4|conditionally-ignoring-tests-in-junit-4]] | ||
* [[http://stackoverflow.com/questions/23410738/run-unit-tests-only-on-windows|run-unit-tests-only-on-windows]] | * [[http://stackoverflow.com/questions/23410738/run-unit-tests-only-on-windows|run-unit-tests-only-on-windows]] | ||
* [[https://code.google.com/p/junit-ext/|Junit-ext]] | * [[https://code.google.com/p/junit-ext/|Junit-ext]] | ||
+ | ===== ===== | ||
+ | ---- | ||
+ | \\ | ||
+ | ~~DISQUS~~ |