Did you know the TFS 2008 build agent can use MSBuild 4.0 to build VS 2010 solutions
On the Team Foundation Build 2008 machine:
- Install .NET 4.0
- Install Visual Studio 2010 (if you are running tests)
- Edit the TFSBuildService.exe.config file and set the MSBuildPath value to v4
As you have read on this blog and others, the TFS 2010 build process’ now utilizes Windows WorkFlow to define it’s process. This means you can define Arguments to allow an option to be set in the Build definition instead of being hard coded in the process.
For example when you create a build definition the process tab allows you to set various options like Where to find unit tests, what is the build number format, should the build run Code Analysis? These are all defined as arguments in the build process so they can be changed when creating the build definition or even when you queue the build.
You can of course add your own arguments to a build process. Just to set the stage, lets say for example I wanted the build process to create a work item when the build completed. In the build toolbox there is an OpenWorkItem activity that I can use for this. We’ll have the build create a Task that has someone Validate the Build.
We can set the type and title of the work item we want created. However the AssignedTo might depend on the solution being built. We don’t want to hard code this in the build process but rather allow the author of the build definition the ability to set it for each type of build.
Set the Type = “Task”
Set the Title = “Validate Build (“ + BuildDetail.BuildNumber + “)”
Next create an argument called BuildValidator to take the name of the person the author of the build would like the Task assigned to.
At the bottom of the process editor click on the arguments button to show arguments for the process you are editing. In the last entry where it says Create Argument enter the name of your argument. In our case we’ll call it BuildValidator
Now we can go back and add BuildValidator to the AssignedTo property of the OpenWorkItem Activity to complete our process.
However lets set up some Metadata for this property. This is done using the Metadata Argument. In the list of arguments you will see one called Metadata click on the ellipsis under the Default Value column.
In the dialog that opens you can Add MetaData for a process parameter. Click the Add button and enter BuildValidator into the Paramater Name.
From the screen shot below you can see that you are able to set a DisplayName, Category, Description. Set an editor, whether or not it’s required and where it should show up.
Once you have the metadata entered Click OK, save the process and check it in.
Go and edit or create a build definition using this process and you will see your process argument with all it’s Metadata in the process tab of the build definition.
Tonight at the Microsoft World Partner Conference MS Canada had a party for all the Canadians. It was wonderful. Food and drinks at the Hard Rock Cafe in Washington.
They brought in Great Big Sea to play for us, and they were wonderful.
Thanks MS Canada you know how to treat your partners.
I arrived in Washington D.C. yesterday morning for the MS World Partner Conference. I have been to many PDC’s and TechEd type conferences but this is my first Partner Conference.
Registration was very well done. Attendees just scan the bar code on a piece of paper they printed at home when they registered. Take that to a desk show ID and they hand you a card. it’s was literally 2 minutes. Very impressive.
Went to a New Horizons/MS party last night that was fun. I met a bunch of people including a nice couple from Redmond. He works for MS and knows a few people I know from MS Canada.
The last time I was in Washington it was a lot different then it is now. It’s very clean and there is lots of activity. I Found an Irish Pub on my way to the NH party yesterday, it was buzzing with people. Nice atmosphere.
I am going to pack up now and get over to the Verizon Centre for Breakfast and the first Keynotes.
When manual testing using MS Test Manager you may want to change the test settings to include Video Recording.
This will capture a video of the test session so the developer can’t say “Tell me exactly what you did to create this bug.”
To get video recording to work you may have to install the Windows Media Encoder and a support update.
You can find the details and download links here.
TFS 2010 has hierarchical work items. This is something that we have been waiting for and are very happy about. Along with hierarchical work items you also get two new query types.
Work Items and Direct Links - Which allows you to query for a work items with specified relationships.
Tree of Work Items – Lets you query for a work item and child work items.
For example if I wanted to return a list of User Stories and all the Development and Design Tasks to implement them it would look something like this.
The result from this query might look something like this.
Lets say you have created tasks but have not assigned them to Requirements yet. In other words they have no Parent Work Item. Create a query something like this, so it shows Tasks and User Stories in the Parent role.
The Result will show Tasks that were not assigned to User Stories yet.
Here’s the cool trick I wanted to show you.
By dragging the Task titled “Implement Movie Query” onto the User Story titled “Select Movie Time” it will automatically create the Parent/Child relationship. You can also reassign incorrectly assigned children to another parent.
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.
Now to get ready for the next launch event.
This is a free full day event from the best instructors in the business.
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 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.
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.