May 2011 - Posts
A week ago I blogged about Quality Center 11 and Test Director are Now Supported by Scrat and did a MSDN Webcast on how to migrate Quality Center to TFS 2010.
In this webcast, learn how to use the Scrat Migration Tool (Download) from SELA Group to migrate defects, requirements, test cases, attachments, and links between the items from HP Quality Center to Microsoft Visual Studio Team Foundation Server 2010 in seconds.
View the video - Download PowerPoint Slides

Event Page - http://www.microsoft.com/events/podcasts/default.aspx?topic=Topic-bc030dfe-9889-4267-a71f-58572317c4f1&pageId=x9028&source=Microsoft-Visual-Studio-2010-Podcasts&WT.rss_ev=a
Download: WMA | MP3 (44 min)
Download Scrat
Enjoy
I’ve released another Game for Windows Phone 7, The game available in the Market for Download (Free).
Just Search for “Puzzle 15”
There are three modes of Puzzle 15 you can compete:
If you have more cool ideas please let me know and I’ll add them to the game.
Enjoy!
Since 2009 I ‘m writing about TFS API and several people asked to get an index page with all parts related to TFS API, so here is it:
Basic
Source Control
Testing
Work Items – Definitions and Queries
Areas and Iterations
Builds
This is the last of series of 3 about manipulating Build Controllers (TFS API Part 35 – Create Build Controllers), Agents and Definitions (TFS API Part 36 – Create Build Definitions) and now I’ll complete the series with a demonstration on how to create a new Build and set the Result using TFS API.
This can assist you in building Fake definition in order to publish tests or setting a test environment much more easily.
Download Demo Project


As you can see from the picture above you can define the Build Name and Status and the result will appear under the Build Definition in TFS.

Step 1: Define “Update Build Information” Permissions
Before you can do any manipulation on the Build item you need to have the proper permissions, in Team Explorer under the desire Team Project go to the Builds node and Right Click –> Security
There make sure you user or group have the “Update build Information” box checked.

