Clara's Notes on Technology

Just a place to put down ideas and concepts on technology, mainly .NET, BizTalk, SQL Server, and other MSFT stuff.

Thursday, November 16, 2006

Creating the Team Portal before creating the Team Project

Is this possible? Yes.

Here is how I did it (I got the idea from here).

  1. Create a new process template that does not create a team portal (you just have to remove the portal plugin from the ProcessTemplate.xml). Like this (I removed reporting too):

    <?xml version="1.0" encoding="utf-8"?>
    <ProcessTemplate>
    <metadata>
    <name>Test3</name>
    <description>The only particularity of this template is that it does
    not create a team portal.</description>
    <plugins>
    <plugin name="Microsoft.ProjectCreationWizard.Classification"
    wizardPage="false" />
    <plugin name="Microsoft.ProjectCreationWizard.Groups"
    wizardPage="false" />
    <plugin name="Microsoft.ProjectCreationWizard.WorkItemTracking"
    wizardPage="false" />
    <plugin name="Microsoft.ProjectCreationWizard.VersionControl"
    wizardPage="true" />
    </plugins>
    </metadata>
    <groups>
    <group id="Classification" description="Structure definition for the
    project." completionMessage="Project Structure uploaded.">
    <dependencies />
    <taskList filename="Classification\classification.xml" />
    </group>
    <group id="Groups" description="Create Groups and assign Permissions."
    completionMessage="Groups created and Permissions assigned.">
    <dependencies>
    <dependency groupId="Classification" />
    </dependencies>
    <taskList filename="Groups and Permissions\GroupsandPermissions.xml" />
    </group>
    <group id="WorkItemTracking" description="Workitem definitions uploading."
    completionMessage="Workitem definitions uploaded.">
    <dependencies>
    <dependency groupId="Classification" />
    <dependency groupId="Groups" />
    </dependencies>
    <taskList filename="WorkItem Tracking\WorkItems.xml" />
    </group>
    <group id="VersionControl" description="Creating Version control."
    completionMessage="Version control task completed.">
    <dependencies>
    <dependency groupId="Classification" />
    <dependency groupId="Groups" />
    <dependency groupId="WorkItemTracking" />
    </dependencies>
    <taskList filename="Version Control\VersionControl.xml" />
    </group>
    </groups>
    </ProcessTemplate>


  2. Go to Sharepoint Administration
  3. Select Create a Top-Level Website
  4. Select Default Website
  5. Select Web Site Address and name it the same name as your project. The Url should be under sites like this: http://<spserver>/sites/<teamprojectname>
  6. From the Team Explorer create a project with the process template in (1).
  7. Once it is created, right click on it and choose "Show Project Portal". You should arrive at the site created in (5)!

The only hick to this is that you cannot change the Team Portal url. It has to follow the format given above.

Wednesday, November 08, 2006

Becoming an Architect?

I am hoping to becoming a software architect one day. My current job is quite mixed: I do presales, development, consultancy and architecture. The idea is that I become more of an architect with time.

At TechEd EMEA 2006 I have learned about Ron Jacobs. He is an architecture evangelist for Microsoft and a very good speaker. I've been browsing his websites (mainly www.ronjacobs.com and www.arcast.com) and I have found a lot of useful information about what is an architect.

It is great to learn all these things but, at the same time, I feel far from my goal! There is so much to learn :)

Some more info. This article is really interesting about what an architect is expected to do: http://blogs.msdn.com/ramkoth/archive/2006/03/13/550218.aspx (If I don't get it right I'm headed for the "Developer with a difference" profile)

Barcelona's Girl Geek Dinner

Yesterday was the Barcelona-TechEd Girl Geek Dinner. I didn't know what to expect and I enjoyed it, although I would have liked to network more. There were two reasons why I think I did not get to meet many girl geeks: 1) the dinner was seated so people did not really mix outside their table, 2) I brought one of my colleagues - he is a really nice guy but I did not feel completely at ease talking about how it is being the only girl in the office.

The speakers were great. Very inspirational (in fact, this has become my word for the TechEd: inspirational!). It is really encouraging to see women deeply involved in technology out there.

Sarah Blow asked them how they would define a geek. The definition I most identify with is that of "someone who is very curious, who wants to get to the bottom of things, who wants to understand" (I think it was from Catherine Heller from MSFT).

To sum up, two key phrases from the dinner, which I will try to rembember whenever in difficulty or doubt:


  • Just do it
  • Dare to be different

PS: Check out this website (when it is up!) http://www.evetech.com

Sunday, November 05, 2006

From NUnit to Team System

Another chapter on my experience helping a client adopt Team System.

