Bullseye with Visual - code-coverage

i have issue with bullseye coverage.
I need to run bullseye coverage from command line for continious integration.
I use commands:
covselect.exe --file test.cov --add .\
cov01.exe --on
MSBuild /maxcpucount:8 /t:Rebuild /p:Configuration=Release /p:Platform="x64" MVPF.sln
MSBuild /maxcpucount:8 /t:Rebuild /p:Configuration=Release /p:Platform="x64" MVPFTest.sln
cov01.exe --off
covxml -f test.cov -o bullseyecoverage-result.xml
but i have empty test.cov and report.xml files into working directory.
Could you explain what i should to do step by step for coverage measuring?

Your commands look good so far.
But you don't execute your tests. The tests need to be executed in order to measure the coverage. With the build you are only instrumenting the code.
So the steps should be :
cov01.exe --on
MSBuild /maxcpucount:8 /t:Rebuild /p:Configuration=Release /p:Platform="x64" MVPF.sln
MSBuild /maxcpucount:8 /t:Rebuild /p:Configuration=Release
/p:Platform="x64" MVPFTest.sln
MVPFTest.exe
cov01.exe --off
I like to add
cov01.exe -s
because then I see in the Jenkins Console print out the status.

yeah I realize its super old question but it is high in search engine. You need to run a program so the coverage files can be created. The general steps are:
1) Build with coverage flags (or with BE on like you did)
2) Run something that uses what you have built. The program itself or some tests
3) Collects results

Related

msbuild configuration on Jenkins cluster installed on windows

I have jenkins installed on windows machine and trying to create pipeline for .net project.
The msbuild is not working on Jenkins pipeline and giving error msbuild not recognised internal or external command.
I tried passing as a script
Script{
def msbuild= tool name: 'ms',type:'MSBuild'
bat "\"${msbuild}\" ${workspace}//proj.sln /nologo /nr:false /p:Platform="Any CPU" /p: Configuration:Release /t:Clean"
}
As well in just pipeline formats
Step{
bat "ms ${workspace}//proj.sln /nologo /nr:false /p:Platform="Any CPU" /p: Configuration:Release /t:Clean"
}
In the pipeline but it is not able to find msbuild even though it is configured Global Tool and giving the same name in tool name,but not working.
However when tried as a freestyle project and tried building, i was able to list the msbuild configuration from drop-down to fetch 'ms'
Passed build file as ${workspace}//proj.sln
Command line parameters as
nologo /nr:false /p:Platform="Any CPU" /p: Configuration:Release /t:Clean
It was able to build correctly without any issues.
Not sure why it is not getting resolved in pipeline?
Any suggestions to fix this is helpful.
Tried giving the msbuild executable location from .Net application but it is a different system, it did not work.

Build/deploy Vue.js project through Jenkins

