Reputation: 489
If I have recorded an asseetion from VS2013 coded ui test recorder. The assertion verifies Things like,
Now, let's say I already have a data.csv Connected and configured to solution. All I want to do now is to replace the assertion vlaue JEFF and 60 from certain values from my CSV file.
This is the code in background for assertion
Assert.AreEqual(this.name_assertionExpectedValues.UIEierPane1HelpText, uInamePane1.HelpText, "Cant find Name text label");
Can you tell me what will parametering look like in main CS file for this.
Just so that instead of comparing the expected value from my CSV file not the recorded string.
Thanks in advance.
Upvotes: 0
Views: 498
Reputation: 128
The recorded Assertion in the UI Map file contains the values and this will generate an assertion method, so your assertion code should look like something like this:
this.UIMap.NameOfYourAssertion();
This will assert on the value you recorded. Now when you want to change the value of what you recorded you change the value of the assertion as follows:
this.UIMap.NameOfYourAssertionExpectedValues.UIYourEditBoxText = "your value from csv";
So for every assertion with the name there will be a property of the type that is expected. Most likely a string value. By changing the value before you call the assert method it will then use the changed value. You can use the TestContext.DataRow["Name"].ToString();
call to get the data from the CSV file if you added it to the test method using the DataSource attribute on the test method as described here in MSDN: https://msdn.microsoft.com/en-us/library/ms182519.aspx
Upvotes: 0
Reputation: 310
you can write code as below
Assert.AreEqual(TestContext.DataRow["Name"].ToString(),uInamePane1.HelpText, "Cant find Name text label");
here "Name" will map to your data source Name Column.
Upvotes: 2