Cruisecontrol. NET + SVN + msbuild + mstest Automatic Build Test Environment

Source: Internet
Author: User

From the book, we can see cruisecontrol. net. This is what I want. This is often done in daily work. You can download the source code from SVN, open Visual Studio, compile and run the test. This tool can automatically complete this series of tasks. You can also generate reports and monitor SVN changes.

Msbuild is in this location: C: \ WINDOWS \ Microsoft. NET \ framework \ v2.0.50727 \ msbuild.exe

Mstest in this location: D: \ Program Files \ Microsoft Visual Studio 8 \ common7 \ ide \ mstest.exe (depending on the installation path)

These two tools are provided by. NET and are described in detail in msdn.

SVN, Which is 1.5 now.

It is mainly about the configuration of cruisecontrol. net.

1. Download cruisecontrol. net. I use zip and decompress it to the installation directory. Contains four folders:

Cctray: trayProgramTo monitor the running results of the current service.
Examples: some sample configuration files
Server: Service Program

Webdashboard: A web monitoring program that allows you to view the service status and historical running results.

Remote is used for monitoring, and data is displayed in XML + XSL.

2. Configure ccnet. config

My configured results:

1 < Cruisecontrol >
2 < Project >
3 < Name > Ccnettest </ Name >
4 < Sourcecontrol Type = "SVN" >
5 < Trunkurl > File: // E:/code/testccnet/SVN/ccnettest </ Trunkurl >
6 < Workingdirectory > E: \ code \ testccnet \ workspase \ Source </ Workingdirectory >
7 </ Sourcecontrol >
8 < Tasks >
9 < Msbuild >
10 < Executable > C: \ windows \ Microsoft. NET \ framework \ v2.0.50727 \ msbuild.exe </ Executable >
11 < Workingdirectory > E: \ code \ testccnet \ workspase \ Source </ Workingdirectory >
12 < Projectfile > Ccnettest. sln </ Projectfile >
13 < Logger > F: \ nettool \ cruisecontrol. Net \ cruisecontrol. Net-1.4.0.3535 \ Server \ thoughtworks. cruisecontrol. msbuild. dll </ Logger >
14 < Targets > Build </ Targets >
15 < Timeout > 900 </ Timeout >
16 < Buildargs > /Noconsolelogger/P: configuration = debug/V: diag </ Buildargs >
17 </ Msbuild >
18 < Exec >
19 < Executable > Delfile. bat </ Executable >
20 <! -- <Basedirectory> D: \ Dev \ myproject </basedirectory> -->
21 < Buildargs > E: \ code \ testccnet \ workspase \ source \ testresults \ mstest-results.xml </ Buildargs >
22 < Buildtimeoutseconds > 300 </ Buildtimeoutseconds >
23 < Successexitcodes > -1, 0 </ Successexitcodes >
24 </ Exec >
25 < Exec >
26 < Executable > D: \ Program Files \ Microsoft Visual Studio 8 \ common7 \ ide \ mstest.exe </ Executable >
27 < Basedirectory > E: \ code \ testccnet \ workspase \ Source </ Basedirectory >
28 <! -- <Basedirectory> D: \ Dev \ myproject </basedirectory> -->
29 < Buildargs > /Testcontainer: testproject1 \ bin \ debug \ testproject1.dll/resultsfile: testresults \ mstest-results.xml </ Buildargs >
30 < Buildtimeoutseconds > 300 </ Buildtimeoutseconds >
31 < Successexitcodes > 0, 1, 3, 5 </ Successexitcodes >
32 <! -- <Environment>
33 <Variable name = "test. Path" value = "$ {ccnetworkingdirectory}"/>
34 </Environment> -->
35 </ Exec >
36 < Merge >
37 < Files >
38 < File > E: \ code \ testccnet \ workspase \ source \ testresults \ mstest-results.xml </ File >
39 </ Files >
40 </ Merge >
41 </ Tasks >
42 < Publishers >
43 < Xmllogger />
44 </ Publishers >
45 < Triggers >
46 <! -- Buildcondition = "forcebuild" -->
47 < Intervaltrigger Name = "Continuous" Seconds = "30"   />
48 </ Triggers >
49 </ Project >
50 </ Cruisecontrol >

Line 2 project: ccnet can monitor multiple projects and configure one project for each project;

Line 4 sourcecontrol: source code control. SVN is used here. There are more than 10 other options. Configure the svn source and workspace. The user password is also required for remote use.

Row 8 tasks: the task to be run in this project

Row 42 Publishers: first by default

Row 45 triggers: triggers condition. Currently, it runs once every 30 seconds. When buildcondition = "forcebuild", the default value for each compilation is ifmodificationexists, indicating thatCodeCompile Upon modification.

Iii. Focus on the configuration in the task

Msbuild section:

Executable: Program location

Workingdirectory: Job Location

Projectfile: Project File

Logger: The Recorder for compiling information

Targets: msbuild action

Buildargs: Compilation Parameters

Exec section:

Exec can run any command line program.

Use it to delete files and run mstest.

Merge section:

Merge the result XML file after mstest execution into the result file of this operation. In this way, you can see the mstest result in the webdashboard.

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.