运行代码报错:
"[Utils] [ERROR] [Error] org.testng.TestNGException:
Cannot inject @Test annotated Method [ActdefAction] with [interface org.openqa.selenium.WebDriver, class java.lang.String, class configSelenium.Entity.ProInfo.Prodef, class configSelenium.Entity.CommonConfig, interface java.util.Map, interface java.util.Map].
For more information on native dependency injection please refer to http://testng.org/doc/documentation-main.html#native-dependency-injection
网上找到方法,@Test注解的方法不能带参数,去掉参数后,再执行,就没再报错了。
例如:
不带参数的方法
@Listeners(configSelenium.Assert.AssertListener.class)
public class TestCase {
@Test(description = "这是一条测试用例")
public void Case1(){
System.out.println("=========Case1=======");
//重新封装过的Asset
Assertion.verifyEquals("1","3");
Reporter.log(Assertion.errors.iterator().next().getMessage());
}
}
调用一下:
TestNG testNG=new TestNG();
Class[] classes={TestCase.class};
testNG.setTestClasses(classes);
testNG.run();