代码调用testNG报错:Cannot inject @Test annotated Method [ActdefAct]with[interface org.openqa.selenium.Web]

11 篇文章 0 订阅

运行代码报错:

"[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();

在这里插入图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值