Test driven development (TDD) in VSTS 2010

The last 2 days I have been testing a little piece of VSTS 2010. Something I liked is the way VSTS 2010 supports TDD. A lot of developers are familiar with TDD, some hate it and some love it. I don’t have a lot of experience with TDD, but I am very interested and tried this way of programming on my last project. Test-First development is something which makes you look different to your own code. I realized that I was focused even more on the signature of the method that I was writing. What are good input parameters and what are my return values.

When you start writing your first Unit test you will run into the annoying thing that every class you instantiate isn’t available yet. Well in VSTS 2010 the class is still not available, but there is a very simple way to make them available without losing the focus on your Unit test. See the screenshot below.

Generate class 

In this screenshot you see that the class which is giving an error because it doesn’t exist has a new option to create the class for me. You have 2 options:

  • Create the class directly in the project where the Unit test resides
  • Create the class in another project of your own choice

I think the second option is the best option, because you don’t want all your classes in the same project with all your test files. When you click on the section option (Generate other…) you will get the following panel.

Enter class information

As you can see in this panel you are able to select the following things:

  • Access modifier (Default, Public, Private, Internal)
  • Type (Class, Struct, Interface, Enum)
  • Project location (The project where you want the class to be created)
  • File name: (The name of the file)

Something what is missing is the opportunity to enter a namespace where the class should belong to. Default the class will belong to the same namespace where the unit test belongs to. Hopefully Microsoft will fix this before the release VSTS 2010. I changed the project location to another project because I don’t want my classes inside my test project. When you create the class in another project VSTS will automatically add a reference to the project where the class will be created.

Solution Explorer

Well the unit test isn’t finished yet. In my Unit test I want to test a method which multiplies the incoming parameter. So I need a method with the following signature:

  • Name: Multiply
  • Input parameter: int
  • Return parameter: int

I write this method down in my Unit test in a way it should be invoked if it exists.

New method

You can stub this method without leaving you Unit test. When VSTS creates a stub for me, it will implement the method with throwing a NotImplementedException. This is fine for me, because it doesn’t matter if the first run of my Unit test will fail. At the end the unit test will look like this.

Unit Test

The class which is generated for me will look like this.

Generated class

As you can see in the screenshot, the Multipy method is created with the right signature and it will throw an exception. The namespace isn’t correct like I already mentioned. The next thing to do is write functional code which will make the unit test pass. So test first development is something which is simple to do in VSTS 2010. When VSTS 2010 is released we are able to write our code in combination with unit tests in two ways:

  • Write our functional code first and generate a Unit test based on the class
  • Write a unit test and generate a class which supports those functionalities you are looking for

When this version of VSTS is released i am happy to do some TDD.

MSSCCI Provider and branched solutions

A few weeks ago I had a fight with the MSSCCI provider version 1.2. This version of the provider should work with branches in VS2003. Well because we have multiple developers on our project branches would be nice!!

Something that I have to say is that we converted our web application project to a class library project. This can give you some strange errors when you are working on a branched project.

Well the big difference between working with VS2003 with TFS and VS2005 with TFS, is that the solution file of your project will contain mappings for TFS and the local system (in the GlobalSection(SourceCodeControl) section).

The situation we created was, we had branched the (original) project folder to another folder (BranchA). The solution file which was also branched contained the old mappings of the original project for some projects (Wep Applications). Open your solution file with notepad and look for “SccProjectName”.

Michal Malecki from Microsoft was very helpful with this problem. We made changes to the .sln file (mappings to the right project in TFS) the local mappings were OK. The next thing he suggested is when you want to open your branched project, don’t do this with the source control explorer. You have to open it from VS2003 and select Open from source control. This will make the provider create MSSCCPRJ.SCC files. He will create one for the whole solution and one per project. When you open the branched solution within the source control explorer these files don’t get created a you will have bindings to your original project.

What does this file contain? This file contains only 2 rows:
• Workspace information
• The account you are using
• The Path to TFS where your project resides

