Archives de la catégorie Application Life Cycle Management

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

Share an assembly with nuget package – make your assembly accessible from Visual studio Gallery or Local repository

Nuget is a visual studio extension allowing to share libraries (add, remove..).

In this article, First we will create a nuget package to push our assembly in official nuget repository and get it from gallery in visual studio 2010 using NuGet command line. Secondly, we will use a GUI NuGet Package Explorer and create a local repository to share assemblies

In tools menu,click on Extension Manager to install Nuget Package Manager

Download Nuget Package Manager from Gallery. This package will allow to reference

In solution explorer, you can manage Nuget Package by right clicking in reference:

create your nuget account:

and register your API key in order to be authorized to push your nugget package on nuget website:

nuget setApiKey yourapikey

download Nuget.exe from codeplex url:

add the Nuget path in environment variables to register nugget application path

run nuget spec yourassembly.dll to create your package

in the assembly folder, you can see a new file with nuspec extension:

when editing the nuspecfile, we can see a xml configuration :

clean this xml file by set your own configuration or delete xml not used:

Create a lib folder and copy the assembly you want to package with nuget. In this lib folder create a framework subfolder (here net40 for framework 4.0) Make a nuget package by this command line:

Nuget pack MyBizservice.dll.nuspec

It creates a nupkg file, your nuget package:

push your package in the nuget server to share it with the command line:

nuget push yourpackage.nupkg

in your Nuget account, go to Package panel and see that your package has been pushed:

from gallery in visual studio , the assembly is now avalaible:

you can also use a GUI to manage your nuget package:

first download Nuget Explorer on codeplex url:

after downloading this tool, this dialog box is opened:

Create a new nuget package using the third task

Click on edit menu in order to set the xml configuration for the nuget package:

set the package name and other settings:

finally select the content you want to set in your nuget package by clicking on content menu ,Add and Lib folder (it is the folder where you set assembly for nuget) as follows:

in right panel called package contents, you will see the lib folder you have added

Right click on lib folder to select the target framework (here 4.0) of your assembly (Add .NET folder)

a net40 folder is created:

select this folder and right click to add the assembly you want to package with nuget:

we can see the assembly added in lib folder, save the nuget package by clicking on green save button or CTRL + S:

once saved the package metadata exit from the edit mode:

the package is created on the folder :

for this nuget package we will configure a local repository instead officical nuget repository . First go to options of Toos menu of visual studio:

select Package Manager, and Package Sources :

click on + button to add a new source (here a local repository called MyLocalNugetRepository but it can be a share for a team):

select the folder where you have saved the previous nuget package ( the cursor is hover the explorer button)

we have selected a local folder, click ok: now we have another source for nuget package. Right click in the project in solution explorer on Manage NuGet Packages:

on the left side in the online panel, we see the new NuGet local source we have created and when clicking on it, the previous nuget package appears:


We have seen how with console create a nuGet package shared in NuGet official package source and how use NuGet explorer to create a nuGet Package and set it in a local repository

, , , , , , , ,

Poster un 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

Analyse code in Visual studio 2010 : Code improvement

Analysis code ensure to follow rules in Developer local computer Visual Studio 2010  and also in your Build server like TFS 2010 . It   analyzes managed assemblies and reports information about the assemblies, such as violations of the programming and design rules set . For instance, a classic sample is the correct implementation of a Disposable class which have a IDisposable interface.

Select Code Analysis Settings, the active configuration for each project in the solution will appear.

For each project in a visual studio 2010 solution, we can affect Analysis code rules we want:

Here, we apply all Microsoft rules in the application, and Microsoft Minimum Recommanded Rules in Test projects. You can select different Rules or your custom rules when clicking in Rule Set column as below:

Enable Code Analysis on project properties in order to run Code Analysis on each build

Right click on each project and select properties in the context menu. Check Enable Code Analysis on Build

We can configure rules we want on designer:

It is also possible to select multiple ruleset when choosing <Choose Mutliple rule sets> as follows:

