Test data from .csv file
Test data from .csv file
is there code snippet for read through the entire .csv file and passing the data to test method in ranorex,
Thank you,
Beginner
Thank you,
Beginner
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Test data from .csv file
Hi,
Do you know the Ranorex Studio "Manage Data Source" functionality?
You can easily load your (csv, excel, ...) files with all data into your project and you can easily access them.
For additional information see the link below: http://www.ranorex.com/support/user-gui ... sting.html
If you mean something else please explain it in a more detailed way.
Thanks in advance!
Regards,
Markus
Ranorex Support Team
Do you know the Ranorex Studio "Manage Data Source" functionality?
You can easily load your (csv, excel, ...) files with all data into your project and you can easily access them.
For additional information see the link below: http://www.ranorex.com/support/user-gui ... sting.html
If you mean something else please explain it in a more detailed way.
Thanks in advance!
Regards,
Markus
Ranorex Support Team
Re: Test data from .csv file
how to load csv file w/out using "Manage Data Source" functionality, i like to creae a function that will read the .csv file from external source then passing data as function parameter.
Thank you
Beginner
Thank you
Beginner
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Test data from .csv file
Hi,
if you do not like to use our new data connectors with data binding, you can use attached CSVConnector.
Following code sample shows you how to use it:
Tobias
Support Team
if you do not like to use our new data connectors with data binding, you can use attached CSVConnector.
Following code sample shows you how to use it:
... try { // Create a new CSVConnector object CSVConnector csvConnector = new CSVConnector(@"../../data.csv"); // Read every row from connector and send to AddVIPApplication. foreach(System.Data.DataRow row in csvConnector.Rows) { String str1 = row[0].ToString(); String str2 = row[1].ToString(); } } catch (RanorexException e) { ...Regards,
Tobias
Support Team
You do not have the required permissions to view the files attached to this post.
Re: Test data from .csv file
Thank you Markus, I really like the dataconnecters and binding feature in Ranorex, the problem i am having w/binding data w/parameter, I am working on it , will keep you posted the progress.
Thank you
Beginner
Thank you
Beginner
Re: Test data from .csv file
how to view the data str1, I tried to use messagebox.show but no go
try
{
// Create a new CSVConnector object
CSVConnector csvConnector = new CSVConnector(@"../../data.csv");
// Read every row from connector and send to AddVIPApplication.
foreach(System.Data.DataRow row in csvConnector.Rows)
{
String str1 = row[0].ToString();
String str2 = row[1].ToString();
}
}
catch (RanorexException e)
{
try
{
// Create a new CSVConnector object
CSVConnector csvConnector = new CSVConnector(@"../../data.csv");
// Read every row from connector and send to AddVIPApplication.
foreach(System.Data.DataRow row in csvConnector.Rows)
{
String str1 = row[0].ToString();
String str2 = row[1].ToString();
}
}
catch (RanorexException e)
{
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Test data from .csv file
Hi,
No idea why MessageBox.Show should not work, but instead you can use Console.WriteLine(), or log the data to the Ranorex Report file, or you set a breakpoint and use the debugging mode of Studio to read the data for str1.
Regards,
Peter
Ranorex Team
No idea why MessageBox.Show should not work, but instead you can use Console.WriteLine(), or log the data to the Ranorex Report file, or you set a breakpoint and use the debugging mode of Studio to read the data for str1.
Regards,
Peter
Ranorex Team
Re: Test data from .csv file
Thank you Peter, I might need instruction or what to do w/attached file "CSVConnector.cs" on previous post .
Thanks
Beginner
Thanks
Beginner
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Test data from .csv file
Hi,
Attached you will find the old Data Drive Sample. In this sample the VIP Application uses the CSV Connector. Regards,
Peter
Ranorex Team
Attached you will find the old Data Drive Sample. In this sample the VIP Application uses the CSV Connector. Regards,
Peter
Ranorex Team
You do not have the required permissions to view the files attached to this post.
Re: Test data from .csv file
Thank you Peter
Beginner
Beginner
Re: Test data from .csv file
i amg getting the error " Index was outside the bounds of the array. "
Thanks
Beginner
Code: Select all
void ITestModule.Run()
{
Mouse.DefaultMoveTime = 300;
Keyboard.DefaultKeyPressTime = 100;
Delay.SpeedFactor = 1.0;
// Create a new CSVConnector object
CSVConnector csvConnector = new CSVConnector(@"C:\Automation_Ranorex\TestData.csv");
// Read every row from connector and send to AddVIPApplication.
foreach(DataRow row in csvConnector.Rows)
{
LoginTo.userId = row["userID"].ToString();
LoginTo.passWord = row["passWord"].ToString();
MessageBox.Show(LoginTo.userId);
}
Beginner
Re: Test data from .csv file
Thank you all, csvconnector working as expected.
Beginner
Beginner
Re: Test data from .csv file
How to parse data in csv File that contains this format "lastname, firstname (company name)". Thank you in advance...beginner
Tipu
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Test data from .csv file
Hi,
Regards,
Markus
Ranorex Support Team
Like you have done it, you just have to replace "userID" with "lastname", "passWord" with "firstname" and so on.How to parse data in csv File that contains this format "lastname, firstname (company name)".
Regards,
Markus
Ranorex Support Team
Re: Test data from .csv file
I do have data in csv file that looks like this " omayer,baba-(testing field)" . Now when that field gets parsed its value display as "omayer. Not the entire data, so how will i get the data that read as " omayer,baba-(testing field)"
Thank you
Beginner
Thank you
Beginner
Tipu