4
如何使用Ant運行註釋爲@Tag
的JUnit 5測試?如何使用Ant執行JUnit 5 @Tag測試?
例如:
class Tax {
@Test
@Tag("taxes")
void testingTax() {
}
}
在Maven的,我可以做以下的包含或排除。但是我不知道如何讓它在Ant中工作。
<properties>
<includeTags>taxes</includeTags>
<excludeTags>Promo</excludeTags>
</properties>
請注意。
你如何從Ant啓動JUnit 5測試? 我知道的唯一方法是從螞蟻調用ConsoleLauncher。 如果是這種情況,您可以將-t參數與要執行的標籤名稱一起傳遞。 鏈接到ConsoleLauncher:http://junit.org/junit5/docs/current/user-guide/#running-tests-console-launcher – Kotse
我不是通過ConsoleLaucher從Elipse啓動JUnit測試。不過謝謝你告訴我,它可以使用-t參數和標籤的名字。 @ kotse謝謝! Eclipse,Aha, – TNinja
。所以你正在使用內置的JUnit5 IDE支持。 我不知道你是否可以從Eclipse運行不同的標籤:)也許你可以將標籤名作爲參數傳遞給你的運行配置,但是Eclipse實現並支持它 - 我沒有嘗試過,因爲我是一個IDEA用戶。 – Kotse