尝试使用带有maven的TestNg以特定方法执行以下类。
这里我使用以下终端命令来运行指定的类。
mvn clean -Dtest=LaunchTest
public class LaunchTest {
@Test
public void launchHtml(){
String WEBAPP_URL = "https://atee/public/index.html";
for (String ids : deviceIds){
// operations
}
}
@Test
public void launchsApp() throws TestException {
String app = "unittest"
/*
operations
*/
}
}
但我需要使用特定方法执行类,例如l aunchHtml or launchsApp
也传递来自终端命令的参数
例如:执行方法launchsApp()
mvn clean -Dtest=LaunchTest#launchsApp
当我使用上述命令时出现以下错误
INFO] ------------------------------------------------------------------------
ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.
8.1:test (default-test) on project send-deeplink: No tests were executed! (Set
-DfailIfNoTests=false to ignore this error.) -> [Help 1]
ERROR]
ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
h.
ERROR] Re-run Maven using the -X switch to enable full debug logging.