Integrating NCover and MSTest into my ccnet.config turned out to be relatively painless. I did have to do some trial and error when I decided to use the <exec> task rather than calling into a Nant or MSBuild script. I used this link to determine all the base information I needed to include.

Unit Tests & Code Coverage
The portion of the code snippet below contained within the <exec> task is the important part. I included the preceding xml for context only.

<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
  <!-- http://confluence.public.thoughtworks.org/display/CCNET/Configuration+Preprocessor -->
  <cb:define cmd.exe="c:\Windows\System32\cmd.exe" />
  <cb:define ncover.console.exe="C:\Program Files (x86)\NCover\NCover.Console.exe" />
  <cb:define ncover.reporting.exe="C:\Program Files\NCover\NCover.Reporting.exe"/>
  <cb:define mstest.exe="C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe" />
  <cb:define solution="Release" />
    <project name="Project.Test">
      <tasks>
        <exec>
          <executable>$(ncover.console.exe)</executable>
          <baseDirectory>$(work_dir)\$(projectName)\bin\$(configuration)</baseDirectory>
          <buildArgs>&quot;$(mstest.exe)&quot; /testcontainer:$(projectName).dll /resultsfile:results.xml //xml $(work_dir)\$(projectName)\bin\$(configuration)\coverage.xml</buildArgs>
          <buildTimeoutSeconds>1200</buildTimeoutSeconds>
        </exec>

Both MSTest and NCover parameters are included in the <buildArgs> section. The important thing to note here is the use of double slashes ‘//’ for NCover command line parameters as opposed to single slashes ‘/’ for MSTest parameters. This task produces a results.xml for MSTest and a coverage.xml for NCover. Both these files are included in the <merge> task below.

Generating Coverage Reports
The following <exec> task contains all necessary information for generating the full coverage HTML report.

        <exec>
          <executable>$(ncover.reporting.exe)</executable>
          <baseDirectory>$(work_dir)\$(Project.Name)\bin\$(configuration)</baseDirectory>
          <buildArgs>$(work_dir)\$(Project.Name)\bin\$(configuration)\coverage.xml //or FullCoverageReport:Html //op $(work_dir)\$(Project.Name)\bin\$(configuration)\NCover\Reports</buildArgs>
        </exec>
      </tasks>

Merge HTML Reports for integration in Web Dashboard
Most of the information I found for integrating the Full Coverage HTML Report into ccnet was derived from this article. The only thing I had left to figure out on my own, was where to specify the ‘target’ folder. The ‘merge’ task does not copy recursively, so each subdirectory you need copied will have to be specified within it’s own ‘merge’ task.

      <publishers>
        <merge target="Files">
          <files>
            <file action="Copy">$(work_dir)\$(Project.Name)\bin\$(configuration)\ncover\reports\files\*.*</file>
          </files>
        </merge>
        <merge>
          <files>
            <file action="Copy">$(work_dir)\$(Project.Name)\bin\$(configuration)\ncover\reports\*.*</file>
            <file>$(work_dir)\$(Project.Name)\bin\$(configuration)\results.xml</file>
            <file>$(work_dir)\$(Project.Name)\bin\$(configuration)\CoverageReport.xml</file>
          </files>
        </merge>
        <xmllogger/>
        <statistics/>
        <rss/>
      </publishers>
    </project>

