Sunday, January 4, 2015

STEP #6: Add Custom Assertion to UIMap1.cs file that verifies properties of an HtmlHyperlink add call to assertion method and code to log messages using TestContext.WriteLine to CodedUITestAmazon.cs

Expand UIMap1.uitest in solution explorer to see the two files: UIMap1.cs is where we add the custom code and UIMap1.Designer.cs contains generated code which is just the definitions of the controls on the page in this case

Double Click UIMap1.cs and UIMap1.Designer.cs to open both files and copy using directives from UIMap1.Designer.cs to UIMap1.cs

Add custom Assertion Method to UIMap1.cs that validates properties of an HTML Hyperlink

Add call to Assertion Method to CodedUITestAmazon.cs and log messages using TestContext.writeline in a new [TestMethod]

Select Build>Build Solution

Open Test Explorer under Test>Windows>Test Explorer

Select Test Method name, right click, and “Run Selected test”

Test Runs: Loads IE to validates properties of hyperlink and logs messages to Output: result is displayed in TestExplorer

Click Output link to view messages that were logged

No comments: