YOUR FEEDBACK
DataCore and Egenera Combination Delivers Next Generation Server and Storage Virtualization
Virtualization news for the channel community and you ! wrote: Trackback A...

SYS-CON.TV
TOP MICROSOFT .NET LINKS


Automatic Integration with CruiseControl.NET, NAnt, and NUnit
How to implement the the concept of regression testing during implementation

Digg This!

Page 2 of 2   « previous page

What Is a Successful Build?
It is worth noting again that a successful build is not just compilation and linkage of the source code without errors; it is also the successful execution, without failure, of unit tests. Let's try an exercise with the BaseRobot class where we make a modification to the source that while successfully compiles, actually breaks the build (source code for this article is available by viewing source.html). Our BaseRobot has the ability to turn left and right and to move forward, and nothing more. Let's provide it with the ability to move backwards as well.

Following the tenets of Test Driven Development (TDD), we need to write our test first. It will go in the BaseRobotTest class and look something like this:


[Test]
public void TestMoveBackward()
{
Robot.MoveBackward();
Assert.AreEqual(Robot.XCoordinate, 0);
Assert.AreEqual(Robot.YCoordinate, -1);
Robot.TurnLeft();
Robot.MoveBackward();
Assert.AreEqual(Robot.XCoordinate, 1);
Assert.AreEqual(Robot.YCoordinate, -1);
Robot.TurnLeft();
Robot.MoveBackward();
Assert.AreEqual(Robot.XCoordinate, 1);
Assert.AreEqual(Robot.YCoordinate, 0);
Robot.TurnLeft();
Robot.MoveBackward();
Assert.AreEqual(Robot.XCoordinate, 0);
Assert.AreEqual(Robot.YCoordinate, 0);
}
When we compile the solution it fails because we have not yet implemented the MoveBackward() method. Our next step is to write code that will pass compilation:

public void MoveBackward()
{
}
The last step is to write the code that will make the test pass:

public void MoveBackward()
{
switch(_Direction)
{
case DIRECTION.North:
_YCoordinate++;
break;
case DIRECTION.East:
_XCoordinate++;
break;
case DIRECTION.South:
_YCoordinate--;
break;
default:
_XCoordinate--;
break;
}
}
My code compiles fine, but when I was implementing the logic for my robot I made an error and my coordinates are incremented and decremented incorrectly. I also became careless and decided to check back in my code without determining if my test runs properly. The continuous integration server recognized the modification to source and started a new build. Of course it failed unit testing and promptly reported a broken build (see Figure 3).

The continuous integration server has done its job! Since I received instant feedback I not only know I was the developer who broke the build, but I also know what changed and can more easily find the issue in order to correct it. Here is the new implementation that compiles and passes the unit testing:


public void MoveBackward()
{
switch(_Direction)
{
case DIRECTION.North:
_YCoordinate--;
break;
case DIRECTION.East:
_XCoordinate--;
break;
case DIRECTION.South:
_YCoordinate++;
break;
default:
_XCoordinate++;
break;
}
}
This time I ran the tests to ensure they passed before checking in my source files. Now when I check in the source, CruiseControl.NET reports a successful build! (Note: TDD is a very in-depth subject and this article cannot possibly do it justice. A great resource on the subject is the book Test Driven Development in Microsoft.NET by James W. Newkirk and Alexei A. Vorontsov, available from Microsoft Press.)

Summary
One last thing to mention is the CruiseControl.NET monitor that runs on the desktop as a Windows tray icon. It can be pointed to the build server and provides instant feedback to team members about the result of a build or the state of the server itself. Hopefully this article has given you the basics for getting started with your own continuous integration process quickly and easily. Once you start and maintain a continuous integration development environment, you will wonder how you used to develop without one.


Page 2 of 2   « previous page

About Donald King
Donald King is the founder of Webforge Software, a Web-applications development and consulting firm located in Topeka, Kansas. Don has extensive experience in object-oriented technologies and Web-based application development.

