when i am running batch test cases through testng, getting followin error:
Cannot inject @Test annotated Method [CreateLeadTest] with [class java.util.Hashtable]
[Utils] [ERROR] [Error] org.testng.TestNGException:
Cannot inject @Test annotated Method [CreateLeadTest] with [class java.util.Hashtable].
For more information on native dependency injection please refer to http://testng.org/doc/documentation-main.html#native-dependency-injection
======================================================================
TEST NG XML:
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="SuiteName">
<test name="LoginTest" allow-return-values="true">
<classes>
<class name="com.ktest.zoho.project.testcases.LoginTest" ></class>
</classes>
</test>
<test name="LeadTest" allow-return-values="true">
<classes>
<class name="com.ktest.zoho.project.testcases.LeadTest" ></class>
</classes>
</test>
<test name="PotentialTest" allow-return-values="true">
<classes>
<class name="com.ktest.zoho.project.testcases.PotentialTest" ></class>
</classes>
</test>
</suite>
======================================================
@Test(priority=1,dataProvider = "getData")
public void CreateLeadTest (Hashtable<String,String> data)
{
test = rep.startTest("CreateLeadTest");
//Propinit();
OpnBrowser(data.get("Browser"));
navigate("Appurl");
CRMlogin("Acessesyourapp_xpath","AcessAppTxt");
===================================================================
@DataProvider
public Object [][]getData()
{
super.Propinit(); //Initialize Property file
xls = new Xls_Reader(prop.getProperty("xlsPath"));
return DataUtil.getTestData(xls, testCaseName);
}
=================================================================================
Instructor
Ashish Thakur Replied on 25/06/2019
Did you try debugging the code?
Share the complete exception stack trace as well.
I will submit tomorrow. I reseraced and have so many issue for:
Cannot inject @Test annotated Method with [class ........
but NOT with Hashtable
Also
Instructor
Ashish Thakur Replied on 26/06/2019
Please share the project in a compressed ZIP file
I have resolved issue, Data provider was not defined properly. You can close it