November 2010 - Posts
Teched 2010 - Applied Software Testing with Visual Studio 2010 – Done
I’ll start saying – Thanks everyone who participate at my lecture in Teched Israel 2010, I’ll also like to say thanks to Tzvia Gitlin Troyna the ALM sessions manager and to Sela Group for helping and supporting me during that period.
My Session was loaded with Information regarding Automated/Manual Testing in Visual Studio 2010 & Microsoft Test Manager and there is not doubt that the Testing Space in Visual Studio 2010 is the future of Automated/Manual Testing.
During my session I had A LOT of questions and not enough time to answer all those questions, so as promised I’m writing this post to give you the guidelines based on my presentation topics in order to help get started with Test Automation using Visual Studio 2010 and Microsoft Test Manager.
- Microsoft Test Manager – More Info
- Fast Forward Automation – We saw how from manual Test Case you can create a simple automatic test without writing code.
- Rich Bugs – Using Data Collectors we saw how easy is to open bug with all the information you need.
- Web Testing
We saw how to record Web Site or Desktop application HTTP/S request and rerun those request with different parameters from external data source. – More Info - Screencasts - Load Testing
You can Do It!!! we saw how easy create new load testing can be using Visual Studio 2010 – More Info - Coded UI Testing – More Info
- From Existing Test Case – When the “Manual Tester” working on his Test Cases as an Automation Guy or Developer I can generate the Coded UI from the Manual Test Case. (Fast Forward Automation).
- New – Create a powerful UI Automation using Coded UI Test Builder.
Any other question feel free to contact me – shair[at]sela.co.il
Download Teched Presentation
Thanks again and Enjoy

TFS API Part 32 – Add and Remove Users From Application Groups


