Getting Warning message in Dictionary Line..
public class LoginTest :BaseTest
{
static string testCaseName = "ReportsTest";
static ExcelReaderFile xls = new ExcelReaderFile(ConfigurationManager.AppSettings["xlsPath"]);
[Test, TestCaseSource("getData")]
public void runReport(Dictionary<string, string> data) ---> In this line!
Test Name: runReport(System.Collections.Generic.Dictionary`2[System.String,System.String])
Any help would be appreciated!!
Screenshot attached
Instructor
gunjan Replied on 17/01/2019
You are getting the warning as you might have set the 'Runmode' column's value to 'N' in the excel because of which it skips the testcase with a warning.
Kindly check the Runmode column value in the excel.
I tried it with RUN MODE "Y". I don't have any "N".
Though, the test is passed - this message warns me.
I also attached my Data Excel File..
Please check..
Data Excel attached as well
I have only 3 Columns and 4 rows of Data
Do I need to change the code?
Instructor
gunjan Replied on 18/01/2019
Excel is correct. Can you show me the code that you are trying to execute.
attached my logintest.cs
Instructor
gunjan Replied on 18/01/2019
Please check this condition:
if (!DataUtil.DataUtil.isTestRunnable(testCaseName, xls) || data["Runmode"].Equals("N"))
{
test.Log(Status.Skip, "Skipping the test as runmode is No");
Assert.Ignore("Skipping the test as runmode is No");
}
Try this :
if (!(DataUtil.DataUtil.isTestRunnable(testCaseName, xls) || data["Runmode"].Equals("N")))
{
test.Log(Status.Skip, "Skipping the test as runmode is No");
Assert.Ignore("Skipping the test as runmode is No");
}
I tried new code and still same error.
The problem is in this line:
public void runReport(Dictionary<string, string> data)
Above line is looking to pass parameters in DATAUTIL.cs in below code:
object[][] data = new object[rows][];
int dataRow = 0;
Dictionary<string, string> table = null;
for (int rNum = dataStartRowNum; rNum < dataStartRowNum + rows; rNum++)
{
data[rNum - dataStartRowNum] = new object[1];
table = new Dictionary<string, string>();
for (int cNum = 0; cNum < cols; cNum++)
{
string key = xls.getCellData(sheetName, cNum, colStartRowNum);
string value = xls.getCellData(sheetName, cNum, rNum);
table.Add(key, value);
}
data[dataRow][0] = table;
dataRow++;
Instructor
gunjan Replied on 18/01/2019
This code is correct. Can you send me the entire code so that I can try executing it.
I cannot upload here! its failing to upload my ZIP File.
Please share your email id. I will drop you an email.
Instructor
gunjan Replied on 18/01/2019
seleniumtraining10@gmail.com
Instructor
gunjan Replied on 18/01/2019
Did you try this :
if (!(DataUtil.DataUtil.isTestRunnable(testCaseName, xls) || data["Runmode"].Equals("N")))
{
test.Log(Status.Skip, "Skipping the test as runmode is No");
Assert.Ignore("Skipping the test as runmode is No");
}
Yes Gunjan..I tried it and it is showing same warning message.
I sent you my code to above email id.
Instructor
gunjan Replied on 18/01/2019
The code is running fine at my end. I can't see any warning message.
Please check once again.
Code is working fine my end also..
If you expand Testingframework project(in Test Explorer) --> runReport (you will see this message)
I have attached screenshot.
Do you see this message?
Instructor
gunjan Replied on 19/01/2019
Yes .. this is the name of the test method which will be listed every time for each test.
ok got it. please close the ticket