1. 程式人生 > >報錯:Cannot inject @Test annotated Method [testA] with [class java.lang.String].

報錯:Cannot inject @Test annotated Method [testA] with [class java.lang.String].

執行程式碼報錯:Cannot inject @Test annotated Method [testA] with [class java.lang.String].
For more information on native dependency injection please refer to http://testng.org/doc/documentation-main.html#native-dependency-injection;

找了很多方法都沒找到原因

百度後發現文章:https://sqa.stackexchange.com/questions/25436/what-does-this-mean-cannot-inject-test-annotated-method-f-with-interface

   裡面提示@Test 方法不能有引數,然後看了下自己的方法 果然是這樣,去掉引數 問題解決;