Coded UI is a Functional Test Automation Technique, basically coded UI records to all action and when next time you click on run button then it shows all action recorded by you and gets the result. Coded UI identify check point, data and parameter.
In Visual Studio, create a new Test Project named ForTest. To do this, Select New on the File menu, and then click Project. In the New Project dialog, select Test Documents under Test Projects. Set the project's name to ForTest, specify a valid location, and then click OK.
Add a coded UI test. To do this, in Solution Explorer, right-click on ForTest project, Select Add, and select New Test. In the Add New Test dialog, select Coded UI Test.Enter the Test name as ForTestCodedUITest and click OK. In the Generate Code for Coded UI Test dialog, select Record actions, edit UI map or add assertions, and click OK.
Record the UI Test as follows:
- Click Record to start recording steps
- Open Internet Explorer.
- Navigate to the Mileage Stats home page.
- Click Sign in or Register
- On the Mock Authentication page, click Sign In
- On the Dashboard, click Add Vehicle
- Click on Save from the Add Vehicle form without entering any data.
Now click on Record to stop recording. Click on Show Recorded Steps to check if the steps were recorded correctly. The Coded UI Test Builder dialog should look like the following screenshot.
How to run test case/action recording:
First of all enter the test cases in test manager. If you want to run the test cases then click on “Run” option.
This will invoke recording of your mouse actions
Once you have finished your action recording, add coded UI:
Now open work item window and find your query:
You have selected all test cases and made them run :
As test cases run, the result will be appeared.