I'm having difficulty displaying a CSV file using the coded interface testing method. This is most likely a stupid question, but I cannot find a solution to my problem, at least not the one that works. I have definitely set the CSV file property to Copy always . I also imported the CSV file by writing the following line above the testing method.
[DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\\Data\\login.csv", "login#csv", DataAccessMethod.Sequential), DeploymentItem("login.csv"), TestMethod]
The name of the file login.csvand is in the folder Data.
The test will be compiled without any problems, but as soon as the test completes the fields that should receive input from the CSV file, they remain empty and execution is interrupted. I tried replacing the data from the CSV file with Strings and it works fine. Part of the code that I use to import each parameter:
TestContext.DataRow["Username"].ToString()
In addition, the CSV file contains something in the following lines:
Username,Password,Fullname
admin@mail.com,password,Admin
Is there anyone who can indicate that I forgot.
Update: I pointed out the problem, it seems the problem only revolves around the first column in the csv file. When I try to import any other values, it works fine.