Sei sulla pagina 1di 15

Svn Folder Structure

Project Structure inside Svn



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

cd %WORKSPACE%\"C:\Program Files (x86)\Microsoft Fxcop
10.0\FxCopCmd.exe" /p:%WORKSPACE%\tools\MusicStore3.Fxcop
/out:%WORKSPACE%\build_Output\fxcopResult.xml
exit 0
select Post-build Actions -->Violation Report

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"/>

<PropertyGroup>
<BuildDependsOn>$(BuildDependsOn);StyleCop</BuildDependsOn>

<RebuildDependsOn>StyleCopForceFullAnalysis;$(RebuildDependsOn)</RebuildDependsO
n>
</PropertyGroup>

<!-- Define StyleCopForceFullAnalysis property. -->
<PropertyGroup Condition="('$(SourceAnalysisForceFullAnalysis)' != '') and
('$(StyleCopForceFullAnalysis)' == '')">

<StyleCopForceFullAnalysis>$(SourceAnalysisForceFullAnalysis)</StyleCopForceFull
Analysis>
</PropertyGroup>
<PropertyGroup Condition="'$(StyleCopForceFullAnalysis)' == ''">
<StyleCopForceFullAnalysis>false</StyleCopForceFullAnalysis>
</PropertyGroup>

<!-- Define StyleCopCacheResults property. -->
<PropertyGroup Condition="('$(SourceAnalysisCacheResults)' != '') and
('$(StyleCopCacheResults)' == '')">
<StyleCopCacheResults>$(SourceAnalysisCacheResults)</StyleCopCacheResults>
</PropertyGroup>
<PropertyGroup Condition="'$(StyleCopCacheResults)' == ''">
<StyleCopCacheResults>true</StyleCopCacheResults>
</PropertyGroup>

<!-- Define StyleCopTreatErrorsAsWarnings property. -->
<PropertyGroup Condition="('$(SourceAnalysisTreatErrorsAsWarnings)' != '') and
('$(StyleCopTreatErrorsAsWarnings)' == '')">

<StyleCopTreatErrorsAsWarnings>$(SourceAnalysisTreatErrorsAsWarnings)</StyleCopT
reatErrorsAsWarnings>
</PropertyGroup>
<PropertyGroup Condition="'$(StyleCopTreatErrorsAsWarnings)' == ''">
<StyleCopTreatErrorsAsWarnings>true</StyleCopTreatErrorsAsWarnings>
</PropertyGroup>

<!-- Define StyleCopEnabled property. -->
<PropertyGroup Condition="('$(SourceAnalysisEnabled)' != '') and
('$(StyleCopEnabled)' == '')">
<StyleCopEnabled>$(SourceAnalysisEnabled)</StyleCopEnabled>
</PropertyGroup>
<PropertyGroup Condition="'$(StyleCopEnabled)' == ''">
<StyleCopEnabled>true</StyleCopEnabled>
</PropertyGroup>

<!-- Define StyleCopOverrideSettingsFile property. -->
<PropertyGroup Condition="('$(SourceAnalysisOverrideSettingsFile)' != '') and
('$(StyleCopOverrideSettingsFile)' == '')">

<StyleCopOverrideSettingsFile>$(SourceAnalysisOverrideSettingsFile)</StyleCopOve
rrideSettingsFile>
</PropertyGroup>
<PropertyGroup Condition="'$(StyleCopOverrideSettingsFile)' == ''">
<StyleCopOverrideSettingsFile> </StyleCopOverrideSettingsFile>
</PropertyGroup>

<!-- Define StyleCopOutputFile property. -->
<PropertyGroup Condition="('$(SourceAnalysisOutputFile)' != '') and
('$(StyleCopOutputFile)' == '')">
<StyleCopOutputFile>$(SourceAnalysisOutputFile)</StyleCopOutputFile>
</PropertyGroup>
<PropertyGroup Condition="'$(StyleCopOutputFile)' == ''">

<StyleCopOutputFile>$(IntermediateOutputPath)StyleCopViolations.xml</StyleCopOut
putFile>
</PropertyGroup>

<!-- 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>

<!-- Define target: StyleCopForceFullAnalysis -->
<Target Name="StyleCopForceFullAnalysis">
<CreateProperty Value="true">
<Output TaskParameter="Value" PropertyName="StyleCopForceFullAnalysis" />
</CreateProperty>
</Target>

<!-- Define target: StyleCop -->
<Target Name="StyleCop" Condition="'$(StyleCopEnabled)' != 'false'">
<Message Text="Forcing full StyleCop reanalysis."
Condition="'$(StyleCopForceFullAnalysis)' == 'true'" Importance="Low" />

<!-- 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>

<Message Text="Analyzing @(StyleCopFiles)" Importance="Low" />

<!-- 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>

<ItemGroup>
<StyleCopFiles Remove="@(ExcludeFromStyleCop)" />
</ItemGroup>

<Message Text="Excluding @(StyleCopExcludedFiles)" Importance="Normal"
Condition="'@(StyleCopExcludedFiles)' != ''" />

<!-- Run the StyleCop MSBuild task. -->
<StyleCopTask
ProjectFullPath="$(MSBuildProjectDirectory)"
SourceFiles="@(StyleCopFiles)"
AdditionalAddinPaths="@(StyleCopAdditionalAddinPaths)"
ForceFullAnalysis="$(StyleCopForceFullAnalysis)"
DefineConstants="$(DefineConstants)"
TreatErrorsAsWarnings="$(StyleCopTreatErrorsAsWarnings)"
CacheResults="$(StyleCopCacheResults)"
OverrideSettingsFile="$(StyleCopOverrideSettingsFile)"
OutputFile="$(StyleCopOutputFile)"
MaxViolationCount="$(StyleCopMaxViolationCount)">
<Output TaskParameter="ViolationCount"
PropertyName="StyleCopViolationCount" />
</StyleCopTask>

<CreateItem Include="$(StyleCopOutputFile)">
<Output TaskParameter="Include" ItemName="FileWrites"/>
</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]

Potrebbero piacerti anche