This time, the goal was to convert their NUnit test to Team System tests. This is not a very difficult topic given the great conversion tool available on gotdotnet (here), which basically does all the work for you. However, I did stumble upon a few issues. Before going into that, this is the basic procedure I followed (fortunately, NUnit tests were already placed in a single project (*.Test)):

a. Create a new test project (named *.Test.TS)
b. Create the necessary project folders
c. Add the necessary references
d. Copy *.cs files from *.Test project to *.Test.TS
e. Set project properties if necessary (build location, postbuild events, etc.)
f. Build
g. Perform a test run with NUnit to check everything is green
h. Run the NUnit Converter
i. Remove Nunit references and build again
j. Run tests in TS and check results with corresponding run in Nunit (g)
k. Commit pending changes

When the test project is created, a .vsmdi and a .testrunconfig file are also created and added to the soluiton folder. If new tests are added to the solution, the vsmdi file will need to be checked out. To see all the tests available for the solution, open .vsmdi file (it offers a list view of the test which can be sorted and grouped -- n.b. the possibility of grouping tests into lists is only available if you have VS Team Edition for Testers).

When converting a large project (about 2000 tests), I had to get around the following issues:

1. Category Attribute

Categories do not exist in Team System. The alternative is to use Description attribute or lists (lists are only available in the Tester edition). The converter tool reacts as follows when finding a Category attribute:


  • If just one category on a test method, conversion was as follows: [Test, Category("sample")] --> [TestMethod(), TestProperty("Category", "sample")]


  • If just one category on a class, conversion was as follows: [TestFixture, Category("sample")] --> //Category: "sample"


  • If more than one category attribute, conversion did not occur and NUnit conversion tool stops. My solution here was pretty basic: manual replacement (I used TextPad as editor)

  • Replace Category("\(.+\)"),Category("\(.+\)")\] by Category("\1")]\n[TestProperty("Category","\2")\]


    For instance: [Test, Category("Business"), Category("More Business")] becomes [Test, Category("Business")] [TestProperty("Category","More Business")]


    Notice that this is just a temporary solution to get the converter tool to run until the end. The final conversion gives this [TestMethod(), TestProperty("Category","Business")] [TestProperty("Category","More Business")] which is not correct because the same property is used twice with different values. The second property should be changed to TestProperty("Category2","More
    Business")
    , for example (or use Description attribute instead).


2. Partial Classes

Partial classes are not converted because they do not have the TestFixture attribute. You need to add it in order for the conversion to run, but afterwards remvoe the
corresponding TestClass attribute (because it is a duplicate given that the class was partial).


3. Static Methods.

Due to the TestFixtureSetUp conversion to ClassInitialize(), some methods had to be converted to static. Also, since the initialize method is now static, it cannot be overriden
anymore, but it doesn't really matter because of point 4.

Let me explain. The initial scenario was as follows: you have a set of test classes that inherit from a parent class. This parent class contains a test set up method used by almost all children. Those that need some extra/different initialization override the method. Like this:


[TestFixture]
public class BaseTest
{
[TestFixtureSetUp]
public virtual void InitializeTests()
{
// do some initialization
}
}

[TestFixture]
public class MyTest1 : BaseTest
{
[Test]
public voic SomeTest
{
base.InitializeTests();
// do other things
}
}

[TestFixture]
public class MyTest2 : BaseTest
{
[Test]
public voic SomeOtherTest
{
base.InitializeTests();
// do other things
}

public override void InitializeTests()
{
// do some other initialization
}
}


This scenario does not work anymore in Team System because of points
3 and 4 (initialize methods are static and inheritance is not supported.

4. Inheritance is not supported in Team System unit tests.

Yes, that is disappointing. This explains why the [TestFixtureSetUp] methods in a parent classes is not called. In Team System testing framework there are 3 attributes to initialize/clean up tests:


  • TestInitialize/CleanUp

  • ClassInitialize/Cleanup. It replaces your TestFixtureSetUp/TearDown but remember that inheritance is not supported.

  • AssemblyInitialize/Cleanup It runs once at the start of each method in the assembly.

You should use these attributes. My recommended solution is to replace the TestFixtureSetUp attributes (converted to ClassInitialize()) in a parent class by AssemblyInitialize and reorganize tests so that all tests needing this particular initialization are in this assembly.

Given the example above, this means removing inheritance, adding an AssemblyInitialize on the InitializeTests method, and moving the MyTest2 class to another assembly (if you do not want it to use the InitializeTests at all) or adding a TestInitialize method to MyTest2.InitializeTests (if you want to add some extra initialization specific to SomeOtherTest).

5. Missing TestFixture attribute

If a class does not have the [TestFixture] attribute, it is not converted (even if it contains test methods).