Download Demo Project
Step 1: Create Project and Add Reference
Create an WPF/WinForm application and add the following references:
First add reference for
- Microsoft.TeamFoundation.dll
- Microsoft.TeamFoundation.Client.dll
- Microsoft.TeamFoundation.Common.dll
All files located under - c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0\
Step 2: Connect to Team Foundation Server
(TFS API Part 20: Bye TeamFoundationServer and Welcome TfsTeamProjectCollection)
IGroupSecurityService gss;
private void button1_Click(object sender, RoutedEventArgs e)
{
TeamProjectPicker tpp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false);
tpp.ShowDialog();
if (tpp.SelectedProjects.Length > 0)
{
TFS = tpp.SelectedTeamProjectCollection;
Project = tpp.SelectedProjects[0];
gss = (IGroupSecurityService)TFS.GetService(typeof(IGroupSecurityService));
}
}
Step 3: Get All Users and Groups by Project
First create listbox called “list_users” to contain the users list and a combobox called “combo_groups” to contain the Project Groups
void GetUsers()
{
//Perfom search based on "Project Collection Valid Users" this valid only for TFS 2010 in order to user the same functionality on TFS 2008
//You need to user Team Foundation Valid Users"
Identity SIDS = gss.ReadIdentity(SearchFactor.AccountName, "Project Collection Valid Users", QueryMembership.Expanded);
Identity[] UserIds = gss.ReadIdentities(SearchFactor.Sid, SIDS.Members, QueryMembership.None);
var query = from user in UserIds
where user.Type == IdentityType.WindowsUser
select user;
list_users.ItemsSource = query;
}
void GetGroups()
{
Identity SIDS = gss.ReadIdentity(SearchFactor.EveryoneApplicationGroup, "", QueryMembership.Expanded);
Identity[] groups = gss.ReadIdentities(SearchFactor.Sid, SIDS.Members, QueryMembership.None);
var query = from _group in groups
where _group.Type == IdentityType.ApplicationGroup
select _group;
combo_groups.ItemsSource = gss.ListApplicationGroups(Project.Uri);
}
Step 4: Get User List by Group
After you select a group from the combobox this method will obtain all Users from that application group.
void DefineGroupUsers()
{
if (combo_groups.SelectedItem != null)
{
Identity group = combo_groups.SelectedItem as Identity;
//Perform new search based on Sid and from the selected Group.
Identity SIDS = gss.ReadIdentity(SearchFactor.Sid, group.Sid, QueryMembership.Expanded);
//Read the users related to that group.
if (SIDS.Members.Length > 0)
{
Identity[] UserIds = gss.ReadIdentities(SearchFactor.Sid, SIDS.Members, QueryMembership.None);
list_group_users.ItemsSource = UserIds;
}
else
list_group_users.ItemsSource = null;
}
}
Step 5: Add and Remove User From Application Group
Now we getting to the important part – Adding and Removing Users from Groups.
User IGroupSecurityService object this is very easy task – just call RemoveMemberFromApplicationGroup method to remove user from group with the group Sid and User Sid, same goes for Adding a User.
private void btn_remove_Click(object sender, RoutedEventArgs e)
{
if (list_group_users.SelectedItem != null && combo_groups.SelectedItem != null)
{
Identity user = list_group_users.SelectedItem as Identity;
Identity group = combo_groups.SelectedItem as Identity;
//Remove User to Specific Application Group
gss.RemoveMemberFromApplicationGroup(group.Sid, user.Sid);
//Refresh Users List
DefineGroupUsers();
}
}
private void btn_add_Click(object sender, RoutedEventArgs e)
{
if (combo_groups.SelectedItem != null && list_users.SelectedItem != null)
{
Identity user = list_users.SelectedItem as Identity;
Identity group = combo_groups.SelectedItem as Identity;
//Add User to Specific Application Group
gss.AddMemberToApplicationGroup(group.Sid, user.Sid);
//Refresh Users List
DefineGroupUsers();
}
}
Download Demo Project
Enjoy
My Lecture at The Yearly Convention For QA – Israel
Yesterday I had the honor to be one of the presenters giving presentations on one of the most important conventions for the QA community. (Home Site)
There were over 400 people from all over the industry that came to hear about what new and the future of Testing.
I gave a lecture about the new Testing tool from Visual Studio 2010 called – Microsoft Test Manager, After my lecture I talked with many many people who were impressed by the new tool abilities and asked how to get started using this tool, So here is my additional summary to my Lecture:
- Test Professional License and Information Page
- Download and Try – Visual Studio Home Page
- Do It Yourself
- Just Run
- The Best way to work with MTM is to download a complete environment with TFS 2010 Installed and Microsoft Test Manager
Download Complete VPC
- Moving to Microsoft Test Manager – Migration Doesn’t Have To Be Painful – Scrat = Quality Center To TFS 2010 Migration Tool
- Automation – More Information about Test Automation from my Blog.
- Microsoft Test Manager
Thanks to Yaron Tsubery, ISTQB president for outstanding convention and Every one who participate.
Hope to see everyone next year!
Sela - “Web Test Manager” Announcement in ALM Summit
As you may know – Sela is a gold sponsor in ALM Summit (http://www.alm-summit.com/almsummit/sponsors.aspx),


during the summit we revealed our latest developments for TFS/VS 2010 and Microsoft Test Manager.
- – Merge By Work Item
- – Quality Center 2 TFS 2010 Migration
-
*NEW* - “Web Test Manager”
– Web Access For "Microsoft Test Manager”
”Web Test Manager” – Will allow Testers, Developers and each and every one on the Team to Write, Edit and Run Test Cases from the Web – No Special Installation Required.


How To: "Unable to load DLL 'Microsoft.VisualStudio.QualityTools.RecorderBarBHO100.dll': The specified module could not be found"
Working on a new environment trying to perform an new Web Test I was faced two issues:
1. Web Test Recorder doesn’t show up
Problem :When I start my recording Internet Explorer comes up but the Web Test Recorder doesn’t show up.
Solution: In IE enter Tools menu Select Explorer Bars and Click “Web Test Recorder 10.0” – (This will work for Web Test 8.0 and 9.0)

2. Cannot Stop Web Test Recording Without Getting Exception

Problem: When I clicked “Stop” in the end of Web Test Recording I get the following Exception: "Unable to load DLL 'Microsoft.VisualStudio.QualityTools.RecorderBarBHO100.dll': The specified module could not be found"
Solution:
Copy Microsoft.VisualStudio.QualityTools.RecorderBarBHO100.dll (For older versions RecorderBarBHO90.dll etc)
Located under C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\
To - C:\Program Files\Internet Explorer and for 64bit machines also Copy To - C:\Program Files (x86)\Internet Explorer
Enjoy
TFS API Part 31 – Working With Queries – Part 2
In my last post TFS API Part 30 – Working With Queries I demonstrate a simple API example for getting Queries from TFS 2010, in this sample I’ll show how to run Queries and display the results, Deleting and Creating new Folder using TFS API.

Download Demo Project
Step 1: Add Results
Using WorkItemStore object and call the Query method you can set the results directly to DataGrid.
void item_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
TreeViewItem item = (TreeViewItem)sender;
QueryDefinition q_def = (QueryDefinition)item.Tag;
string q = q_def.QueryText;
txt_query.Text = q;
///Repleace all @ because this code runs outside of Visual Studio environment.
dataGrid1.ItemsSource = Store.Query
(q.Replace("@project", "'" + ProjInfo.Name + "'").
Replace("@Me", "'" + Environment.UserName + "'"));
dataGrid1.UpdateLayout();
}
Step 2: Add and Remove – Queries and Folders
private void btn_add_Click(object sender, RoutedEventArgs e)
{
if(Queries.SelectedItem != null && !string.IsNullOrEmpty(textBox1.Text))
{
TreeViewItem tree_item = (TreeViewItem)Queries.SelectedItem;
QueryItem q_item = (QueryItem)tree_item.Tag;
if (q_item.GetType() == typeof(QueryFolder))
{
QueryFolder folder = q_item as QueryFolder;
folder.Add(new QueryFolder(textBox1.Text));
textBox1.Text = string.Empty;
BuildQueryHierarchy(Store.Projects[ProjInfo.Name].QueryHierarchy);
}
else
{ MessageBox.Show("Cannot Add Folder Under Query Definition"); }
}
}
private void btn_remove_Click(object sender, RoutedEventArgs e)
{
if (Queries.SelectedItem != null)
{
TreeViewItem tree_item = (TreeViewItem)Queries.SelectedItem;
QueryItem q_item = (QueryItem)tree_item.Tag;
if (q_item.GetType() == typeof(QueryFolder))
{
QueryFolder folder = q_item as QueryFolder;
folder.Delete();
}
else if (q_item.GetType() == typeof(QueryDefinition))
{
QueryDefinition query_def = q_item as QueryDefinition;
query_def.Delete();
}
BuildQueryHierarchy(Store.Projects[ProjInfo.Name].QueryHierarchy);
}
}
Download Demo Project
Coded UI Editor – Guide
Feature Pack 2 is Available! and it’s Awesome!
The feature pack comes with some great features and the one I want to talk about in this post is – Coded UI Test Editor.
I’ve recorded a simple CUIT on Windows Calculator that adds to numbers and show the result.
Getting Started
After you install the Feature Pack 2 you will notice that Double Click or Right click on “UIMap.uitest” file will open a new window contains all CUIT Actions.

