for (int tsid = 1; tsid < controller.getRowCount(currentTest); tsid++)
{
// values from xls
keyword = controller.getCellData(currentTest, "Keyword", tsid);
//object=controller.getCellData(currentTest, "Object", tsid);
currentTSID = controller.getCellData(currentTest, "TSID", tsid);
stepDescription = controller.getCellData(currentTest, "Description", tsid);
Console.WriteLine("Keyword is:" + keyword);
try
{
// --this is equivalent java code
//MethodInfo method= Keywords.class.getMethod(keyword);
MethodInfo method= method.GetMethodBody(keyword);
String result = (String)method.Invoke(method);
if(!result.StartsWith("Fail")) {
ReportUtil.addKeyword(stepDescription, keyword, result,null);
}
}
catch (...) { ... }
}
Here from excel sheet we are reading the Keyword and we need to call that specific method using Reflection:
MethodInfo method= method.GetMethodBody(keyword);
String result = (String)method.Invoke(method);
But these two lines of code are throwing me some syntax error. I have used using System.Reflection;
at the top of the file, but the error persists.