But it works on my PC!

The random thoughts of Richard Fennell on technology and software development

TF246064 upgrading TFS 2010RC to RTM

I have a basic installation of TFS 2010 running on my Windows 7 laptop. This is really useful for testing build customisation and the like, a great new feature for 2010. Today I got around to trying to upgrade it from RC to RTM, but on the verification test I got the error

[ Configuration Database ] TF255407: An error occurred while attempting to validate the configuration database. Error message: TF246064: No database could be found for the following host: TestCollection. The host has the following ID: eaf3c572-8657-4268-9852-3d73a799cdf5. To fix this problem, use the TFSConfig RemapDBs command-line tool and make sure that you specify the SQL Server instance that contains this database.

Turns out I had been a bit stupid. I had created a couple of test team project collections (TPC) whilst testing some attach/detach scenarios for a client. I deleted the underlying SQL DBs, but not deleted the TCP in TFS, I guess as part of some test, but for the life of me I cannot remember why.

So as the error message suggested I tried to run the TFSConfig command

C:\Program Files\Microsoft Team Foundation Server 2010\Tools>tfsconfig remapdbs /sqlinstances:Typhoon\sqlexpress /databaseName:typhoon\sqlexpress;TFs_configuration
Logging sent to file C:\ProgramData\Microsoft\Team Foundation\Server Configuration\Logs\CFG_CFG_AT_0504_090019.log
Command: remapDBs
TfsConfig - Team Foundation Server Configuration Tool
Copyright (c) Microsoft Corporation. All rights reserved.
The Team Foundation Server configuration could not be reconfigured. The following errors were encountered:

TF246064: No database could be found for the following host: test1. The host has the following ID: 4e9b737a-b666-48f4-9411-20249aed7ae0. To fix this problem, use the TFSConfig RemapDBs command-line tool and make sure that you specify the SQL Server instance that contains this database.
TF246064: No database could be found for the following host: TestCollection. The host has the following ID: eaf3c572-8657-4268-9852-3d73a799cdf5. To fix this problem, use the TFSConfig RemapDBs command-line tool and make sure that you specify the SQL Server instance that contains this database.

So the same error as the upgrade wizard. I also tried detaching and deleting the TCP, but got:

C:\Program Files\Microsoft Team Foundation Server 2010\Tools>tfsconfig collection /delete /collectionName:TestCollection
Logging sent to file C:\ProgramData\Microsoft\Team Foundation\Server Configuration\Logs\CFG_TPC_AT_0504_090828.log
Command: collection
TfsConfig - Team Foundation Server Configuration Tool
Copyright (c) Microsoft Corporation. All rights reserved.
Could not find file 'C:\Program Files\Microsoft Team Foundation Server 2010\Application Tier\Web Services\web.config'.

But this failed as I had already removed the 2010RC instance, so there was no web.config to read.

So what to do?

I opened SQL Management Studio and connected to my local SQL instance, open the Tfs_Configuration DB and found the tbl_ServiceHost table. I then removed the rows that referenced the TPC that had I deleted the DB for. Of course I had made sure I had a backup of the DB before I started.

Once this was done the upgrade wizard passed verification and completed without error.

Now I would not recommend this as a good way to work, but it did get me out of a hole. In my case it was only a test system so if I lost it, it was not that important. However it is good to know there is a reasonably simple solution address problems with missing TPC DBs

Technical Tip: Make sure all your TPCs are valid before you start the upgrade process, so you don’t see this issue in the first place!

Speaking at Developer Day South West

I have just heard I will be speaking at Developer Day South West on June the 5th. My subject is Using the new Developer and Test features of VS 2010 to track down and fix bugs, this is basically the same session as I have at our TechDays fringe event yesterday.

Hope to see you there

DDDSouthWest2BadgeSmall[1]

Useful tool to move Reporting Services reports between servers

When you are moving TFS contents around between servers, as many people will be doing as they implement new 2010 servers and want to make use of Team Project Collections; you often have to move Reporting Services reports. In many cases you find people have lost their customised .RDL files they uploaded in the first place, and don’t want to restore the whole Reporting Services DB.

So how to extract an RDL file from a Reporting Services instance and moving it to a new Reporting Services instance?

Well have a look at Reporting Services Scripter, make makes the process fairly straight forward.

Down in London for TechDays