Rick wrote: Too topical... where's the beef?
read & respond »
.NET News Desk wrote: Automatic Integration with CruiseControl.NET, NAnt, and NUnit. One of the most important and yet overlooked aspects of a software development project is the concept of regression testing during implementation. Regression testing is the practice of running tests for previously tested code following modification to ensure that faults have not been introduced or uncovered as a result of the changes made. In this article I will outline the need for continuous integration, automated builds, and testing, which support the tenets of regression testing and provide automation for the process. I will also introduce some of the free open source tools that can be used to effectively employ a continuous integration process, and we'll take a look at a scenario that demonstrates their use.
read & respond »
.NET News Desk wrote: Automatic Integration with CruiseControl.NET, NAnt, and NUnit. One of the most important and yet overlooked aspects of a software development project is the concept of regression testing during implementation. Regression testing is the practice of running tests for previously tested code following modification to ensure that faults have not been introduced or uncovered as a result of the changes made. In this article I will outline the need for continuous integration, automated builds, and testing, which support the tenets of regression testing and provide automation for the process. I will also introduce some of the free open source tools that can be used to effectively employ a continuous integration process, and we'll take a look at a scenario that demonstrates their use.
read & respond »
SYS-CON Australia News Desk wrote: Automatic Integration with CruiseControl.NET, NAnt, and NUnit. One of the most important and yet overlooked aspects of a software development project is the concept of regression testing during implementation. Regression testing is the practice of running tests for previously tested code following modification to ensure that faults have not been introduced or uncovered as a result of the changes made. In this article I will outline the need for continuous integration, automated builds, and testing, which support the tenets of regression testing and provide automation for the process. I will also introduce some of the free open source tools that can be used to effectively employ a continuous integration process, and we'll take a look at a scenario that demonstrates their use.
read & respond »
.NET News Desk wrote: Automatic Integration with CruiseControl.NET, NAnt, and NUnit. One of the most important and yet overlooked aspects of a software development project is the concept of regression testing during implementation. Regression testing is the practice of running tests for previously tested code following modification to ensure that faults have not been introduced or uncovered as a result of the changes made. In this article I will outline the need for continuous integration, automated builds, and testing, which support the tenets of regression testing and provide automation for the process. I will also introduce some of the free open source tools that can be used to effectively employ a continuous integration process, and we'll take a look at a scenario that demonstrates their use.
read & respond »
MICROSOFT .NET LATEST STORIES
Desktop Virtualization Market to be Worth at Least $1.8b by 2012 Up From Nothing
Pushing back against VMware, its chief rival, Tuesday, Citrix released its ballyhooed, on-demand XenDesktop, the widgetry that delivers custom, managed virtual Windows desktops from a data center server to a user over the network, and priced the stuff. Theres a free Express Edition for
Xenocode Introduces New Application Virtualization Technology
Xenocode launched its flagship offering, Xenocode Virtual Application Studio. Xenocode Virtual Application Studio is a next-generation application virtualization environment that allows Windows, .NET and Java-based desktop applications to be deployed in standalone executables that run
3rd International Virtualization Conference & Expo: Themes & Topics
From Application Virtualization to Xen, a round-up of the virtualization themes & topics being discussed in NYC June 23-24, 2008 by the world-class speaker faculty at the 3rd International Virtualization Conference & Expo being held by SYS-CON Events in The Roosevelt Hotel, in midtown
AJAX World - Deploying an ASP.NET AJAX RSS Reader on Linux
Have you ever wished you could run ASP.NET applications on Linux, without having to rewrite your code or leave the Visual Studio development environment? In this article, I show you how to port Steve Clements' AJAX ASP.NET RSS Reader to native Java and deploy it to Apache Tomcat on Lin
Citrix and Microsoft Unveil New Branch Office Application Delivery Solution
Citrix and Microsoft announced the availability of Citrix Branch Repeater , an innovative new line of branch office appliances developed and marketed as part of a strategic alliance between the two companies. By staging the delivery of applications and Windows services closer to branch
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS
SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

SYS-CON FEATURED WHITEPAPERS

ADS BY GOOGLE
BREAKING NEWS FROM THE WIRES
Juniper Gaining Ground Among Networking Pros as an Exciting Vendor -- New Research From TheInfoPro
TheInfoPro (TIP), an independent research network and leading supplier of market intelligence