Step 2: Create New Build
The BuildDefinition item has CreateManualBuild method that will serve us for creating new Build.
private void BtnAddBuildClick(object sender, RoutedEventArgs e)
{
if (listAddDefinitionBuildDefinitions.SelectedItem == null) return;
if(string.IsNullOrEmpty(txtBuildName.Text) || string.IsNullOrEmpty(txtLocalPath.Text) ||
string.IsNullOrEmpty(txtServerPath.Text) || comboBuildStatus.SelectedItem == null)
{
MessageBox.Show("Please make sure the following fields has valid value:\n1.Build Name\n2.Local Path\n3.Server Path\n4.Status",
"Missing Values", MessageBoxButton.OK, MessageBoxImage.Information);
return;
}
try
{
var buildDefinition = (IBuildDefinition)listAddDefinitionBuildDefinitions.SelectedItem;
IBuildDetail buildDetail = buildDefinition.CreateManualBuild(txtBuildName.Text);
IBuildProjectNode buildProjectNode = buildDetail.Information.AddBuildProjectNode(
DateTime.Now.AddSeconds(10), // Finish Time = The time at which the project finished building.
comboFlavor.SelectedValue.ToString(), //Flavor = The flavor (configuration) the project was built for.
txtLocalPath.Text, //Local Path = The local path of the project file.
comboPlatform.SelectedValue.ToString(), //Platform = The platform the project was built for.
txtServerPath.Text, // Server Path = The server path of the project file.
DateTime.Now, //Start Time = The time at which the project was built.
"default"); //Target Name = The targets for which the project was built.
buildProjectNode.Save();
buildDetail.FinalizeStatus((BuildStatus)comboBuildStatus.SelectedItem);
ClearAddBuildForm();
}
catch (AccessDeniedException accessDeniedException)
{
MessageBox.Show(accessDeniedException.Message, "Access Denied Exception", MessageBoxButton.OK, MessageBoxImage.Error);
}
catch (BuildNumberAlreadyExistsException buildNumberAlreadyExistsException)
{
MessageBox.Show(buildNumberAlreadyExistsException.Message, "Build Number Already Exists Exception", MessageBoxButton.OK, MessageBoxImage.Error);
}
catch (InvalidFinalStatusException invalidFinalStatusException)
{
MessageBox.Show(invalidFinalStatusException.Message, "Invalid Final Status Exception", MessageBoxButton.OK, MessageBoxImage.Error);
}
finally
{
listBuilds.ItemsSource = ((IBuildDefinition)listAddDefinitionBuildDefinitions.SelectedItem).QueryBuilds();
}
}
Step 3: Query Builds from Build Definition
Using the QueryBuilds method in IBuildDefinition will bring back all Build under that specific Build Definition.
private void ListAddDefinitionBuildDefinitionsSelectionChanged(object sender, SelectionChangedEventArgs e)
{
if(listAddDefinitionBuildDefinitions.SelectedItem == null) return;
listBuilds.ItemsSource = ((IBuildDefinition) listAddDefinitionBuildDefinitions.SelectedItem).QueryBuilds();
}
Step 4: Remove Build
IBuildServer allow you to call the DeleteBuilds method with the Builds you want to delete.
private void BtnRemoveBuildClick(object sender, RoutedEventArgs e)
{
if (listBuilds.SelectedItem == null) return;
_buildServer.DeleteBuilds(new IBuildDetail[] { (IBuildDetail)listBuilds.SelectedItem });
listBuilds.ItemsSource = ((IBuildDefinition)listAddDefinitionBuildDefinitions.SelectedItem).QueryBuilds();
}
Brian Harry just post about Java SDK for TFS
The TFS SDK for Java includes the following:
- A redistributable JAR file containing the TFS API’s. This is a the same Java code that is used by Team Explorer Everywhere in the TFS plug-in for Eclipse and the Cross-platform command line client. It provides access to version control, work item tracking, build and other functionality in TFS from your own Java based application. We ship this as a single JAR file containing all the code and Java dependencies to make is easy to include in your own applications.
- The native code libraries used by the TFS API. We have a small amount of JNI code in the API to handle functionality that is not natively supported in Java on all the platforms that we support (such as access to Kerberos for authentication, or integrating with Keychain on the Mac). We are making this native code available, also redistributable and compiled for Windows (x86, x64), Mac (Universal), Linux(x86, x64, ppc), HP-UX (ia64_32, pa_risc), Solaris(sparc, x86, x64) and AIX (ppc).
- Full API documentation in Javadoc format. This is the same code documentation used by our developers, written by our developers.
- Code Samples. The team are very aware that getting started with this large code base can be quite a challenge, therefore they have put together a bunch of sample code to try and get you started. It includes:
- Sample custom check-in policy
- Sample custom work item controls (including a Radio Button control, Simple Button control, File Source drop-down and a sample External Source drop-down)
- A set of sample console applications utilizing build and version control capabilities
- A series of simple snippets demonstrating many aspects of the API including Work Items, Version Control and Build access.
- Instructions for building and an Ant based build script to get you started.
The license terms for the SDK are here
Read The Full Article
In my last post TFS API Part 35 – Create Build Controllers I showed how to create Build Controllers using TFS API, this can help create a Fake Build and publish test results outside TFS.
This post continue the coding from me previous post, and shows how to create or delete Build Definitions under a specific Team Project.
Download Demo Project

