Code UI Test in Visual studio 2010 ultimate – Acceptance test in Microsoft

with Ultimate or premium visual studio, you are able to automate your acceptance test or make some User interface test with a recorder provided by

Code UI Test project. Morever, you can customize those test by adding some code, so let’s start with a simple winform project and after create the acceptance test associated:

Create a winform as follows to make an addition:

On designer set textbox and label:


The code behind on button click will display the addition result :


Now, let’s try to test our GUI by first creating a code UI Test :

1/add a test project to our solution (in ultimate version please or premium) and call it as you want 😉


2/Notice the test project on solution explorer and delete the UnitTest.cs file:


3/add a new test:


4/select a code UI Test


5/ a dialog appears, let the record action checked in order to use a User Interface recorder

Which allows to record every User Interface action and click OK:


6/waw on the left side at the bottom, a tool appears : it is the UI recorder


7/create a shortcut on your desktop to launch our addition application and press start recording to record the events to start the application (only click on shortcut to launch application):


8/Press pause to stop recording, click on the right button to notice the event recorded (here only the application launched)

You are able to delete some record steps if there are noise on test.


9/Finally, click on the button at the right side to generate code


10/in code ui test the method is generated and allow an automatic launch of our application


11/record and put some addition data here 5 + 5 = 10 :


As you can see all click event and numbers put on application are registred, let’s stop record and  create a method as before:


The second is correctly generated in code UI test:


Now, let’s check that the result is 10 by put the target button by drag and drop on the control label we are interesting:


As you can see a blue square wrap the control we are interesting and a panel property appears to let us decide on which property we will do an assertion: for sure it is  the display text so select the display text property and click on add assertion button :


It is inserted in code test:


Now run the test by selecting it in test view and enjoy the test is automated:


Waw the test is passed ! we have now to integrate it in a tfs nightly build and the delivery continuous will come faster 😉


, , , , ,

  1. #1 par Aghilas Yakoub le septembre 2, 2013 - 1:34

    I suggest you to make your demos with 2013

Laisser un commentaire

Entrez vos coordonnées ci-dessous ou cliquez sur une icône pour vous connecter:


Vous commentez à l'aide de votre compte Déconnexion /  Changer )

Photo Google+

Vous commentez à l'aide de votre compte Google+. Déconnexion /  Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion /  Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion /  Changer )


Connexion à %s

Microsoft System Center 2012

All System Center 2012 products, Service Manager, App-Controller, Orchestrator, Virtual Machine Manager, Configuration Manager, Data Protection Manager, Operation Manager -Boutougha Hassan

Microsoft Windows Server 2012

IT - Windows server 2012 - Hassan Boutougha

Microsoft Hyper-V

IT - Hyper-V - Hassan Boutougha

Microsoft SQL Server 2012

IT - SQL Server 2012 - Hassan Boutougha

%d blogueurs aiment cette page :