Add NCover Report Link to Dashboard
I included my complete ‘buildPlugins’ section of my dashboard.config file. The only line that needs to be added is the ‘htmlReportPlugin’ section.
I had used the default NCoverSummary.xsl prior to adding the html report. Because of this, I struggled with getting it to work until I commented out both sections for NCover that you see below. Once these sections were omitted the link worked flawlessly.

    <buildPlugins>
      <buildReportBuildPlugin>
        <xslFileNames>
          <xslFile>xsl\header.xsl</xslFile>
          <xslFile>xsl\modifications.xsl</xslFile>
          <xslFile>xsl\MsTestSummary2008.xsl</xslFile>
	  <!--xslFile>xsl\NCoverSummary.xsl</xslFile-->
        </xslFileNames>
      </buildReportBuildPlugin>
      <buildLogBuildPlugin />
      <xslReportBuildPlugin description="MSTest Report" actionName="MSTESTReport" xslFileName="xsl\MsTestReport2008.xsl"/> 
      <!--xslReportBuildPlugin description="NCover Report" actionName="NCoverReport" xslFileName="xsl\NCoverReporting30.xsl"/-->
      <htmlReportPlugin description="Full NCover Report" actionName="viewReport" htmlFileName="fullcoveragereport.html" />
    </buildPlugins>

A couple of potential gotchas:

  • In order to see the NCover link appear in the Dashboard, you may have to stop & restart your ‘ccnet’ web service. Instructions for this can be found here.
  • If you are unable to drill down to the source level in the NCover report, check to see if the folders for the dll’s or exe’s you are testing contain their PDB files.

We recently purchased an OCZ Revo Drive X2 240GB drive in an effort to speed up our Installation builds using Cruise Control. After scouring the OCZ forums and other websites I was able to tally up enough information to configure the drive properly. I thought I would outline the steps I used to successfully configure this drive as a data drive.

  1. I installed the drive in the first available PCIe x16 port.
  2. I booted the machine and selcted F10 to configure the BIOS.
  3. In the BIOS configuration utility I selected “Advanced” – “Device Options”.
  4. I selected “NIC PXE Option ROM Download” and disabled it.
    • This will disable Ethernet Boot Agent which allows more Option ROM for the Revo controller to load.
  5. Save changes and exit BIOS utility.
  6. Boot to Windows.
  7. Download drivers from the following URL and extract to your hard disk: http://www.ocztechnology.com/drivers/RevoDrive_and_RevoDrive_X2/
  8. Open “Device Manager”. You should see an Icon with the yellow warning icon under “Other Devices -> RAID Controller”. Right-click, select properties and click on Driver tab. Install driver you just downloaded.
  9. Right-click on “Computer”. Select “Manage -> Disk Management”.
  10. Find new drive, Right-click and select “Create New Volume” and select a drive letter.
  11. Perform a “Quick Format”.

If you look and Windows Explorer the drive should be visible.

Busking Mute Swan

While on a weekend trip to Idaho, I had an opportunity to shoot some Mute Swans. They were feeding along the shoreline of a small lake. As they plunged their heads into the water to look for food, I would sneak closer to them and the edge of the shore.
I was able to get within 15 feet of this Swan. My understanding is that the raised wings are a threat display known as busking. I love the way the raised feathers captured the sunlight and framed some of the water in the background.
For this shot, I used my Canon 30D with the Canon 70-200mm f2.8L with the 1.4 converter @ 280mm. My exposure was 1/640 @ f/8.0 and an ISO of 100.

I was just assisting another developer with integrating MS Test Reports into the Web Dashboard on his Cruise Control.NET server.
I pointed him to the following link, which is the same link I used:

http://www.codeproject.com/KB/tips/VSTS2008_Tests_With_CCNET.aspx?msg=2577310

When we completed the directions from the link above. We launched the dashboard and were unable to see the link in the left column for ‘MSTest Reports’. The solution ended up being to stop and restart the CCNet web service in IIS.

This can be accomplished by following these steps:
1. Open ‘Administrative Tools’
2. Start ‘Internet Information Services (IIS) Manager’
3. Expand web server tree to the ‘Default Web Site’.
4. Click on ‘Default Web Site’.
5. Stop and Restart ‘Default Web Site’
6. Refresh the Web Dashboard and the link to ‘MSTest Report’ should now be visible.

