當在CLI中使用maven時,我們只能用以下方式運行一個測驗:
mvn test -Dtest="ExampleTestClass#exampleTestMethod
我在想,是否可以根據一個測驗的displayName來執行它,比如:
@Test
@DisplayName("hello")
public void exampleTestMethod() {
}
mvn test -Dtest="ExampleTestClass#hello"/code>
??
默認情況下,這并不執行任何測驗,但也許需要進行一些配置?
uj5u.com熱心網友回復:
不,這是不可能的(除非你自己實作它,因為它是開源的)。請記住,surefire是測驗框架不可知的:它們都能理解類和方法。-Dtest被所有測驗框架使用,而displayName注解是JUnit特有的。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/310129.html
標籤:
