2010 Launch

The 2010 Launch event was last night at Ultra on Queen West. Great event, thanks MS for putting it on. There were lots of folks out to help celebrate.

VS2010 Launch 020 by Jules in Toronto.



Now to get ready for the next launch event.

on April 22nd ObjectSharp and Microsoft co-present Visual Studio 2010 At the Movies.

This is a free full day event from the best instructors in the business.

ironman spaceballs torontosfinest wizards

Microsoft Sync & MyKey

I recently purchased a new car. I had been thinking about it and a deal came up that was too good to pass up. 0% financing, free MS Sync were just two of the carrots I followed into the dealership.

I bought a 2010 Ford Focus. If you are like me you might have thought the focus was a low end, small car like the chevette back in the day. :) Well I’m hear to tell you that is not the case. For a very reasonable price (I am very cheap when it comes to cars) I bumped up to the SES model. It has loads of great options. I wanted to Blog about two of them.

Cool Option Number 1: Mykey

Mykey allows me to program driving instructions based on the key that is used in the car. I can program the car so that when the spare key is used:

  • The seat belt reminder can not be turned off
  • Audio is muted until the seat belt is buckled
  • Audio volume can be limited
  • Vehicle Speed can be limited
  • There are audible and visible warnings for both low fuel and speed thresholds

Teenagers everywhere are cringing at the thought of this feature. :)

Cool Option Number 2: Microsoft Sync

I had heard a lot about MS Sync but never really knew what features it had. I have just started playing with it, but so far it’s very nice. Let me begin by saying the controls are all on the steering wheel which is a great feature. What can MS Sync do?

  • Hands Free Calling
  • You can search through Contact List, missed calls, incoming calls outgoing calls.
  • Have it read you text messages to you
  • Automatic Text message responses like
    • Can’t talk right now
    • Call you later
    • I’m stuck in traffic
    • CU in 20 minutes
    • CU in 10 minutes
    • Where R you?
    • Call me
  • Verbally search for and select music to play on your IPod plugged into the USB port
  • Charge your phone via the USB port
  • 911 Assist (I haven’t used this yet, hopefully I never have to)

I really like my MS Sync.

Branching & Merging in 2010

Branching & Merging has always been difficult. I have worked with teams who go out of their way not to branch the code. However sometimes it’s just necessary. Thanks to the Software Engineers at Microsoft it’s much easier now in TFS 2010 Source Control. I don’t mean easier (less key strokes) I mean easier because a Branch is now a first class citizen and there are ways to visualize what change sets have made it into which branches.

Let me show you what I mean.

Lets take a simple application like my calculator and create two branches of the code for the purpose of code promotion. Some source control tools have the concept of a promotion model. Which works kind of like static labels. Code can be promoted from development to QA and Production branches. Dev QA and Production act like labels but there is only ever one Dev, QA and Production promotion level at a time. We can use branching to achieve this. I’m not promoting this method as the way you should promote code, I’m just using it as an example for branching because I think it’s pretty easy to get your head around.

To start I’ll take my Calculator solution and create two branches in source control called QA and Prod. Right click on the project folder in Source control and select Branching and Merging | Branch…


On the branch dialog enter the name of the target branch.


Create two, one named QA and one named Prod. You will also be asked to create a local folder if you leave the option checked to store it on your local workspace. Don’t forget this operation is a local change and you will have to check in your changes to make it permanent.

Once all is complete you should have the following in Source control.


So here we have the Calculator main branch and of course the two promotion branches Prod and QA. Right click on Calculator and select Branching and Merging | View Hierarchy from the popup menu. This will give you a view of the relationships between branches.


Right click on the main branch and select Properties from the popup menu. The properties dialog contains information about the branch including relationships to other branches and permissions. This is where you can denote who has the rights to promote to a particular branch.


We can use the History View to visualize which branches a changeset has been promoted to. Here are the changesets checked into the my calculator.


If you right click on one of the changesets we can see how it has been promoted through the branches. Lets take this bug fix for example. I’ll write click on it and select Track Changeset from the popup menu.

Next we select which branches we want to look at.


Click on Visualize to see which branches this Changeset is in. From the Visualizer switch to Timeline Tracking to get this view.


We can see that the changeset has been promoted to both branches. Therefore Changeset 13, 15 and 16 are the same.  Select a changeset and you will see the date and time the changeset was merged into the branch at the top highlights in yellow.

Now try this. Make a change in the base branch then open the visualizer and drag the base branch to one of the other branches this will merge the changeset into the branch you drop it on. Then check in your merge and refresh your visualizer.

Happy Branching and Merging.

Generate a Data Driven Coded UI Test from an Action Recording

One of the very cool new features of VS 2010 and TFS is the ability to turn a manual test into an Automated UI test. As if that wasn’t cool enough how about making it Data Driven and bind it to the original Test Case created by QA.

Using the new Test Manager that comes with VS Ultimate 2010 your test team can create Test Cases using parameters instead of hard coded data values. This allows the manual test to be executed over multiple iterations and validate several scenarios using just one Test Case.

If you have such a Test Case stored in TFS it will look something like this.


Notice the @Value1, @Value2 and @Result under the Action and Expected Result. They represent parameters whose values that are listed below, the steps.

Assuming the test team executed this Test Case and created an Action Recording. Which means they let Test Manager record their actions while they ran through a manual test of the application. During the manual test and subsequent recording they will have easily, and possibly without even knowing it bound the Parameters to controls in the application.

From this you can create a Coded UI Test that you can use in part of your arsenal of automated tests against the User Interface.

Here is what you need to do.

Open the Test Project where you want to store the Coded  UI Test. And select Test | New Test… from the Visual Studio menu. On the New Test dialog select Coded UI Test, name it and select the test project to add it to.


As the test is being added to the project you will be prompted with a choice to either Record this test yourself of use an existing action recording. Select Use an existing action recording.


Next you will be prompted to select a test case. Find and select the test case created by your QA team that contains Parameters and an action recording discussed earlier.

The Coded UI test will be generated for you. Minus the Assertions, we’ll add those ourselves.

You should end up with a Multiplytests class that contains a CodedUITestMethod1(). Rename the method to something more appropriate. In my case I will name it MultiplyTestMethodUI().

The method will look something like this.


Notice the reference to Value1 and Value2.

We need to add the assertion to this test.

Place the cursor on a blank line just before the CloseCalc() method call, right click and select Generate Code for Coded UI Test | Use Coded UI Test Builder… from the popup menu.

Visual Studio will minimize and you will see the Coded UI Test Builder.


Open the Application and drag the cross hair to the control you want to use to validate the result. In my case it’s the Answer Text Box. You will be presented with a property grid for this control. Select the Text property.


Click the Add Assertion button on the property grid toolbar and select AreEqual as the comparator and some value. Then click OK.


Click Alt+ G to generate the code for the assertion, when prompted enter a name for the method and click Add and Generate. Stop your recording by clicking on the X in the Coded UI Test Builder. We could have done this all manually. I’m all for letting the tool do it for me. :)

You will notice back in your test method a call will be added to the assertion method you generated.

At this point we want to set the expected value for the assertion to the result from the test case.

Insert a line just before the AssertMultiplicationTest method call and insert the following code.

this.UIMap.AssertMultiplicationTestExpectedValues.UIAnswerTextBoxEditText – TestContext.DataRow[“result”].ToString();

Save and build your solution. Open the Test View window and execute the new Coded UI Test you just created.

Check the test results to see a pass for each Data Row.


Take a look at the DataSource Attribute on your test method. It’s pointing back to Test Case 11. Therefore if the test team adds scenarios to their test case your Coded UI Test will run those scenarios also.

Happy New Year

It’s been over a month since I wrote an blog entry. I have reasons, Christmas, time off, New Years. I paved my main machine too, it was time. Put a fresh install of Windows 7 on a brand new Solid State Drive. It’s crazy fast. Of course that means fresh installs of everything. Everyday software gets installed first and then I move on to secondary stuff that I don’t use everyday, like Live writer. 

I am going to try and get out more Blog entries on what's new in 2010. At the moment I am pretty busy. Besides helping with day to day business. I have several presentations coming up.

  1. Today Adam Gallant and I are doing a Web Cast titled Quality Assurance in VSTS 2010.
  2. On January 21st Jeff Zado  and I will be in Waterloo to discuss Better Application Lifecycle Management with VS 2010
  3. On January 27th Deb Forsyth and I will be at the CTTDNUG in Kitchener presenting What’s new in TFS 2010

I also have Several ALM Assessments to do, plus Deb and I are writing some new courses. TFS 2010 for QA and TFS 2010 for Developers.

I’ll get back into the swing of a regular Blog entry sometime this week.

Build Process Templates

Making a build script do exactly what you want is easier with 2010?

When setting up a build there has always been a separation of concerns.

  • The Build Definition
  • The Build Process

Creating the build definition is much like you are use to in 2008. Right click on the builds node in the Team Explorer and select New Build Definition. It’s no longer a modal wizard, however it’s the same of information.

  • Name and Description

  • How you want the build to be triggered

  • Working folders

  • Build Server and Drop Location

  • Retention Policy

However there is a big difference, and it relates to the separation of concerns I mentioned above. In 2008 you could create a project file, that you would later have to edit to get the build to do anything extra ordinary. When you hit create on the project file tab you would be launched into another wizard that allowed you to select the solution to build, the type of configuration you wanted to build, weather or not you wanted tests executed against the build and or static code analysis performed.

In 2010 the Process tab contains a type of property grid which allows you to change the configuration of the build. This grid is organized into 3 sections Required, Basic and Advanced, allowing you to specify the solutions to build, define the build number, how to deal with tests and code analysis, weather or not to perform test impact analysis or label the source at this build to name just a few.

Where is all this defined? How would I add extra functionality to my build? What if I wanted to replace a dev.config with a test.config or deploy extra files to the drop location?

At the top of this tab is a show details expander.


After expanding this area you will  be able to select from a list of Build Process Templates.


Each template can contain different build processes. Beta2 comes with three templates to get you going. Click New to create your own by selecting a XAML file you have already created a placed in source control, or copy one of the existing templates as a starting point. You will notice also that you can store your Build Template anywhere in source control. In previous versions they only ever existed in one place under source control.

With 2010 you can create a build using the default template, which will likely do most, and more likely all of what you need it to do. In my experience most teams do not customize their project build files so for them the default template will suffice.

If you do want to make changes to your Build process you no longer have to edit a confusing poorly documented XML file. Instead when you open the build template in VS you will be presented with a Windows Workflow editor that allows you to edit your build process template.


So why did I start this Blog post with a question? Although it does appear to be easier to add functionality to your build process, For those of us who are Windows Workflow challenged there is some learning to do. The good news is it will be better documented and ultimately easier to find solutions.

Conflict Resolution in TFS 2010

The conflict resolution in previous versions of VSTS/TFS worked ok, but did not have the best user experience for the developer. When a conflict was detected on check in a modal dialogue was dispatched and the developer could resolve the conflicts from there. However getting to all the information you required to resolve the conflict was not at hand.  

In TFS 2010 when you attempt to check in a conflict VS behaves the way it does when you have violated a Check in Policy. One mark for consistency. You will get a warning message as seen below.


Then you will be redirected to the Pending Changes - Conflicts Tab

From the conflicts tab you can get at the information you need to help you resolve the conflict.


Compare – Compare the local file with the latest version in source control.

History – See the complete history of all changes to this file.

Annotate – Shows you the source file with change set information in the margin. Including who made the change and when.


Once you know what you need to do, click on the expander for a file and select how you want to resolve this conflict. You can AutoMerge, use the Merge Tool to edit the source, or simply select the server version or the local version.


Happy Merging!

Test Driven Development with VS 2010

Test Driven Development proposes you should: write the test, watch it fail, write the code, run the test to see it pass, refactor your code.

This is difficult when your code won’t compile because you haven’t created the method or even the class you are writing a test for. When you are in the middle of writing unit tests you don’t want to have to switch over to create a class with an empty method, it breaks your train of thought.

In VS 2008 MS introduced the Generate Method Stub  on the CTRL+. smart tag.


In 2010 they have taken this a step further. There are two new features I want to talk about here IntelliSense Suggestion Mode and Generate From Usage.

IntelliSense has two modes now Completion Mode and Suggestion Mode. You can toggle between these modes with the key sequence CTRL+ALT+SPACEBAR.

In completion mode if you entered the name of a type that does not exist, IntelliSense will make suggestions that match what you typed. I’m sure you have noticed that this can be annoying, with the wrong key stroke you end up with code you didn’t want.


By switching to Suggestion mode IntelliSense will display an edit control allowing you to continue typing even though there are no matches.


IntelliSense will even suggest this new class before it’s actually created.


Once you have completed your statement you can use the CTRL+. smart tag to generate this class.


Or generate a new type altogether, allowing you to select the project it should go in.


You can use this new feature to generate a method or property stub also a class, interface, struct or enum.

Reference Highlighting

I’m going to like the new Reference Highlighting in the 2010 code editor. This is like an in place version of the find all references feature.

To enable/disable this feature:

For C# Go to  Tools > Options >Text Editor > C# > Advanced
                        Check “Highlight references to symbol under cursor”

For VB Go to Tools > Options >Text Editor > Basic > VB Specific
                         Check “Enable highlighting of references and keywords”

Once enabled (which is the default in Beta 2) place your cursor on almost any symbol and all other references to that symbol will become highlighted.


You can navigate between the highlighted text using CRTL+SHIFT+UP ARROW or CRTL+SHIFT+DOWN ARROW

Symbols can include declarations, references, and pretty much anything else that Find All References would return. Including classes, objects, variables, methods, and properties.

In Visual Basic, this also includes: Select Case, Case, End Select, If, Then, ElseIf, and End If.

For C# code, reference highlighting is not provided for the switch and if constructions, but is provided for other symbols.

Gated Check-in Build Trigger

VS 2010 has a new feature that allows a developer to validate that their code change will merge and successfully build with the current code base on the server before ever checking it in. It’s called the gated Check-in.

How it works

Create a build type that uses Gated Check-in as it’s trigger for starting the build.


Take the code you want to check in and shelve it.

Then when you queue the build you can specify the Shelve set to be merged with the source from the server. You can also have the build complete your check in if the build is successful.


This should help to diminish the number of broken builds on the server.