The guide is written for set up Continuous Integration Environment for Distributed Automation Testing.
Tools: Hudson SVN NUnit WatiN FxCop VS2010
Language:C#
1.Install the testing develop tools
- Visual Studio 2010
- NUnit
Set .Net Framework supported runtime to V4.0 in the .config file:
Update the "nunit.exe.config" , "nunit-console.exe.config" under the \NUnit-2.5.10.11092\NUnit-2.5.10.11092\bin\net-2.0 folder.
add
<Startup>
<requiredRuntime version="v4.0.30319" />
</startup>
under <configuration> tags
add
<loadFromRemoteSources enabled="true" />
under <runtime>tags
- FxCop
Download the Microsoft Windows SDK for Windows 7 and .NET Framework 4 version 7.1.
Run %ProgramFiles%\Microsoft SDKs\Windows\v7.1\Bin\FXCop\FxCopSetup.exe to install FxCop.
2.Set up the hudson
- Hudson is an extensible Continuous Integration Server.
1) Download the hudson.war and jdk
2) Install jdk and set JAVA_HOME , path in the system environment
3) Create a path such as C:\hudson_run and copy the hudson.war to the path
4) Set the environment variable HUDSON_HOME eg:C:\hudson_run
5) Create the run bat: cd c:\hudson_run
java -jar hudson.war
6) Verify the hudson:check http://localhost:8080 on the browser
7) Config the environment variables such as JDK ,msbuild, FxCop
3.Version Control by SVN
- SVN is an open source version control tool
1) Download svn from http://ncu.dl.sourceforge.net/project/tortoisesvn/1.6.16/Application/TortoiseSVN-1.6.16.21511-win32-svn-1.6.17.msi
2) Download VisualSVN server and install it on the server
3) Create a repository on the server and copy the URL
4) Import your project to the server
5) Create a folder ,for example a folder named "Test",on the client and chech out the project from the server
4.Configure the hudson to run your testing project
- Create a project version controled by SVN on Hudson
1) New Job (eg.named SimpleLibrary01)
2) Choose Subversion and type in the Respository URL.
3) Add build step->Excute Windows batch command
4) Install the ViolationsPlugIn and Nunit PlugIn to show the FxCop report and the test results(Manage PlugIns).
5) Configure Report Violations
6) Build the job.
5.Distributed Test
- Using the hudon nodes to realize the distributed test
1) Manage Nodes->new node The nodes can be many remote control computers and they will control their browsers run the automation test.
2) Configure the nodes binding different jobs.
- Every node is a Slave of the Master server.
- Let one node just do the project build.
- Let other nodes that binding different group of test build after the first node build.
- Let a node only collect the result from every other nodes.Configure it build after any other node.
3) Install the join plugin to allow the result node run after other test nodes
4) To let the test run in its single envrionment,we use xcopy command in every test nodes configuration to copy the dll file.
5) Collect the reports from every nodes according to the test-result node.
- In every node configure the command :msbuild "%HUDSON_HOME%\jobs\SimpleLibrary01\workspace\SimpleLibrary01\SimpleLibrary01.csproj"
xcopy "%HUDSON_HOME%\jobs\SimpleLibrary01\workspace\SimpleLibrary01\fxcop-result.xml" "%HUDSON_HOME%\jobs\SimpleLibrary01-Result\workspace\Violation\" /e /s /r /y
-In the result node configure the command :nunit-console /xml:\\The server URL\hudson\jobs\SimpleLibrary01-Result\workspace\node1.xml "c:\nunit\node1\SimpleLibrary01.dll"
6) Start the slaves(nodes).
6.The email extention function
- We hope that every build in hudson can give a report email to us whether the project is stable or not.
- Althogh hudson has its email notification but it is not very enough to realize all we want.So we have install an nother plugin.
1) Install the extended e-mail plugin.
2) Configure the Extended E-mail Notification in the Manage Hudson .The Default Content references to the template that include the email contents and styles.
3) Configure the Editable E-mail Notification in the project configuration.You can add the trigger that when to send the emai.