A good summary would be branche your solution in the source control explorer and open it within VS2003. I hope this is helpful for you. i took me more then a day to fix this problem (with a lot of help from Michal Malecki, thanks)

Score exam Visual Studio 2005 Team Foundation Server exam

I already knew that i didn’t passed for my 071-510 exam, but today i received my score 625 points. This is a result i can live with for a few months (max 4). I will take this exam as soon as possible. First i have to do my first upgrade exam 70-553. When i finished this i will focus on the TFS exam. The subjects of the exam are:

  • Installing and Configuring Microsoft Team Foundation Server
  • Administering Team Foundation Server instances and Team projects
  • Administering Team Foundation Server version control
  • Administering work item types and process templates
  • Administering a team build
  • Managing team project reporting and documentation

Webcasts VSTS

Adam Gallant is giving multiple webcasts which will introduce you to multiple subjects in VSTS:

  • Visual Studio Team System and MSDN licensing demystified
  • Integrated Team Development with Visual Studio Team System
  • Visual Studio Team Foundation Server
  • Visual Studio Team Edition for Database Professionals
  • Visual Studio Team Edition for Software Testers

These webcasts will be giving up to and including June so there are a lot of subjects but still enough time to take a look at all of them. Check it out

TFS Fissum part 2

Hi there, well i told you in my previous posting that you are able to add new work items to TFS but i didn’t showed you some examples. my mistake! so here are some screenshot of workitems that we can add to our TFS enviroment at Avanade. This template based on a template that we developed based on ACM (Avanade Connected Methods).

Adding a new issue

new issue

Adding a defect

Defect

Adding a new scenario

Scenario

The panel that are used to add new workitems are very familiair to the panels we see in VSTS. Hopefully this will give you a good impression about Fissum, when there a new cool features released on this tool i will post about it. Like i already said soon i will post about the funtionalities that Teamplain offer, to give you a good impression which tool you can use to manage your project. Thanks!

TFS Fissum

Today i downloaded Fissum version 0.4. This is a tray icon tool for TFS to manage some of your work. This tool is created by Michel Perfetti and can be downloaded on codeplex.

Fissum_about

Figure1

How to configure this tool? First you need to connect Fissum to one of your team projects in TFS.

Fissum menu

Figure2

Click on configure projects then the following panel will be opend. Fill in the url of the TFS server and choose a project that is available on the server. In the panel below you will see the already configured projects. When you click the add button your selection in the top menu will become available in the panel below. Configure projects

Figure3

When you click on a the servername on the left in the panel then you can configure your project settings.  See the figure below.

Configure project settings

Figure4

When you have a project configured then you can manage it. Press the right button on the icon in the tray. the menu in figure 2 will become available. This menu contains all the out of the box queries (which you configured in the panel above). You can add new workitems. These workitems are based on the template of your teamproject. In the template you are able to configure which workitems should be available in your project. This isn’t a subject for fissum, this is part of customizing VSTS.

Two other option that are available in the 0.4 version are The iteration manager and the area manager. These options are available below in the menu of your project. below you see how the iterantion and area manager look like.

Iteration manager

Iteration manager

Figure5

The Area manager

Area manager

Figure6

I think this tool is very welcome for project managers who don’t want to install huge application to have full control of there project. You only have to install framework2.0 and Fissum and you have the control. I am not sure if this tool will be a strong component when we take a look at Teamplain, but this is a light way to manage your project. Teamplain has the possibility to show the reports that are available in TFS which a missing part in Fissum. Later this month i will try to give a summary of the possibilities of Teamplain.

Visual Studio 2005 Team Foundation Server Exam 70-510 failed

Hi,

Well in Febuary i did the Beta exam for Team Foundation Server. I already had the feeling that it would be a miracle when i would pass this exam. Unfortunately my feeling was correct!! i will have to take the exam again later this year. My colleagues Dennis Mulder and Pieter de Bruin did pass the exam and i think this is a very good achievement for such a difficult exam. Hopefully i will fix this later this year.