Friday, May 12, 2017

Automation Testing with CodedUI

Manual Testing is the process of testing a software manually. when there is requirement for GUI testing then one of the best solution is CodedUI. since it is Microsoft stack and integrated in visual studio. Visual Studio 2010 Ultimate/ Premium has codeUI option where user can test the performance of graphical user interface. CodedUI tests provide functional testing as well  regression testing.

Below are the minimum requirement for CodeUI
Microsoft Visual Studio 2010  or above
Microsoft Test Manager 2010 or above

Microsoft Test Agent 2010 or above

To Open Test

  • To start a new test project, go to File -> New -> Project.    In the New Project window, select the Test Project template from Visual C# ->Test and select the OK button to create it.
  • To create a new test, Right click on Project solution and then Add -> Coded Test
  • To record steps ,select  Record actions, edit UI MAP or add assertions and click OK to start the recording process
  • To record steps , select “Record actions, edit UI map or add assertions” and click OK to start the recording process
  • Now Coded UI Test Builder is displayed to start recording . click record button in Coded UI Test Builder
  • Do the manual process like opening a webpage/application, click different controls. finally click Stop button to stop the recording
  • Click the Generate Code button in the Coded UI Test Builder to generate a test method and give custom name and click "add and generate". Now code is recorded. Let's now create an assertion that will check the value of Name. 
  • To create an assertion, press the third button in the Coded UI Test Builder and To identify a new control, drag the crosshair onto the control or hover mouse over the control. After releasing the mouse button, an Add Assertions window is displayed allowing you to add assertions. Assertion added for the Name for inner text properties. 
  • Click the Generate Code button in the Coded UI Test Builder to generate an assertion method. 
  • Source file for CodedUI
  •  If we need to run the test for multiple inputs then need to add parameter values form data source. 
  1.  Add an xml file in codedUI test
  2.  Open properties window to add data connection string.Test ->TestView  right click on codedUi test method and open propeties. select Xml file.
  • Once all tests and assertions are created, you can run tests. open the Test View window by selecting Test -> Windows > Test View  from the main menu of Visual Studio. Now right-click in the test method, and then click Run Tests or Debug Tests
File
Description
CodedUITest1.cs
Contains the coded UI test class, test methods and assertions. We can modify it.
UIMap.uitest
Contains the XML model for the UIMap class, including all windows, controls, properties, methods, parameters, actions, and assertions. This file is not directly editable. But the Coded UI Test Builder helps to modify the existing test which will automatically modify the UIMap.uitest and UIMap.Designer.cs file.
UIMap.Designer.cs
Contains the code representation of the XML contained in the UIMap.uitest file. Do not edit this file.
UIMap.cs
Contains more of the code for the UIMap class. You can put any customizations for the UI map in this file.


Reference(s)
https://msdn.microsoft.com/en-us/library/dd286681(v=vs.100).aspx

1 comment:

  1. Caesars Interactive buys Seminole Hard Rock Hotel Casino
    (NASDAQ: S&P) said it will buy Seminole Hard Rock 울산광역 출장안마 Hotel Casino in 여수 출장마사지 Florida 제주 출장안마 for $3.9 billion, with the 포천 출장샵 Seminole Tribe's acquisition of the 속초 출장마사지

    ReplyDelete

You Can use HTML code once it converted to NCcode by NCode converter