Finding the problem on a partially succeeded build on Team Foundation Build Services 2010

Topic(s)
Audience

Everyone

Now that I have the Build failing because of a genuine bug and not just because of a test framework failure, lets see if we can trace through to finding why the first test in our new application failed. Lets look at the build and see if we can see why there is a red cross on it.

First, lets open that build list. On Team Explorer Expand your Team Project Collection | Team Project and then Builds. Double click the offending build.

image
Figure: Opening the Build list is a key way to see what the current state of your software is.

 image
Figure: A test is failing, but we can now view the Test Results to find the problem

 

image  
Figure: You can quite clearly see that the test has failed with “The device is not ready”.

To me the “The Device is not ready” smacks of a System.IO exception, but it passed on my local computer, so why not on the build server?

Its a FaultException so it is most likely coming from the Service and not the client, so lets take a look at the client method that the test is calling:

bool IProfileService.SaveDefaultProjectFile(string strComputerName)
{            
    ProjectFile file = new ProjectFile()
    {
        ProjectFileName = strComputerName + "_" + System.DateTime.Now.ToString("yyyyMMddhhmmsss") + ".xml",
        ConnectionString = "persist security info=False; pooling=False; data source=(local); application name=SSW.SQLDeploy.vshost.exe; integrated security=SSPI; initial catalog=SSWSQLDeployNorthwindSample",
        DateCreated = System.DateTime.Now,
        DateUpdated = System.DateTime.Now,
        FolderPath = @"C:Program FilesSSW SQL DeploySampleData",
        IsComplete=false,
        Version = "1.3",
        NewDatabase = true,
        TimeOut = 5,
        TurnOnMSDE = false,
        Mode="AutomaticMode"
    };

    string strFolderPath = "D:"; //LocalSettings.ProjectFileBasePath;
    string strFileName = strFolderPath + file.ProjectFileName;

    try
    {
        using (FileStream fs = new FileStream(strFileName, FileMode.Create))
        {
            DataContractSerializer serializer = new DataContractSerializer(typeof(ProjectFile));
            using (XmlDictionaryWriter writer = XmlDictionaryWriter.CreateTextWriter(fs))
            {
                serializer.WriteObject(writer, file);
            }
        }
    }
    catch (Exception ex)
    { 
        //TODO: Log the exception
        throw ex;
        return false;
    }

    return true;
}

 

 

 

Figure: You can see on lines 9 and 18 that there are calls being made to specific folders and disks.

What is wrong with this code? What assumptions mistakes could the developer have made to make this look OK:

  1. That every install would be to “C:Program FilesSSW SQL Deploy”
  2. That every computer would have a “D:”
  3. That checking in code at 6pm because the had to go home was a good idea.

lets solve each of these problems:

  1. We are in a web service… lets store data within the web root. So we can call “Server.MapPath(“~/App_Data/SSW SQL DeploySampleData”) instead.
  2. Never reference an explicit path. If you need some storage for your application use IsolatedStorage.
  3. Shelve your code instead.

What else could have been done?

  1. Code review before check-in – The developer should have shelved their code and asked another dev to look at it.
  2. Use Defensive programming – Make sure that any code that has the possibility of failing has checks.

Any more options?

Let me know and I will add them.

What do we do?

The correct things to do is to add a Bug to the backlog, but as this is probably going to be fixed in sprint, I will add it directly to the sprint backlog.

  1. Right click on the failing test Select “Create Work Item | Bug”
    image
    Figure: Create an associated bug to add to the backlog.
     
  2. Set the values for the Bug making sure that it goes into the right sprint and Area. Make your steps to reproduce as explicit as possible, but “See test” is valid under these circumstances.
     image
    Figure: Add it to the correct Area and set the Iteration to the Area name or the Sprint if you think it will be fixed in Sprint and make sure you bring it up at the next Scrum Meeting.
    Note: make sure you leave the “Assigned To” field blank as in Scrum team members sign up for work, you do not give it to them. The developer who broke the test will most likely either sign up for the bug, or say that they are stuck and need help.
    Note: Visual Studio has taken care of associating the failing test with the Bug.
     
  3. Save…
     

Need Help?

www.SSW.com.au

SSW was the first company in the world outside of Microsoft to deploy Visual Studio 2010 Team Foundation Server to production, not once, but twice.

Team Foundation Server

Visual Studi2010 ALM SSW provides expert Visual Studio ALM guidance including installation, configuration and customisation through our four Microsoft Visual Studio ALM MVP’s in three countries; Australia, Beijing and the UK. They have experience deploying to small development shops all the way through to large blue chips.

Professional Scrum Developer Training

Professional Scrum Developer Training SSW has six Professional Scrum Developer Trainers who specialise in training your developers in implementing Scrum with Microsoft’s Visual Studio ALM tools.

Technorati Tags:           

Upcoming Training Opportunities

These are the next five classes we have, and you can check out our full public schedule of classes.

Timezone:
Live Virtual Professional Scrum Master Online on 29th May 2023
Virtual
29 May-1 May, 2023
09:30-13:30 BST
4 half-days
Live Virtual Professional Scrum Product Owner online 5th June 2023
Virtual
5-8 Jun, 2023
09:30-13:30 BST
4 half-days
Live Virtual PAL Evidence-Based Management Online on 19th June 2023
Virtual
19-20 Jun, 2023
09:00-13:00 BST
2 half-days
APS 19th June 2023
Virtual
19-22 Jun, 2023
09:00-13:00 EDT
4 half-days

We can deliver any of our courses as private in-house training over Microsoft Teams & Mural. We also recommend training based on your accountabilities or role, you can go directly to recommended courses for Scrum MastersProduct OwnersDevelopers and Agile Leaders.

Create a conversation around this article

Share on Facebook
Share on Twitter
Share on Linkdin

Related Courses

No items found

Read more

Martin Hinshelwood nkdAgility.com
https://youtu.be/_fFs-0GL1CA Why do you encourage people to follow a certification path in their career journey? I would encourage you to follow a scrum certification path for the same reason that people go to university. The same reason that people do any course or certification. It gets you a foot in …
Martin Hinshelwood nkdAgility.com
https://youtu.be/QGXlCm_B5zA What will you learn on the PSM II course? There are two main things that most scrum masters will learn on the PSM II or Advanced Professional Scrum Master course. That they haven’t been working effectively as a scrum master to date. That they are there to empower and …
Martin Hinshelwood nkdAgility.com
In Scrum Events across the world, I hear repeated the phrase “that’s how agile works” when describing behaviours that are both unprofessional and the very opposite of an agile mindset. These behaviours will inhibit agility and are a result of a lack of understanding of the underlying principles. We need …
Martin Hinshelwood nkdAgility.com
https://youtu.be/klBiNFvxuy0 What is the most common Aha moment people have in a scrum course? It depends on the scrum course they are attending. The content presented in the Applying Professional Scrum (APS) course leads to very different epiphanies when compared to the content presented on an Advanced Professional Scrum Master …

OUR TEAM

We believe that every company deserves high quality software delivered on a regular cadence that meets its customers needs. Our goal is to help you reduce your cycle time, improve your time to market, and minimise any organisational friction in achieving your goals.

naked Agility Limited is a professional company that offers training, coaching, mentoring, and facilitation to help people and teams evolve, integrate, and continuously improve.

We recognise the positive impact that a happy AND motivated workforce, that has purpose, has on client experience. We help change mindsets towards a people-first culture where everyone encourages others to learn and grow. The resulting divergent thinking leads to many different ideas and opportunities for the success of the organisation.