The new screen contains the Method Names (When you generate the code), the actions under each Method and on the right you can see the controls relate to those method.

Method Properties
While selecting the Method you may perform the following Actions:

- Find the method use in the entire CodedUI Test.
- Delete those Method – (Next Time you Generate the CUIT this method will not be Generate)
- Change Method Name.
- Move the Method to UIMap.cs –Why? Very good questions – Any code Changes you will make in “UIMap.Designer.cs” will be overwritten once you generate new code for the CUIT.
The result of moving the code will be a follow:

Action Properties
While selecting the Method you may perform the following Actions:

- Properties – For each action you can modify the properties.
Foe example – Change Mouse action to Double Click instead of Click. - Split into a new method

- Inset Delay Before – The delay in milliseconds

Controls Properties
During the CUIT Code Generation each control contain the search properties in order to identify that control during playback – those properties called “Search Criteria”.
Until today those search criteria was static and cannot be change without code customizations, now using Coded UI Editor you can define what are the properties you wan to use in order to Define you control in the best way!

Example – Very common scenario for recording applications using CUIT is the Window Title, the window title isn’t static and can be change and this can herm CUIT playback.
Using Coded UI Editor you can change that criteria or add new criteria for identifying that window not just by the Title.

To Improve CUIT playback performance you can add more “Search Criteria” to help CUIT to identify the control faster.

Enjoy
TFS API Part 30 – Working With Queries
TFS 2010 comes with new abilities for Queries that allows you to define Hierarchy and Direct Links (Read More - Work Item Relations (Visual)).
This is the first post on that subject and this will show how to interact with TFS 2010 Queries – Filter, View and Create New using TFS 2010 API.