I am new to Jenkins but have done a few builds/deployment jobs of .net project successfully.
Now I am trying to build/deploy Vue.js project through Jenkins but just cannot get through...
I can build the project directly on a server using command prompt. It builds and creates files for deployment in a right directory.
When I am trying to do it in Jenkins job (using the same npm commands) it does not give any error messages, says it built successfully but it does NOT create any files for deployment.
Does anybody encounter this problem? Did anybody build Vue js project through Jenkins? Any help appreciated. Thanks!
In execute windows batch command I run:
cd myworkdirectory
npm install
npm run build
Not too complex, as I found.
Create freestyle project.
In section Source Code Management please define your repository.
In section Build Triggers please define triggers
In section Build define either Execute Windows batch command or Execute shell within sections like (my choice in the moment - windows):
git checkout develop
npm -g install
npm run build
del /s /f /q c:\applications\frontend-app-build\*.*
for /f %%f in ('dir /ad /b c:\applications\frontend-app-build\') do rd /s /q c:\applications\frontend-app-build\%%f
robocopy dist c:\applications\frontend-app-build\ /E

How to integrate Jacoco report in Sonarqube

I'm using Jenkins+Jacoco+Sonarqube to test my code. In Jenkins, my mvn command is:
mvn clean install sonar:sonar.
After code build in Jenkins, I am able to see the code coverage in Jenkins.
But I cannot get proper coverage percentage in SonarQube.
This could be a source path issue, maybe you don’t analyze the same sources. Do you have any excluded source files in Jacoco and Jenkins that you didn’t exclude in SonarQube properties, or vice versa?
Your command doesn't include the generation of the reports. Try instead:
mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install sonar:sonar
Breaking it down:
mvn invoke the build system
clean delete all old build output
org.jacoco:jacoco-maven-plugin:prepare-agent turn on test reporting
install build and install the result in the local Maven repository
sonar:sonar run a SonarQube analysis

Jenkins MSBuild SonarQube Runner 1.0.2 projectinfo.xml file not found

I'm having trouble running the sonarqube msbuild runner v1.0.2 in jenkins.
The build runs fine, but the plugin doesn't seem to import the sonar targets correctly.
Here's the logs when the sonar build kicks off:
[workspace] $C:\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MS_Build_Runner_1.0.2\MSBuild.SonarQube.Runner.exe begin /k:my.project /n:myprojectname /v:1.0 /d:sonar.host.url=http://1.1.1.1:9000/
MSBuild SonarQube Runner Bootstrapper 1.0.2.0
Default properties file was found at C:\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MS_Build_Runner_1.0.2\SonarQube.Analysis.xml
Loading analysis properties from C:\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MS_Build_Runner_1.0.2\SonarQube.Analysis.xml
Pre-processing started.
Preparing working directories...
Checking for updates...
MSBuild SonarQube Runner Pre-processor 1.0.2.0
10:17:18.025 Loading analysis properties from C:\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MS_Build_Runner_1.0.2\SonarQube.Analysis.xml
10:17:18.056 Updating build integration targets...
10:17:18.072 Fetching analysis configuration settings...
10:17:21.332 Generating rulesets...
Pre-processing succeeded.
Path To MSBuild.exe: C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
Executing the command cmd.exe /C " C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /p:Configuration=Development /t:Clean,Build /tv:14.0 /p:VisualStudioVersion=14.0 /m:1 /fl2 /flp2:verbosity=diagnostic myprojectname.sln " && exit %%ERRORLEVEL%% from C:\.jenkins\jobs\Technology - WWW - Content Store Client\workspace
[workspace] $ cmd.exe /C " C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /p:Configuration=Development /t:Clean,Build /tv:14.0 /p:VisualStudioVersion=14.0 /m:1 /fl2 /flp2:verbosity=diagnostic ContentStoreClientSolution.sln " && exit %%ERRORLEVEL%%
Microsoft (R) Build Engine version 4.6.81.0...
And here when if finishes:
[workspace] $ C:\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MS_Build_Runner_1.0.2\MSBuild.SonarQube.Runner.exe end
MSBuild SonarQube Runner Bootstrapper 1.0.2.0
Default properties file was found at C:\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MS_Build_Runner_1.0.2\SonarQube.Analysis.xml
Loading analysis properties from C:\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MS_Build_Runner_1.0.2\SonarQube.Analysis.xml
Post-processing started.
No ProjectInfo.xml files were found. Possible causes: you specified an invalid build configuration or the custom MSBuild analysis targets were not imported.
MSBuild SonarQube Runner Post-processor 1.0.2.0
Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.
10:21:04.257 Creating a summary markdown file...
Post-processing failed. Exit code: 1
ERROR: Execution of MSBuild SonarQube Runner failed (exit code 1)
The plugin installs itself int he tools subfolder of jenkins. But, looking in the project workspace, I can see a folder called .sonar that appears to have all the correct files and targets etc in it.
Any ideas on why the build is failing?
You need to use MSBuild 12 at least (version 14, shipping with VS 2015 will give you more accurate analysis results with version 1.1 of the SonarQube Scanner for MSBuild & C# Plugin 4.4).
The ImportsBefore targets are not deployed for MSBuild 4.0 - which is why no information is being collected during your MSBuild execution. We're not going to add support for MSBuild 4.0 or earlier versions.
Note that in the upcoming SonarQube Scanner for MSBuild 1.1 version, the error message mentioning ProjectInfo.xml has been largely improved to let you know about the potential root causes: See https://jira.sonarsource.com/browse/SONARMSBRU-180

devenv.exe execute through jenkin's job doesn't work

i am trying to execute devenv.exe through windows batch command plugin in Jenkins
but it keeps on executing and fails to launch the application.
Console Output :
**In progressConsole Output
Started by user anonymous
Building on master in workspace C:\Program Files (x86)\Jenkins\jobs\TEMP\workspace
[workspace] $ cmd /c call C:\Windows\TEMP\hudson3900292017086958332.bat
C:\Program Files (x86)\Jenkins\jobs\TEMP\workspace>set DEVPATH=C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE
C:\Program Files (x86)\Jenkins\jobs\TEMP\workspace>set PATH=D:\app\nazopay\product\11.2.0\dbhome_1\bin;D:\app\nazopay\product\11.2.0\client_1;C:\Program Files (x86)\Integrity\IntegrityClient10\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\cde\tools;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Java\jdk1.6.0_23\bin\;C:\Program Files (x86)\Google\Chrome\Application;C:\MingW;C:\PROGRA~2\INTEGR~1\Toolkit\mksnt;%JAVA_HOME%;,;C:\Program Files\Java\jdk1.6.0_23;,;C:\Program Files\Java\jdk1.6.0_23\bin;%CLASS_PATH%;,;C:\Program Files\Java\jdk1.6.0_23\lib;,;C:\Program Files\Java\jdk1.6.0_23\lib;;C:\Program Files (x86)\M**icrosoft Visual Studio 10.0\Common7\IDE
C:\Program Files (x86)\Jenkins\jobs\TEMP\workspace>devenv.exe
You must execute devenv.com.
The devenv.exe always attempts to open GUI, even when commands are given, and it can't. The devenv.com has output directed to standard output and works fine from Jenkins.
You also must pass arguments.
Without arguments both devenv.com and devenv.exe just start the IDE GUI, which is not what you want. The correct command-line is
devenv.com projectname.sln /Build Release /Project projectname
First is path to the solution you want to build. Then the /Build flag is followed by configuration. If you have multiple platforms, you have to pass configuration and platform combination, e.g. Release|Win32. The /Project flag names project to build (including all dependencies). If omitted, it builds all projects selected for build in given configuration.
Why don't you use msbuild?
This would be a good starting point for your windows build script:
call "%VS100COMNTOOLS%\vsvars32.bat"
msbuild projectname.sln /target:Rebuild /l:FileLogger,Microsoft.Build.Engine;logfile=msbuild.log || goto error
goto end
:error
#echo ERROR: Build failed
exit/b 1
:end
exit/b 0
This way you can also capture the output log that you can parse with one of the jenkins plugins.
Ofcourse, adjust the VS100COMNTOOLS to your version of MSVS

Resources