I have written a program that reads in data from a csv file.
The code that reads in the data is copied below.
However, I would like to do the following:
(1) Store the values to variables so that they can be used in a Selenium Automation Script.
Some Considerations:
I think what needs to be done is to include a Split Method in the While Loop that treats the comma (",") as the separation between each value. However, I am not sure how to correctly implement this. Moreover, as I am new to programming, If I could get a code example on how to to this, that would be most beneficial.
I would also need to skip the first line as it contains a header that identifies the data.
Last, because each row of the csv represents data for (1) test scenario, I would like the loop to execute until the last row of the csv has been read.
// Read data from CSV file
using (CsvFileReader reader = new CsvFileReader("C:\\Data\\Test_Resources\\Data_Sheets\\Adactin\\Data_Input.csv"))
{
CsvRow row = new CsvRow();
while (reader.ReadRow(row))
{
foreach (string s in row)
{
Console.Write(s);
Console.Write(" ");
}
Console.WriteLine();
}
}