Download Demo Project
Step 1: Create Project and Add Reference
Create an WPF/WinForm application and add the following references:
- using Microsoft.TeamFoundation.Client;
- using Microsoft.TeamFoundation.Server;
- using Microsoft.TeamFoundation.WorkItemTracking.Client;
All files located under - c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0\
Step 2: Connect to Team Foundation Server
(TFS API Part 20: Bye TeamFoundationServer and Welcome TfsTeamProjectCollection)
TeamProjectPicker pp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject,false);
pp.ShowDialog();
if (pp.SelectedProjects.Length > 0)
{
Tfs = pp.SelectedTeamProjectCollection;
ProjInfo = pp.SelectedProjects[0];
Store = (WorkItemStore)Tfs.GetService(typeof(WorkItemStore));
BuildQueryHierarchy(Store.Projects[ProjInfo.Name].QueryHierarchy);
}
Step 2: Define Queries Hierarchy in TreeView
Each project (TFS 2010) contains an object called QueryHierarchy contains the entire Hierarchy for that project.
/// <summary>
/// Getting Project Query Hierarchy and define the the folders under it.
/// </summary>
/// <param name="QueryHierarchy"></param>
void BuildQueryHierarchy(QueryHierarchy QueryHierarchy)
{
TreeViewItem root = new TreeViewItem();
root.Header = ProjInfo.Name;
foreach (QueryFolder query in QueryHierarchy)
{
DefineFolder(query, root);
}
Queries.Items.Add(root);
}
/// <summary>
/// Define Query Folders under TreeView
/// </summary>
/// <param name="query">Query Folder</param>
/// <param name="father"></param>
void DefineFolder(QueryFolder query, TreeViewItem father)
{
TreeViewItem item = new TreeViewItem();
QueryTypes type = QueryTypes.Folder;
if (query.IsPersonal) type = QueryTypes.MyQ;
else if (query.Name == "Team Queries") type = QueryTypes.TeamQ;
item.Header = CreateTreeItem(query.Name, type);
father.Items.Add(item);
foreach (QueryItem sub_query in query)
{
if (sub_query.GetType() == typeof(QueryFolder))
DefineFolder((QueryFolder)sub_query, item);
else
DefineQuery((QueryDefinition)sub_query, item);
}
}
/// <summary>
/// Add Query Definition under a specific Query Folder.
/// </summary>
/// <param name="query">Query Definition - Contains the Query Details</param>
/// <param name="QueryFolder">Parent Folder</param>
void DefineQuery(QueryDefinition query, TreeViewItem QueryFolder)
{
TreeViewItem item = new TreeViewItem();
QueryTypes type;
switch (query.QueryType)
{
case QueryType.List: type = QueryTypes.FView; break;
case QueryType.OneHop: type = QueryTypes.DView; break;
case QueryType.Tree: type = QueryTypes.HView; break;
default: type = QueryTypes.None; break;
}
item.Header = CreateTreeItem(query.Name, type);
item.Tag = query.QueryText;
item.MouseDoubleClick += new MouseButtonEventHandler(item_MouseDoubleClick);
QueryFolder.Items.Add(item);
}
Download Demo Project
Feature Pack 2 is Available!
Brian Harry just release a post about the new Feature pack for the Testing area in Visual Studio 2010 and Microsoft Test Manager:
- Silverlight Support
Now you can test your Silverlight apps as well as your other desktop applications. We’ve added support both for coded UI tests and for record and playback in Microsoft Test Runner (part of Microsoft Test Professional). You are able to record the execution of your Silverlight app and gather rich bug data (including action logs, video, environment info and more). Unfortunately, you can’t get Intellitrace logs at this time. We’ve tested it on a range of Silverlight apps, including ones with customer controls and apps generated by LightSwitch. We are waiting on a few fixes for LightSwitch issues we discovered – they should be available in the next LightSwitch pre-release.
- Firefox Playback
With our Visual Studio testing tools today, you can record and playback web applications in Internet Explorer. With Feature Pack 2, you can play back those recordings on FireFox as well. As with our Silverlight support, it applies to both Coded UI tests created with Visual Studio and automation recordings created with Microsoft Test Professional.
Among other things, this will enable you to create a set of tests once and use them to regression test on both IE and FireFox! Now you can make sure your changes don’t break apps across multiple browsers.
- Coded UI Test Editor
Managing your coded UI test has just gotten easier. In VS 2010, a coded UI test is generated as an XML description and some code. Neither is particularly easy to approach if you want to make some minor tweaks to your test – like change how a control you are testing is identified or remove a superfluous UI gesture, etc. The new coded UI test editor in Feature Pack 2 makes tweaking and customizing your recorded tests MUCH easier. The test editor is accessed by opening the UIMap.uitest item in solution explorer (the coded UI test editor is the designer for it and opens automatically). Below is a picture of the main designer window. On the left is a list of the actions that were recorded. You can edit them and their properties. On the right is a hierarchy of all of the controls that were used. You can edit those too (for example, changing the properties used to identify the controls).
Download Page
Enjoy
Tech-Ed 2010 – Applied Software Testing with Visual Studio 2010 – All In One
Teched Israel 2010 is going to happen next month in Eilat between the 28-30 of November.
On this Teched I’ll have the pleasure to present a session about Applied Software Testing with Visual Studio 2010
In this session I’ll demonstrate how to use the following:
- Microsoft Test Manager – Fast Forward Automation
- Web Performance Testing
- Load Testing
- Coded UI Testing
Why? So YOU can do Automatic and Load Testing by yourself!!!
This is All In One session and if you want to know more about Testing in Visual Studio 2010 you should be there!
http://www.microsoft.com/israel/TechEd2010/Tracks/ALM.aspx
More Lectures I’ll recommend you to go: (Sela Collage Speakers)



Team Explorer Everywhere 2010 SP1 Beta is available for download!
Brian Harry just post about the new SP1 for TEE - http://blogs.msdn.com/b/bharry/archive/2010/11/03/team-explorer-everywhere-2010-sp1-beta-is-available-for-download.aspx.
The highlights of the Team Explorer Everywhere 2010 SP1 Beta will be:
-
Fully localizable product.
-
Full Gated check-in support for TFS 2010.
-
Support for rich work item descriptions
-
A bunch of bug fixes and other improvements.