Automated UI Testing in VS 2010

UI testing is repetitive and time consuming. VS 2010 has added ‘Coded UI Test’ that allows us to create automated the UI test cases. This can save a lot of time and help in doing quick BVT (Build Verification Test). The following walkthrough demonstrates how to create automated UI tests using VS 2010.

Step 1: Create a new Test project in VS 2010

Lets begin by using File –> New Project menu item in VS 2010 to create a new Test project.

image

Step 2: Add a new Coded UI Test file to the project
Right click on the project and choose ‘Add –> Coded UI Test’ menu item.

image

This will add the necessary references to the project and bring up the ‘Generate Code for Coded UI Test’ dialog box.

image

Select the first option – ‘Record actions, edit UI map or add assertion’. This will bring up the recording screen at the bottom right of the screen. Click the red button to start the recording.

image

Step 3: Record the steps of the automated UI test

I will go to the Yahoo home page and browse to different pages.

image

Stop the recording and generate the code for the test by clicking the last button on the recording screen (shown in red border).

image

Step 4: Run the automated UI test case

Run the test case by clicking on Test –> Run –> All Tests in Solution. This will open the Yahoo home page and browse as per the recording done in the last step.

Make sure that the web browser is open before running the test case and you don’t change the mouse focus or press keys once the test case has started to run.

image

Advertisement

About vicky4147

I do consulting on .NET software development.
This entry was posted in Testing, Visual Studio 2010. Bookmark the permalink.

One Response to Automated UI Testing in VS 2010

  1. Praveen Kumar says:

    yeah this is good airtical to under standing for automated testing using vs 2010
    its help full for only whose don’t know about automated testing
    can u plz do one thing . plz proved code level testing ui testing ( UI tesing which means if testbox width change its also find in testing )

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s