I am down in London for the first two days of the Microsoft TechDays event. First day has been very interesting, there seems to be a good buzz over the new testing features. So it looks good for my session tomorrow when I will be presenting on Lab Manager hope to see you there.

Error running Ivonna tests with ASP.NET 4

When I tried to run a working Ivonna test, previously targeted at .NET 3.5, against .NET 4 I found my test failing with the error

------ Test started: Assembly: Webpart.Tests.dll ------
<html><body>Bad Request</body></html>
Setup information
Physical Web path: C:\Projects\Test\TypeMockSample\TestWebSite
Actual path: C:\Users\fez\AppData\Local\Temp\Temporary ASP.NET Files\root\156567f2

Turns out that the fix to simple, you have to use an absolute path i.e. the / in front of the BasicTest.aspx is vital

 

[TestMethod, Isolated]
        public void LoadWebPage_HelloWorldWebPart_NoError()
        {
            TestSession session = new TestSession(); //Start each test with this
            WebRequest request = new WebRequest("/BasicTest.aspx"); //Create a WebRequest object
            WebResponse response = session.ProcessRequest(request); //Process the request
            System.Web.UI.Page page = response.Page;
            //Check the page loaded
            Assert.IsNotNull(page);
        }

So this is a temporary work around for now, for me it is not an issue having to use a absolute path. I understand from the writer of Ivonna that this issue will be further investigated now that .NET 4.0 has RTM’d

Experiences upgrading to Lab Manager 2010 RC

Whilst preparing for my session at Techdays I have upgraded my 2010 Beta2 Lab Manager to RC. I am pleased to say the process is far more straight forward than the initial install. Again I used the Lab Manager team blog as my guide, they have revised ‘Getting started with Lab Management 2010 RC’ Parts 1, 2 ,3 and 4 posts to help.

I was able to skip through the initial OS/VMM setup as this has not altered. I chose to throw away my TestVM (with its Beta agents) and create a new one. I upgraded my TFS 2010 instance to RC. The only awkward bit was that I had to extract the RC version of the Lab Build Template from a newly created RC Team Project Collection and load it over my existing Beta2 version. I then recreated the Lab E2E build – and it just worked. My basic sample created for Beta2 build and tested OK.

I got confident then and so decided to build my own application with Coded UI tests, and surprise, surprise it work. OK this was after some reconfiguring of the Test VM to allow UI interactive testing, and a few dead ends, but basically the underlying system worked and I think I now have a working understanding of it.

The whole process is just much slicker than it was, and the online MSDN documentation is much more useful too. This is certainly becoming as more accessible product, but you still do need a good mixture of ITPro and Developer skills that I bet many teams are going to struggle to find in a single person. The best thing I can recommend is build your own system step by step (following the blog posts) so you know how all the moving parts interact. Once you do this you will find it is less daunting.

Running Fitnesse.NET tests using MSTest - Revisited

In 2008 I wrote a post Running Fitnesse.NET tests using MSTest.  Recently I had need to us this technique on a VS2010 project, and as is so often the issue the code that worked then does not seem to work now. All I can assume is that the Fitnesse API had altered, but I thought I was using the same assemblies!

So I pulled down the code from http://sourceforge.net/projects/fitnessedotnet/ and had a poke about. Basically I seemed to be using the command line switches wrong. The listing below shows what I found is the working usage:

[TestMethod]
    public void WorkFlowSwitchOnName_DataViaFitnesse_Success()
    {
        fit.Runner.FolderRunner runner = new fit.Runner.FolderRunner(new fit.Runner.ConsoleReporter());
        var errorCount = runner.Run(new string[] {
                "-i",@"WF Workflow", // the directory that holds the HTM test files
                "-a",@"TestProject.dll",  //we have the fit fascard in this assembly
                "-o",@"results"}); // the directory the results are dumped into as HTML
        // fit can fail silently giving no failures as no test are run, so check for exceptions
        Assert.AreEqual(false, Regex.IsMatch(runner.Results, "^0.+?0.+?0.+?0.+?$"), "No tests appear to have been run");
        // look for expected errors
        Assert.AreEqual(0, errorCount, runner.Results);
        
    }

The –i option is the one that was wrong. I had been specifying a single HTM file. What I should have done was specify a directory that contains one or more HTM files. I handled this as a sub directory in my project with its contents set to copy to the output directory.

Once I made these edits I had my tests running again as expect.