I have a single ccnet.config file which contains 9 projects. Each project varies in the length of time it takes to complete. My shortest is about 3 minutes, my longest takes 45 minutes. Some of the projects can run parallel with other projects. When this happens, the processing time increases for each project and was causing certain processes to timeout. The errors I received were similar to the following:

BUILD EXCEPTION
 Error Message:
 ThoughtWorks.CruiseControl.Core.Tasks.BuilderException: NAnt process timed out (after 600 seconds) at
 ThoughtWorks.CruiseControl.Core.Tasks.NAntTask.Run(IIntegrationResult result) in d:\sourceforge\ccnet\project\core\tasks\NAntTask.cs:line
 109 at ThoughtWorks.CruiseControl.Core.Project.Run(IIntegrationResult result) in d:\sourceforge\ccnet\project\core\Project.cs:line 184 at
 ThoughtWorks.CruiseControl.Core.IntegrationRunner.RunBuild(IIntegrationResult result) in
 d:\sourceforge\ccnet\project\core\IntegrationRunner.cs:line 95 at
 ThoughtWorks.CruiseControl.Core.IntegrationRunner.RunIntegration(BuildCondition buildCondition) in
 d:\sourceforge\ccnet\project\core\IntegrationRunner.cs:line 36
 BaseDirectory: C:\CodeDrop\mainProject, Targets: , Executable: nant.exe, BuildFile: publish.xml
 Project: publish.folders Date of build: 3/10/2011 1:23:02 PM Running time: 00:10:00
 Build condition: Forced Build
 Modifications since last build (0)

Most of my issues were with source checkouts and file copies. The solution for me was to use the various timeout tags offered for each of the offending tags. Here are some examples below:

Subversion Source Control Type:
  (The 'units' attribute can be changed to seconds or hours as well.)
<svn>
  {other svn child tags......}
  <timeout units="minutes">5</timeout>
</svn>
 
Nant Task:
<nant>
  {other nant child tags......}
  <buildTimeoutSeconds>1800</buildTimeoutSeconds>
</nant>
 
Exec Task:
<exec>
  {other exec child tags......}
  <buildTimeoutSeconds>1800</buildTimeoutSeconds>
</exec>
 
Devenv Task:
<devenv>
  {other devenv child tags......}
  <buildTimeoutSeconds>1800</buildTimeoutSeconds>
</devenv>

As I received the timeout errors I would increase the timeouts until I didn’t receive the errors anymore.
The timeout value is used to create a large enough window of time for the task to complete. When the task completes, ccnet moves on to the next task. and a new timeout window is created for the new task.


I obtained my first SLR camera in 2006. I was fortunate to be working with a number of aspiring photographers who all had much more experience than I. I took advantage of my fortune and tried to gain whatever knowledge I could from them to apply towards my own photography experience.
While in Idaho over Memorial weekend of 2007. My in-laws were working cattle, for some friends of theirs. “Working cattle” consists of herding the cattle from an open field into a corral. Then the cowboys, on their horses proceed to sort the yearling calves from each of their momma’s. Once they have them sorted, each calf is roped by the head and heals, then laid on it’s side, where the rancher brands, give’s shots, and make’s any male calf into a steer.
It was during one of these outings I was taking pictures of the days endeavors.
As I was sorting through the pictures, this particular photo stood out:
My father-in-law bringing in the herd.

A cowboy on a horse, shrouded in dust from the pounding herd of cattle in the foreground, screamed Black & White.
With a little cropping to remove a couple of pieces of old farm machinery, including the piece I was hiding behind, some brightening, and alas, A “Big Smile” on my face for the resulting photo. Not only was I happy with the overall photo, but we now have a very realistic memory of my father-in-law, doing what he has done all his life.

I have an application that launches multiple threads to validate database credentials. These tests are performed by each thread and expected to write status back to a single common log file.
This is how I choose to solve the problem:

public class Log
{
    private Object fileLock = new Object();
 