by entreprise analysis code strategy, rules can be set to warning, error or none at rule or category level :

we set Microsoft.Design rule to error at category level:

if a design rule fails, an error occurs instead of a warning

you can save it as your ruleset file (here MyCustomRules.ruleset) – don’t forget to change propertie name in the properties panel of ruleset :

Select browse in Rule set combobox :

when building application  (because we have configured Analysis code to run on each build) or if we only run Analysis code by right clicking on project  as follows

two error occurs (because of our changes that pass warning design rules to error design rules

if we update Mycustomrule on Design Rules to become warning at category level, we will get only warning, (depending on our entreprise strategy). Below the two design rules appear now as warning :

, ,

Poster un commentaire

software branch strategy – trunk , development , service pack , release …


How to manage our software branches to :

-understand when creating a new branch

-be sure to manage correctly bug fix for different deliveries

Trunk branch or X.Y.Z branch

trunk is the main software branch which have a robust version X.Y.Z  with :

-X: represents the major version which indicates enough modifications to create a new Service package

-Y: represents the minor version which indicates little modifications

-Z: represents bug fixes version which indicates that after a release delivery, some roundtrip came to correct bugs

Service Pack branch or 1.Y.Z branch , 2.Y.Z branch and so on…

A new service pack branch is creating from the trunk branch when team project decides to deliver a major version of an application. This Service Pack branch will be used when we want to commit minor versions of our software application. When major modifications will be merged on the trunk from development branches, team project will create another Service Pack branch with an increment on X value (2.Y.Z).

Hot Fix branch or 1.0.Z branch , 1.1.Z branch and so on…

the hot fix branch(1.0.Z, 1.1.Z) is creating from our 1.Y.Z Service pack branch only when team project decide to deliver a release on production environment. this branch, for example 1.0.Z will contains all bug fix of the release 1.0.0  . So when team project deliver for the first time a version on production environment (called Release version 1.0.0), after few times, some bug will be discovered and team project will correct those bugs on Hot Fix branch (1.0.Z).  if a major bug or many minor bug will be fixed, team project will deliver another release 1.0.1 which means :

1.0.0  +  first bug fix modification  = 1.0.1

Release branch or 1.0.0 branch, 1.0.1….2.0.0,2.01…

Release branch is a read-only branch that represent a delivery on production environment. So, each time, team project make a delivery on production environment, it will keep a « copy » branch (1.0.0 1.0.1 etc)

Development branch.

Development branch contain major modifications. They are created from trunk branch and are merged on the trunk after those major application modification are completed. Team project make this merge on the trunk only when they will decide to deliver those major modification, so team create also the service pack, hot fix and release branch

Branch Application Life Cycle Management

An example to understand. Team project decide to create a car seller application so they create those branch:    

-a trunk branch and  Service Pack branch called 1.Y.Z

After one month, team have a robust application and decide to make a delivery on production environment:          

 -a Hot Fix branch 1.0.Z  and a Release branch called 1.0.0 are created

-a merge is done from 1.Y.Z Service Pack branch to Trunk

After few weeks some bug are detected :

-Team project correct them and commit all changes on 1.0.Z  Hot Fix branch , 1.Y.Z Service Pack branch and X.Y.Z trunk branch after tests.

management decide to make a new delivery with those bug fix:

-a new 1.0.1 Release branch is created from 1.0.Z branch and is delivered on production environment.

another team work on home seller application which is a major modification of car seller application (we will sell cars and homes):

-a new Development branch is created from trunk and is called HomeSell

After two months, management decide to deliver the major modification to sell home:

-team project make a merge from « HomeSell » Development branch to Trunk and resolves all conflicts

-a new 2.Y.Z Service Pack Branch is created from trunk branch just merged.

-a new 2.0.Z Hot fix branch is created and also a read-only   2.0.0 Release branch is created and delivered on production environment


Points of Interest

with this software branch management, team project will understand when and how creating a branch.


first version – I will add a pictures to represent software branching

, , , , , , , , , , , , , , ,

Poster un 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