Use cruisecontrol. Net for continuous integration II

Source: Internet
Author: User

Part 1Article. Net installation and deployment. And implements VSS monitoring.Source codeServer, automatically obtainedCode, Automatically build, and check the code specifications. This article focuses on how to use cc. Net for automated unit testing.

The default unit test tool supported by CC. NET is nunit. The following describes how to configure and implement the nunit automatic unit test function. Open the configuration file cursiecontrol. NET Server of cursiecontrol. Net config. A project has been created in the previous article and the code is:

< Cruisecontrol >  

< Project Name = "Testproject" Weburl = "Http: // 127.0.0.1/ccnet /" >  

< Workingdirectory > E: \ dailybuild </ Workingdirectory >  

< Artifactdirectory > E: \ dailybuild \ log </ Artifactdirectory >  

< Labeller Type = "Datelabeller" > </ Labeller >  

< Sourcecontrol Type = "VSS" Autogetsource = "True" Applylabel = "True" >  

< Project > $/Jillzhang. dailybuild. Root/jillzhang. dailybuild </ Project >  

< Username > Zhangyubin </ Username >  

< Password > 123456 </ Password >  

< Ssdir > \ 192.168.1.200 \ VSS \ </ Ssdir >  

< Cleancopy > False </ Cleancopy >  

</ Sourcecontrol >  

< Tasks >  

< Exec >  

< Executable > D: \ windows \ Microsoft. NET \ framework \ v2.0.50727 \ msbuild.exe </ Executable >  

< Basedirectory > E: \ dailybuild </ Basedirectory >  

< Buildargs > Dailybuild. msbuild/P: configuration = release </ Buildargs >  

< Buildtimeoutseconds > 1200 </ Buildtimeoutseconds >  

</ Exec >  

< Merge >  

< Files >  

< File > E: \ dailybuild \ log \ build. fxcop. xml </ File >  

</ Files >  

</ Merge >  

</ Tasks >  

</ Project >  

</ Cruisecontrol >  

To add a nunit task, add the <nunit> sub-element to the <project> element. For more information about its usage, see jillzhang. dailybuild. test is a unit test project. Add <nunit> in <tasks>. The Code is as follows:
 

< Nunit >  

< Path > D: \ Program Files \ nunit 2.4.6 \ bin \ nunit-console.exe </ Path >  

< Assemblies >  

< Assembly > E: \ dailybuild \ jillzhang. dailybuild. Test \ bin \ release \ jillzhang. dailybuild. Test. dll </ Assembly >  

</ Assemblies >  

< Timeout > 60000 </ Timeout >  

</ Nunit >  

Specify the absolute path of the tool using the path. in <assemblys>, addProgramSet, note that to ensure the effect, the DLL here is best consistent with the DLL location generated by msbuild. For example, if it is in debug mode, it should be: e: \ dailybuild \ jillzhang. dailybuild. test \ bin \ debug \ jillzhang. dailybuild. test. DLL

Now, after adding this line of code, we can perform automated unit tests. Let's take a look at the results and check out the embedded solution again to open the Web dashboard website. We can see that the activity status of the project has changed as follows:

Before embedding

After embedding

When the file version in VSS changes, CC. net can detect this change and handle it. When checking for updates, the status changes to checkingmodifcations. when an update is detected, CC. net will start the generation operation,

When CC. when the activity status of net changes from buildding to sleeping again, the Project Integration is completed. Click the project name to view the last integration result, first, we can check who updated the project files during the integration,

Then we can view the generated results. After adding nunit, the generated results will be more as follows:

You can also use nunit detail to view details.

The specific information is:

On this page, you can clearly see whether the unit test passes.

Next, we will introduce a non-good detection tool, cctray.exe, which implements the real-time monitoring function for cc.net, which is similar to the Web doashboard. You can find its download link in the navigation bar of the website:

Download and install. After opening, cctray is an interface like this

Click the setting option of file. The following page is displayed:

First, add monitoring for a project and click Add.

Click Add Server.

Cctray automatically obtains the project list and selects the project to be monitored.

Shows the final configured cctray:

Double-click the listview item on the right to open the Web dashboard. When the code is updated, cctray indicates the following:

By changing the icon color, you can clearly see the current running status of CC. net.

For more information about automatic release and deployment, see the following section.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.