Integrating Visual Studio Test Project with Cruise Control
In the world of software development, maintaining high-quality code through testing is critical. Continuous integration (CI) tools help streamline this process, allowing developers to automatically run tests and deliver updates regularly. For those using Visual Studio 2008, integrating its built-in unit test projects with a CI tool like Cruise Control.Net can prove to be a challenging, yet rewarding endeavor.
In this post, we’ll explore the steps necessary to successfully integrate Visual Studio 2008 unit test projects with Cruise Control.Net, allowing you to maintain quality while enhancing your development workflow.
The Challenge
Attempting to integrate Visual Studio’s unit test capabilities directly with Cruise Control.Net is not a straightforward task. Here are some of the primary challenges:
- Visual Studio Installation: The continuous integration server will require an installation of Visual Studio 2008, which could be a deal breaker for many setups.
- Configuration Needs: Setting up the environment involves various configurations, including modifying paths and setting up scripts.
Understanding these hurdles is the first step toward successfully implementing this integration.
Step-by-Step Solution
1. Ensure Visual Studio 2008 is Installed
To smoothly run the unit tests on your CI server, you must have Visual Studio 2008 installed. This is fundamental, as MSTest.exe (the command-line tool for running the tests) is part of the Visual Studio environment.
2. Configure MSTest.exe in Cruise Control
Once Visual Studio is installed on your CI server, the next step is to configure MSTest.exe within your Cruise Control setup. Follow these steps:
-
Edit your Cruise Control configuration file: This usually involves adding a section for the unit test project within your project configuration.
-
Create a batch file: You will need this batch file to handle the cleanup of previous test result files, which can lead to errors. Here’s a simple example of what your batch file could look like:
@echo off del /q "path\to\results\*.trx"
-
Add the batch file to your tasks list: Ensure this script runs before the MSTest command is executed to prevent any errors due to leftover result files.
3. Format the Results
To provide a clear view of the testing results on the Cruise Control dashboard, you need to format the output of MSTest using XSLT. This requires:
- Creating an XSLT file: This file will dictate how the results are formatted for display.
- Updating the configuration: Insert the XSLT path into the
dashboard.config
file associated with Cruise Control.
This step is crucial as it allows team members and stakeholders to easily visualize test results, facilitating faster decision-making.
Further Reading
For more detailed guidance, you may want to check out this informative article: Integrating Visual Studio Team System 2008 Unit Tests with CruiseControl.NET. This resource expands on the specifics and provides additional context that can be beneficial during implementation.
Conclusion
Integrating Visual Studio 2008’s unit test projects with Cruise Control.Net may seem daunting at first, but by following the steps outlined above, you can create a streamlined continuous integration process that enhances your development workflow. Remember, the keys to success include a proper setup of your CI server, effective scripting, and meaningful output formatting to ensure that everyone on your team can benefit from the testing process.
With persistence and the right resources, you’ll soon have a robust system for maintaining code quality and streamlining your development process.