Archives de la catégorie Testing Strategy with MsTest

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 commentaire

MSTest in Visual Studio 2010

There are three test categories:

-Continuous Integration Test  (that is quick test)

-Nightly Test (that is long time test)

-Manually Test

Create your unit test using MSTest:

First  create your class and methods in a console application for instance:

right click on your method and select create unit Test on the context menu:

a Create Test unit Dialog box appears and let you to specify on which method you want to create unit test, and on which test project you will create those (Output project at the bottom)


Select the correct Test project as follows:


you can also for the first time create a new test project as below:


another popup appears to set the name of your Test project:

in the solution, after clicking on Create button, the test project will appear in the solution explorer:

in the OperationsTest.cs file, the class test is created and you are allowed to make as unit tests you want from this template:

Create 3 tests in order to set one test by test category (CI, manually and Nightly)

In solution explorer, click on Vsmdi file, a panel on the right appears with three components:

-List of Tests : to define our test categories (empty because not defined as follows)


-Tests not in a list : show all tests that are not affected to a category ( all tests appear)

-All loaded tests : all tests present in the solution

we create three tests categories on right clicking on Lists of Tests and select new Test list:

a Create New Test List DialogBox appears .Create the first category , CI tests , and set the description

the new test category is visible in the Test List Editor :

repeat actions to create manually and Nightly tests:


assoicate unit test by drag and drop unit test showed on All Loaded Tests to the category wanted. A drag and drop of my first unit test to CI test:


in test list Full Name, you can read that first test is associated to CI test


repeat actions to associate other tests to other test categories:

if you click in a test category, you will see associated test:


in Test Not in a List,  there are no tests anymore because all are attached to a test category. This list is interesting, because you will see quickly new tests and you can associate it to a test category with drag and drop to List of Tests.

You can enable / disable each test on right clicking on the test and click Disable or enable in the context menu:


an easy way to quickly manage your unit tests. The test appear disabled:

Vsmdi file to define our list s that are categories of test




You can now run


–          each test one by one in the current context in release or debug mode


–          run all tests in the solution in release or debug mode


–          run only impacted test in release or debug mode


the three first shortcut are release mode, the three other are debug mode

in Test menu, select Test results view to see result of unit tests

when running test , we can see results:



, , , , , , , ,

1 commentaire

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