Step 1: Obtain Build Process Templates and Existing Definition from Team Project
private void ListDefinitionsTeamProjectSelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (listDefinitionsTeamProject.SelectedItem == null) return;
comboProcessTemplates.ItemsSource = _buildServer.QueryProcessTemplates(
((Project)listDefinitionsTeamProject.SelectedItem).Name);
listAddDefinitionBuildDefinitions.ItemsSource = _buildServer.QueryBuildDefinitions(
((Project)listDefinitionsTeamProject.SelectedItem).Name);
}
Step 2: Add New Build Definition
private void BtnAddDefinitionClick(object sender, RoutedEventArgs e)
{
if (listDefinitionsTeamProject.SelectedItem != null && listTfsControllers.SelectedItem != null)
{
if (string.IsNullOrEmpty(txtDefinitionName.Text) || string.IsNullOrEmpty(txtDropLocation.Text) ||
comboProcessTemplates.SelectedItem == null)
{
MessageBox.Show(
"Please make sure the following fields has value:\n1.Definiton Name\n2.Drop Location\n3.Process Template",
"Missing Values", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
try
{
var proj = (Project)listDefinitionsTeamProject.SelectedItem;
var controller = (IBuildController)listTfsControllers.SelectedItem;
//Create new instance of build definition under the Team Project.
var definition = _buildServer.CreateBuildDefinition(proj.Name);
definition.Name = txtDefinitionName.Text;
//Define Build Definition Trigger - // All, Batch , Gated, Individual, None, Schedule, ScheduleForced
definition.ContinuousIntegrationType = (ContinuousIntegrationType)comboContinuousIntegrationTypes.SelectedItem;
//Define Build Controller
definition.BuildController = controller;
definition.DefaultDropLocation = txtDropLocation.Text;
definition.Description = txtDescription.Text;
definition.Enabled = (bool)chxIsEnabled.IsChecked ? true : false;
//Create a fake workspace folder
definition.Workspace.AddMapping("$/", "c:\\someFakeFolder", WorkspaceMappingType.Map);
//Assign the Process Template for the new build definition
definition.Process = (IProcessTemplate)comboProcessTemplates.SelectedItem;
definition.Save();
//Refresh the Build Definitions List
listAddDefinitionBuildDefinitions.ItemsSource = _buildServer.QueryBuildDefinitions(((Project)listDefinitionsTeamProject.SelectedItem).Name);
}
catch (BuildServerException ex)
{
MessageBox.Show(ex.Message, "Opps", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
}
Step 3: Remove Build Definition
private void BtnRemoveDefinitionClick(object sender, RoutedEventArgs e)
{
if (listAddDefinitionBuildDefinitions.SelectedItem == null) return;
_buildServer.DeleteBuildDefinitions(new IBuildDefinition[] { (IBuildDefinition)listAddDefinitionBuildDefinitions.SelectedItem });
listAddDefinitionBuildDefinitions.ItemsSource = _buildServer.QueryBuildDefinitions(((Project)listDefinitionsTeamProject.SelectedItem).Name);
}

Download Demo Project
I’m happy to announce that Scrat (Quality Center To TFS 2010 Migration Tool) is now supporting all HP Quality Center Versions including the latest - Quality Center 11 (Application Lifecycle Management)
For more information please visit Sela ALM Tools page.
In couple of hours I’ll present Scrat in MSDN Web Cast (MSDN Webcast - Migrate Quality Center to Team Foundation Server 2010 Using...) and you can learn how to use Scrat to move all Quality Center Item to TFS 2010 in hours!
When: Registration
- Pacific Time –> Thursday, May 12, 2011 10:00 AM (GMT-08:00)
- Israel Time –> Thursday, May 12, 2011 08:00 PM (20:00) (GMT +02:00)
Scrat Product Page




S. Somasegar just blog about Bringing Windows Azure to more devices
The Windows Azure Toolkit for Windows Phone 7 is designed to make it easier for you to build mobile applications that leverage cloud services running in Windows Azure. The toolkit includes Visual Studio project templates for Windows Phone 7 and Windows Azure, class libraries optimized for use on the phone, sample applications, and documentation.
Released today, the Windows Azure Toolkit for iOS is designed to help developers targeting iOS to use Windows Azure services. It includes an open source Objective-C library to interface with Windows Azure services, documentation, and a sample application using the library. You can download the samples and documentation from github, along with the library and its source, or learn more about the details.
- Windows Azure Toolkit for Android
Android developers will have their own version of the toolkit available in preview form later this summer.
Full Article
In my previous post on TFS API is showed some basic actions for TFS Build API - TFS API Part 34– Build Basic Actions
In this series I’ll some some more cool things in Build 2010 API, the first thing is a simple flow on how to get the all build definitions from Team Projects, how to obtain the Build Controller from the definition and how to get the Build Agents available in each Controller.
Download Demo Project

Than we can move forward to how you can use TFS API to create and delete Build Controllers programmatically, even for Fake Controllers (I’ll take why later).

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.Build.Client
- Microsoft.TeamFoundation.Build.Common.dll
- Microsoft.TeamFoundation.dll
- Microsoft.TeamFoundation.WorkItemTracking.Client.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
private void BtnConnectTfsClick(object sender, RoutedEventArgs e)
{
using (var tpp = new TeamProjectPicker(TeamProjectPickerMode.NoProject, false))
{
tpp.ShowDialog();
if (tpp.SelectedTeamProjectCollection == null) return;
_server = tpp.SelectedTeamProjectCollection;
_server.EnsureAuthenticated();
listProjects.ItemsSource = ((WorkItemStore) _server.GetService(typeof(WorkItemStore))).Projects;
_buildServer = (IBuildServer)_server.GetService(typeof(IBuildServer));
listTfsControllers.ItemsSource = _buildServer.QueryBuildControllers();
tabControl.IsEnabled = true;
}
}
Step 3: Get Build Definitions From Team Project
Using the IBuildServer method called = QueryBuildDefinitions to get all build definitions be Team Project Name.
private void ListProjectsSelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (listProjects.SelectedItem != null)
{
listBuildDefs.ItemsSource = _buildServer.QueryBuildDefinitions(((Project) listProjects.SelectedItem).Name);
}
}
Than using QueryBuildControllers to get the Build Controller assign to a specific Build Definition.
private void ListBuildDefsSelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (listBuildDefs.SelectedItem != null)
{
//True to Include Agents for the Controller.
listControllers.ItemsSource =
_buildServer.QueryBuildControllers(true).Where(
b => b.Name.Equals(((IBuildDefinition) listBuildDefs.SelectedItem).BuildController.Name));
}
}
And Based on the Build Controller you can get all Agents under the Build Controller.
private void ListControllersSelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (listControllers.SelectedItem != null)
{
listAgents.ItemsSource = ((IBuildController) listControllers.SelectedItem).Agents;
}
}
And last thing is to Get the controller values.(The reason all lines are comment is the values are assigned from the XAML).
private void ListTfsControllersSelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (listTfsControllers.SelectedItem != null)
{
var controller = (IBuildController) listTfsControllers.SelectedItem;
//txtPort => controller.ServiceHost.BaseUrl.Port;
//txtMachineName => controller.ServiceHost.BaseUrl.Host;
//txtControllerName => controller.Name;
//txtServiceHostName => controller.ServiceHost.Name;
}
}
Step 4: Add New Build Controller
private void BtnAddControllerClick(object sender, RoutedEventArgs e)
{
try
{
//Creates a new service host with the specified name and base URL.
var serviceHost = _buildServer.CreateBuildServiceHost(txtMachineName.Text, new Uri("http://" + txtServiceHostName.Text + ":" + txtPort.Text + "/"));
serviceHost.Save();
//Creates a build controller that is associated with the current service host.
var controller = serviceHost.CreateBuildController(txtControllerName.Text);
controller.Save();
listTfsControllers.ItemsSource = _buildServer.QueryBuildControllers();
}
catch (BuildServiceHostAlreadyExistsException alreadyExistsException)
{
MessageBox.Show(alreadyExistsException.Message);
}
}
Step 5: Delete Build Controller
private void BtnRemoveClick(object sender, RoutedEventArgs e)
{
if (listTfsControllers.SelectedItem != null)
{
//Obtain the IBuildController and using IBuildServer calling the DeleteBuildControllers method.
var controller = (IBuildController) listTfsControllers.SelectedItem;
_buildServer.DeleteBuildControllers(new IBuildController[] {controller});
listTfsControllers.ItemsSource = _buildServer.QueryBuildControllers();
}
}
Download Demo Project
MSDN Webcast - Migrate Quality Center to Team Foundation Server 2010 Using Scrat (Level 300)
What is Scrat? - Scrat converts and migrates all of your HP Quality Center™ projects and items over to Microsoft Team Foundation Server 2010™.
The migration is quick, easy and a safe process that completes in just a few hours. Contrary to the manual migration traditionally employed by organizations, Scrat fully automates the process.
Scrat puts the control in your hands, Through an easy to manage wizard, the entire process is fully customizable.
You decide how, to what extent and where to migrate your projects. All of the QC elements (Requirements, Bugs, Test Cases, Attachments and Links between items) are accurately migrated to the TFS 2010™ including their interrelationships and links.
When
- Pacific Time –> Thursday, May 12, 2011 10:00 AM (GMT-08:00)
- Israel Time –> Thursday, May 12, 2011 08:00 PM (20:00) (GMT +02:00)
In this webcast, learn how to use the Scrat Migration Tool from SELA Group to migrate defects, requirements, test cases, attachments, and links between the items from HP Quality Center to Microsoft Visual Studio Team Foundation Server 2010 in seconds.
Register - https://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032480777&EventCategory=4&culture=en-US&CountryCode=US

WP7 - Data Between Pages – Part 1
In my last post about WP7 I talked about The Mask Way– Rating Control and More, but before I’ll jump to more cool stuff let’s start from the basics.
- How to transfer data between pages?
- How to shared data for the entire WP7 application?
- And of course how to retaining data across instances?
Download Demo Project

This is the first post of two about Passing Data Between Pages in WP7.
Query String
Query string is the part of a Uniform Resource Locator (URL) that contains data to be passed to web applications.
Passing Data using WP7 Query String Format it’s that same as HTML Query String.
I’ve created a Const class to obtain my strings:
public class Const
{
public static string TextTag = "Text";
public static string BoldTag = "IsBold";
}

Source Page:
Using NavigationService to navigate to Destination Page with our Query String – /Page.Xaml?Param1=Value1&Param2=Value2
private void BtnQueryDemoClick(object sender, RoutedEventArgs e)
{
var queryData = string.Format("?Text={0}&IsBold={1}", txtQueryData.Text, chxIsBold.IsChecked);
NavigationService.Navigate(new Uri("/QueryData.xaml" + queryData, UriKind.Relative));
}
Destination Page:
In order to receive those parameters you need to override the OnNavigatedTo method and use the NavigationContext to obtain the QueryString.
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
var data = this.NavigationContext.QueryString;
if (data.ContainsKey(Const.TextTag))
txtMain.Text = data[Const.TextTag];
if (data.ContainsKey(Const.BoldTag))
txtMain.FontWeight = Convert.ToBoolean(data[Const.BoldTag]) ? FontWeights.Bold : FontWeights.Normal;
base.OnNavigatedTo(e);
}
Static Data
Always remember that each and every page in your WP7 application has convenient access to App class that derives from Application and have static property called – Application.Current.
So you can Cast this App class from any page and use it to store and get data.
For Example I’ve created one public property – SharedText (string)
public partial class App : Application
{
public string SharedText { get; set; }
public App()
{
SharedText = "Hello World!!!!";
In my Test Page I’ve override the OnNavigatedTo and cast an App from Application.Current.
Using the App I can get my Static Property and set the value to the TextBox (txtMain)
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
var app = (Application.Current as App);
txtMain.Text = app.SharedText;
base.OnNavigatedTo(e);
}

Now, when I click the “Set Data & Move”, I’m using the same concept but instead of Get the property I’m setting a new value.
private void BtnMoveClick(object sender, RoutedEventArgs e)
{
var app = (Application.Current as App);
app.SharedText = txtMain.Text;
NavigationService.Navigate(new Uri("/StaticData.xaml", UriKind.Relative));
}
In the Destination Page you will see:

And the Code behind is the same:
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
var app = (Application.Current as App);
txtMain.Text = app.SharedText;
base.OnNavigatedTo(e);
}
In the next post I’ll talk about Isolated Storage and Phone States.
Download Demo Project
Enjoy.