Installating Jenkins Download the jenkins from the following url http://jenkins-ci.org/ Download the latest war file jenkins.war Place the war inside the c:
Go to command prompt and select the jenkins.war directory and excute the following command java -jar jenkins.war Installation will start, it will let u know the path of jenkins home directory
Go to Http:localhost:8080 default url. We can change the port by using following command java -jar httpPort=8081 Installation as Window service [Optional] Download the window service Option 1 jenkins-1.519.msi,setup.exe Run the file, Service will be installed in the name Jenkins
Option 2 go to the url Http:localhost:8080 Locate Manage Jenkins Install as window service, choose this option, then jenkins will automatically install the window service with name Jenkins
Setup of Jenkins
Create a Job New Job will redirect to page, enter the project or job name Choose Build a free-style software project option
then click ok Will it redirect to configure page http://localhost:8080/job/Musicstore3/configure Choose the version control directory
Select Poll SCM[Mention when to collect file from repository Save and Build it Build will create a workspace directory under .jenkins folder In Jenkins
Install the Following plugins Msbuild,Mstest,Voilation,Fxcops,Static analysis,CCM,Ncover
Build Process MS Build Configure MSBuild version (http://localhost:8080/configure ) under Msbuild section Then select the project -->Configure and select the add build steps Choose Build a visual studio projector solution using Msbuild Save and build project select the project and go to console output to see the changes[http://localhost:8080/job/Musicstore3/4/console]
MsTest select the project-->Configure [http://localhost:8080/job/MVC3MusicStore/configure] Choose Execute window batch command
cd C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE del %WORKSPACE%\build_Output\UnitResult.trx MSTest.exe /testcontainer:%WORKSPACE%\src\MusicStore\MusicStoreTest\bin\Debug\MusicStoreTest.dll /resultsfile:%WORKSPACE%\build_Output\UnitResult.trx
FxCop
Open the Fxcop tool File->Project->Add Targets [add rule optional] File->Save the Project as in the working directory
Save and Commit to SVN Select the project, configure--> add bactch command insert the following value
Save and Build the project Choose the build-->Voilation
Select the Graph
CCM Download the CCM Plugin Place the ccm.config file in Build_output folder and check in the code. Add the following cmd in Window batch command cd %WORKSPACE%\ build_Output "C:\Program Files (x86)\ccm\bin\ccm.exe" ccm.config > %workspace%\build_Output\ccm_results.xml exit 0 In the post build action add [Publish CCM Analysis result Update the ccm xml path
Build the project to see the CCM result
Style Cop
Go to project folder and edit the project file[csproj] Add the following line to csproj file <Import Project="$(SolutionDir)\Stylecop\v4.7\StyleCop.targets" /> add the style cop folder under the solution directory [copy from installation location]
Commit the code Go to Jenkins -->Project-->Configure In the Report Violation part add the following line against the style cop /*/*/*/*/*/StyleCopViolations.xml [ Locate the StyleCopViolations.xml from the workspace and add */ for each child ] Save and build the project Select the graph to see the style cop issues
Style.target file <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <!-- Specify where tasks are implemented. --> <UsingTask AssemblyFile="$(SolutionDir)\StyleCop\v4.7\StyleCop.dll" TaskName="StyleCopTask"/>
<!-- Define all new properties which do not need to have both StyleCop and SourceAnalysis variations. --> <PropertyGroup> <!-- Specifying 0 will cause StyleCop to use the default violation count limit. Specifying any positive number will cause StyleCop to use that number as the violation count limit. Specifying any negative number will cause StyleCop to allow any number of violations without limit. --> <StyleCopMaxViolationCount Condition="'$(StyleCopMaxViolationCount)' == ''">0</StyleCopMaxViolationCount> </PropertyGroup>
<!-- Determine what files should be checked. Take all Compile items, but exclude those that have set ExcludeFromStyleCop=true or ExcludeFromSourceAnalysis=true. --> <CreateItem Include="@(Compile)" Condition="('%(Compile.ExcludeFromStyleCop)' != 'true') and ('%(Compile.ExcludeFromSourceAnalysis)' != 'true')"> <Output TaskParameter="Include" ItemName="StyleCopFiles"/> </CreateItem>
<!-- Show list of what files should be excluded. checked. Take all Compile items, but exclude those that have set ExcludeFromStyleCop=true or ExcludeFromSourceAnalysis=true. --> <CreateItem Include="@(Compile)" Condition="('%(Compile.ExcludeFromStyleCop)' == 'true') or ('%(Compile.ExcludeFromSourceAnalysis)' == 'true')"> <Output TaskParameter="Include" ItemName="StyleCopExcludedFiles"/> </CreateItem>
<!-- Add the StyleCop.cache file to the list of files we've written - so they can be cleaned up on a Build Clean. --> <CreateItem Include="StyleCop.Cache" Condition="'$(StyleCopCacheResults)' == 'true'"> <Output TaskParameter="Include" ItemName="FileWrites"/> </CreateItem> </Target> </Project>
NCover Download the trail version of ncover4[https://www.ncover.com/trial/trial_home] Desktop application Open the Ncover desktop explorer
Enter the Name of the project Click on Auto Configure[ at same time run the test in debug mode] It will recognise the project and update the process as QTAgent32.exe On the Filter you can include corresponding dll [MusicStoreTest.dll] Save and close run the following command in the command prompt ncover report --project="MusicStore3" file="musicstore.html
Out put will be stored in c:\users\Kirithikav\MusicStore.html. In the jenkins Create a batch command window cd %WORKSPACE%\build_Output del %WORKSPACE%\build_Output\Ncover_musicstore.html ncover report --project="MusicStore3" file="Ncover_musicstore.html" Publish the ncover result Build the project Click on code coverage Click on the branch [proceed clicking on graph will take you in deep[to the code level]