    private static void WriteToLog(string text)
    {
        string logPath = {path of log file};
 
        lock (fileLock)
        {
            TextWriter tw = new StreamWriter(logPath, true);
            tw.WriteLine(text);
            tw.Close();
        }
    }
}

Wow, a couple lines of code and I have multiple threads safely writing data to a single file.

Error Message:
A connection was successfully established with the server, but then an error occurred during the login process. (provider: TCP Provider, error: 0 – An established connection was aborted by the software in your host machine.) (Microsoft SQL Server, Error: 10053) For help, click: Source: MSSQLServer ID: 10053 (SQL Server )

This issue occurred on a very irregular basis. When I changed the connections setting on the following dialog from ’10′ to ’0′, which is unlimited, the issue went away.

To get to this dialog, do the following:

  1. Start “Microsoft SQL Server Management Studio”
  2. Connect
  3. Right Click on your SQL Server Instance {Server Name}
  4. Click on properties
  5. Select the ‘Connections’ page
  6. Modify ‘Maximum number of concurrent connections’.  0 for unlimited or whatever you feel is appropriate. I had 10 originally and would receive this error.
  7. Click OK
  8. Stop ‘SQL Server Instance’ and restart it.
  9. Restart ‘SQL Server Agent’

Our nightly build produces binaries which are consumed into various Cruise Control.Net projects. The folders containing these binaries are quite large. To prevent copying binary files before the nightly build is done copying to the file share, a finish.txt file is used to signal when the file copy is complete.

I use a filesystem source control node to monitor for the modified finish.txt file. In order to ignore all additional files except the finish.txt, I use the inclusionFilters and exclusionFilters. One additional complexity is that the nightly build copies each set of binary files to a versioned (build #) folder.

I have included an example of the server share structure, as well as, a code snippet of the filesystem source control node and filters used to monitor the finish.txt file.

Server Share path:
\\server\share\nightly\builds\bits\finish.txt
\\server\share\nightly\builds\bits\22\release
\\server\share\nightly\builds\bits\23\release

ccnet.config snippet:

      <sourcecontrol type="multi">
        <sourceControls>
          <filtered>
            <sourceControlProvider type="filesystem">
              <repositoryRoot>\\server\share\nightly\builds\Bits</repositoryRoot>
              <ignoreMissingRoot>false</ignoreMissingRoot>
              <autoGetSource>false</autoGetSource>
            </sourceControlProvider>
            <exclusionFilters>
              <pathFilter caseSensitive="false">
                <pattern>\\server\share\nightly\builds\Bits\**\release\**\*.*</pattern>
              </pathFilter>
            </exclusionFilters>
            <inclusionFilters>
              <pathFilter caseSensitive="false">
                <pattern>\\server\share\nightly\builds\Bits\finish.txt</pattern>
              </pathFilter>
            </inclusionFilters>
          </filtered>
        </sourceControls>
      </sourcecontrol>

When creating the patterns in the path filter remember that the patterns are “case sensitive”. You can remove case sensitivity by including the: caseSensitive=”false” attribute to the pathFilter node.
For my situation I am using the filesystem source control node for monitoring purposes only. I need the binaries to copy to folders other than the project working directory. This is a current limitation of the filesystem node. I accomplish this in a publish task. I will cover this in another post.

I was just in the situation where I could not remove a network share. The share displayed a red ‘X’ but would give me the following error when I tried to remove the share: “The network connection could not be found”.
When I tried to remap the share, I would get this error: “The local device name is already in use”.
To fix this I tried the following on the command line:

net share {sharename} \\servername /DELETE

Next I tried:

net use {drive letter :} /DELETE

Next I opened the Task Manager, clicked on the Processes tab, and stopped the “explorer.exe” process.
I then selected the File menu in Task Manager, selected New Task (Run), Typed in explorer, clicked OK.
When explorer restarted I opened my file explorer and the share was gone.  SUCCESS!

© 2011 [ i ] 2.0 Suffusion theme by Sayontan Sinha