- yoursjcpActive particpant
- Posts : 10
Join date : 2010-07-22
DataDriven from Excel in C# with NUnit
Thu Sep 09, 2010 7:57 pm
Hi Everyone
Nice to See an active Selenium Forum.
Previously i used This in JAVA but now the client require that in C#
but iam new to C#..i never used..even i tried to run some tests by learning from the net.
Now i have a big test to do this task...
Kindly any one can help me in this task.
Regards
boBby
Nice to See an active Selenium Forum.
Previously i used This in JAVA but now the client require that in C#
but iam new to C#..i never used..even i tried to run some tests by learning from the net.
Now i have a big test to do this task...
Kindly any one can help me in this task.
Regards
boBby
- snookala
- Posts : 4
Join date : 2010-09-03
Re: DataDriven from Excel in C# with NUnit
Fri Sep 17, 2010 8:42 pm
Hi
May be this is the late response to you but let me know what exactly you want to do still if you are looking for some help.
I am also working with C# and keyword driven testing.
Cheers
May be this is the late response to you but let me know what exactly you want to do still if you are looking for some help.
I am also working with C# and keyword driven testing.
Cheers
- yoursjcpActive particpant
- Posts : 10
Join date : 2010-07-22
Re: DataDriven from Excel in C# with NUnit
Fri Sep 17, 2010 9:11 pm
Hi Thanks for ur msg...
Ya i need the same which i used in Java
the link which i used in java is...
http://functionaltestautomation.blogspot.com/2009/10/dataprovider-data-driven-testing-with.html
Iam unable to make same as this
Kindly Pls help me
Regards
boBby
Ya i need the same which i used in Java
the link which i used in java is...
http://functionaltestautomation.blogspot.com/2009/10/dataprovider-data-driven-testing-with.html
Iam unable to make same as this
Kindly Pls help me
Regards
boBby
- snookala
- Posts : 4
Join date : 2010-09-03
Re: DataDriven from Excel in C# with NUnit
Fri Sep 17, 2010 10:07 pm
Hi boB,
Ok...
Have you configured the C# with Selenium RC, if not then follow the information provided in the link http://thetestingblog.com/2009/09/10/selenium-rc-in-c-using-nunit-an-end-to-end-example/
The below code is for creating xls object
public static Excel.Workbook ExcelSetupProcess(string path)
{
Excel.Application excelApp;
excelApp = new Excel.Application();
Excel.Workbook workBook;
workBook = excelApp.Workbooks.Open(path, 0, false, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", true, false, 0,
true, true, false);
return workBook;
}
The below one is reading xls sheet
public static void ProcessXLSFile(string fileName)
{
//private string ExcelSetupProcess;
Excel.Workbook workBookConfig = ExcelSetupProcess(fileName); // retuns the filename
//Reading the xls workbook
Excel.Worksheet configurexlobj = (Excel.Worksheet)workBookConfig .Sheets["Sheet1"];
//Process row by row
int rowcntconfigxl = configurexlobj.UsedRange.Rows.Count;
for (int rowconfigxl = 2; rowconfigxl <= rowcntconfigxl; rowconfigxl++)
{
//Here you have to write your code. I just given an example of below statement.
string Value = (string)((Excel.Range)configurexlobj.Cells[rowconfigxl, 5]).Text;
}
}
Cheers
Ok...
Have you configured the C# with Selenium RC, if not then follow the information provided in the link http://thetestingblog.com/2009/09/10/selenium-rc-in-c-using-nunit-an-end-to-end-example/
The below code is for creating xls object
public static Excel.Workbook ExcelSetupProcess(string path)
{
Excel.Application excelApp;
excelApp = new Excel.Application();
Excel.Workbook workBook;
workBook = excelApp.Workbooks.Open(path, 0, false, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", true, false, 0,
true, true, false);
return workBook;
}
The below one is reading xls sheet
public static void ProcessXLSFile(string fileName)
{
//private string ExcelSetupProcess;
Excel.Workbook workBookConfig = ExcelSetupProcess(fileName); // retuns the filename
//Reading the xls workbook
Excel.Worksheet configurexlobj = (Excel.Worksheet)workBookConfig .Sheets["Sheet1"];
//Process row by row
int rowcntconfigxl = configurexlobj.UsedRange.Rows.Count;
for (int rowconfigxl = 2; rowconfigxl <= rowcntconfigxl; rowconfigxl++)
{
//Here you have to write your code. I just given an example of below statement.
string Value = (string)((Excel.Range)configurexlobj.Cells[rowconfigxl, 5]).Text;
}
}
Cheers
Permissions in this forum:
You cannot reply to topics in this forum