我用TestNG类创建了一个Maven项目。在TestNG.xml中,我给出了套件名称。我使用多个浏览器Chrome和Firefox来并行运行。只是使用安装类和另外一个类它工作正常但是当我包含多个带@Test注释的类时,我将得到一个注入错误并将给出错误。
我将提供我尝试过的代码
Setup.java
if (browser.equals("Firefox")) {
/*the path of the gecko driver is set*/
System.setProperty("firefoxpath");
drfirefox=DesiredCapabilities.firefox();
drfirefox.setBrowserName("firefox");
drfirefox.setPlatform(Platform.WINDOWS);
} else {
/*the path of the chrome driver is set*/
System.setProperty("chrome path");
drchrome=DesiredCapabilities.chrome();
drchrome.setBrowserName("chrome");
drchrome.setPlatform(Platform.WINDOWS);
}logintest_valid.java
@Testpublic static void valid_logintest ()throws MalformedURLException, InterruptedException {
}@Test
public static void valid_test ()throws MalformedURLException, InterruptedException {
}我收到的错误是:
无法使用[class org.openqa.selenium.remote.DesiredCapabilities]注入@Test带注释的方法[valid_test]。
期望运行两个测试用例valid_logintest和valid_test
开满天机
摇曳的蔷薇
慕盖茨4494581
随时随地看视频慕课网APP
相关分类