Sonar Runner:- INFO: Could not resolve file paths - msbuild

I am trying to run Sonar Runner through CMD Line and want to scan all data through my Lcov file but after Running sonar Runner and it's showing Error in reading file .I crossed checked each and every path mentioned in file manually and its working fine.But still It's giving me the error as below:-
>INFO: Integration Test Coverage Sensor is started
INFO: Overall Coverage Sensor is started
INFO: Analysing [C:\Tests\lcov.dat]
INFO: Could not resolve 67 file paths in [C:\Trunk\lcov.dat], first unr
esolved path: C:\Trunk\Web\App_Themes\Core\AppStart\UserAuth.js"
I tried to run my Runner as below:-
>1>Go to Root directory of Project and Open CMD.
>2> C:\Sonar\Sonar_Runner\MSBuild.SonarQube.Runner.exe begin /k:"MobileJs" /n:"MobileJs" /v:"1.0" /d:"sonar.javascript.lcov.reportPath"=C:\Trunk\lcov.dat
>3>"C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" /t:Rebuild
>4>C:\Sonar\Sonar_Runner\MSBuild.SonarQube.Runner.exe end
I followed each and every process given in the below link but did not get luck here.
It's again and again giving me the same error in last step only while analyzing coverage.
Note:- LCOV file contained java script coverage report

Related

Loading pre-compiled files thorugh feature files in Karate [duplicate]

I am attempting to execute my tests using the karate stand-alone jar. Throughout my project, I use the read('classpath:') when locating files.
However, when I attempt to execute my tests from the CLI, I receive the following error:
src.test.java.Users.getUser: -unknown-:6 - javascript evaluation failed: read('classpath:commonUtils.feature'), java.io.FileNotFoundException: commonUtils.feature (The system cannot find the file specified)
Command: java -jar -Dkarate.config.dir="src/test/java" karate.jar -e DEV -t #tests src/test
It seems that I will have to declare the classpath on execution, would you be able to provide some insight on how to do this please? I'm not sure whether my issue is linked to [karate][standalone] Error : could not find or read file
Can you try the ZIP release and if you open the karate batch file you will see this:
java -cp karate.jar:. com.intuit.karate.Main $*
So the trick to setting a custom classpath is to use the com.intuit.karate.Main entry point and in the above example the current dir is also added to the classpath.
It would be great if you try the current RC version (0.9.5.RC3) to ensure we have everything working as expected.
For more information, see this part of the docs: https://github.com/intuit/karate/tree/develop/karate-netty#custom-classpath

SonarQube scanner for MSBuild: end MSBuild integration failed

I'm having issues trying to execute the SonarQube Scanner. The begin part seems to run without issues, and also the MSBuild command, but the end part fails.
1st step: I execute the following SonarQube Scanner command:
D:\workspace\MasterData>SonarQube.Scanner.MSBuild.exe begin /k:"masterdata" /n:"MasterData" /v:"1.0" /d:sonar.host.url=http: //xyz.com.br:9000/sonarqube /d:sonar.login=5773c2ca935fde42c72494a96de5a68a5b6899d1 /d:sonar.verbose=true
SonarQube Scanner for MSBuild 2.2
Default properties file was found at D:\sonar-scanner-msbuild-2.2.0.24\SonarQube.Analysis.xml
Loading analysis properties from D:\sonar-scanner-msbuild-2.2.0.24\SonarQube.Analysis.xml
sonar.verbose=true was specified - setting the log verbosity to 'Debug'
Pre-processing started.
Preparing working directories...
Using environment variables to determine the download directory...
Removing the existing directory: D:\workspace\MasterData\.sonarqube
Creating directory: D:\workspace\MasterData\.sonarqube
SonarQube server URL: http: //xyz.com.br:9000/sonarqube
SonarQube Scanner for MSBuild 2.2
15:11:10.032 Loading analysis properties from D:\sonar-scanner-msbuild-2.2
.0.24\SonarQube.Analysis.xml
15:11:10.04 sonar.verbose=true was specified - setting the log verbosity to 'Debug'
15:11:10.042 Updating build integration targets...
15:11:10.045 Installed SonarQube.Integration.ImportBefore.targets to C:\Users\AppData\Local\Microsoft\MSBuild\14.0\Microsoft.Common.targets\ImportBefore
15:11:10.046 Installed SonarQube.Integration.ImportBefore.targets to C:\Users\f
g009adm\AppData\Local\Microsoft\MSBuild\12.0\Microsoft.Common.targets\ImportBefore
15:11:10.048 Installed SonarQube.Integration.targets to D:\workspace\MasterData\.sonarqube\bin\targets
15:11:10.049 Creating config and output folders...
15:11:10.049 Creating directory: D:\workspace\MasterData\.sonarqube\conf
15:11:10.049 Creating directory: D:\workspace\MasterData\.sonarqube\out
15:11:10.055 Fetching analysis configuration settings...
15:11:10.062 Fetching properties for project 'masterdata' from http: //xyz.com.br:9000/sonarqube/api/properties?resource=masterdata...
15:11:10.062 Downloading from http: //xyz.com.br:9000/sonarqube/api/properties?resource=masterdata...
15:11:10.214 Downloading from http: //xyz.com.br:9000/sonarqube/api/updatecenter/installed_plugins...
15:11:10.239 Fetching quality profile for project 'masterdata' from http: //xyz.com.br:9000/sonarqube/api/qualityprofiles/search?projectKey=masterdata...
15:11:10.24 Downloading from http: //xyz.com.br:9000/sonarqube/api/qu
alityprofiles/search?projectKey=masterdata...
15:11:10.272 Downloading from http: //xyz.com.br:9000/sonarqube/api/rules/search?f=repo,name,severity,lang,internalKey,templateKey,params,actives&ps=
500&activation=true&qprofile=cs-sbs-cs-default-201410-86215&p=1...
15:11:10.451 Downloading from http: //xyz.com.br:9000/sonarqube/api/rules/search?f=internalKey&ps=500&activation=false&qprofile=cs-sbs-cs-default-201410-86215&p=1&languages=cs...
15:11:10.506 Generating rulesets...
15:11:10.506 Generating the FxCop ruleset: D:\workspace\MasterData\.sonarq
ube\conf\SonarQubeFxCop-cs.ruleset
15:11:10.518 Writing Roslyn generated ruleset to D:\workspace\MasterData\.sonarqube\conf\SonarQubeRoslyn-cs.ruleset...
15:11:10.534 Writing Roslyn analyzer additional file to D:\workspace\MasterData\.sonarqube\conf\cs\SonarLint.xml...
15:11:10.536 Provisioning analyzer assemblies for cs...
15:11:10.538 Installing required Roslyn analyzers...
15:11:10.538 Local analyzer cache: C:\Users\fg009adm\AppData\Local\Temp\7\.sonarqube\.static
15:11:10.538 Processing plugin: csharp version 1.23.0.1828
15:11:10.54 Cache hit: using plugin files from C:\Users\AppData\Local\Temp\7\.sonarqube\.static\csharp_1.23.0.1828\SonarAnalyzer-1.23.0.1828.zip
15:11:10.566 Pre-processing succeeded.
2nd step: I execute the following MSBuild command:
MSBuild.exe /t:Rebuild MasterDataWebServices.sln
Since the MSBuild log is quite big, I will not provide it here. There is a Build succeeded message, with 5 warnings and 0 errors.
3rd step: I execute the following SonarQube Scanner end command:
D:\workspace\MasterData>SonarQube.Scanner.MSBuild.exe end
SonarQube Scanner for MSBuild 2.2
Default properties file was found at D:\sonar-scanner-msbuild-2.2.0.24\SonarQube.Analysis.xml
Loading analysis properties from D:\sbs1\sonar-scanner-msbuild-2.2.0.24\SonarQube.Analysis.xml
Post-processing started.
SonarQube Scanner for MSBuild 2.2
14:25:22.961 Loading the SonarQube analysis config from D:\workspace\MasterData\.sonarqube\conf\SonarQubeAnalysisConfig.xml
14:25:22.964 Not running under TeamBuild
14:25:22.964 Analysis base directory: D:\workspace\MasterData\.sonarqube
Build directory:
Bin directory: D:\workspace\MasterData\.sonarqube\bin
Config directory: D:\workspace\MasterData\.sonarqube\conf
Output directory: D:\workspace\MasterData\.sonarqube\out
Config file: D:\workspace\MasterData\.sonarqube\conf\SonarQubeAnalysisConfig.xml
Generating SonarQube project properties file to D:\workspace\MasterData\.sonarqube\out\sonar-project.properties
The SonarQube MSBuild integration failed: SonarQube was unable to collect the required information about your projects.
Possible causes:
1. The project has not been built - the project must be built in between the begin and end steps
2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 12.0 upwards are supported
3. The begin, build or end steps have not all been launched from the same folder
Writing processing summary to D:\workspace\MasterData\.sonarqube\out\ProjectInfo.log
Generation of the sonar-properties file failed. Unable to complete SonarQube ana
lysis.
14:25:22.988 Creating a summary markdown file...
14:25:22.989 Post-processing failed. Exit code: 1
I was facing the same problem. In my case I installed corresponding MSBuild version required by my version of Sonar and it worked just fine.
My SonarScanner required version 14.0 or upwards of MSBuild, then I downloaded Microsoft Build Tools 2015.
In your case I believe it this version will work too and if not you can try this version more specifically.
Hope it helps.

Jenkins: Error in Selenium Publish Report

I have properly configured the Seleniumhq plugin into Jenkins. I've also tried to run it in my local Jenkins and it worked. The problems I encounter are as follows:
suiteFile directory reads from C drive ONLY. Example, C:\TestSelenium\testSuite.html
When I try to specify the absolute path to my test suite (workspace), I get the error
The suiteFile is not a file or an url ! Check your build configuration.
Same thing happens with resultFile.
When I add post-build action "Publish Selenium Report," I'm getting an error because the newly created resultFile is saved into C:\TestResult\result.html and not in the workspace.

SonarQube - integrationTest.exec - sonarRunner (Gradle) or "sonar-runner" command - showing 0.0% covereage

I'm successfully generating 2 .exec files by Jacoco within "build/jacoco" folder after running a Gradle based build and integration tests.
Gradle command:
"gradle clean build integrationTest"
Once done, it generates the following .exec files under build/jacoco folder.
test.exec
integrationTest.exec
Following is my sonar-project.properties file. When, I run "sonar-runner" from Linux prompt it completes but on SonarQube dashboard for this project, I see Unit test says some 34.5% but integration tests says 0.0%. Both .exec files have valid size. I also did "cat" on the .exec files and piped the output to "strings" command in Linux and saw that integrationTest.exec did hit the Tests functions - I have only 1 .java file.
When I run "gradle clean build integrationTest sonarRunner -Dxxx.xxx=yyy -Dyyy.xx=zzz" i.e. by passing all the sonar variable as mentioned in the sonar-project.properties file using -D option, it works but same result on SonarQube project's dashboard. Project's sonar dashboard has both widgets configured for Unit / Integration Tests and I'm including IT tests for showing Overall coverage. Overall coverage is showing 34.5% (which is Unit test % value). Sonar does see test.exec, integrationTest.exec and also auto generates overall-xxx.exec file as well during this operation.
NOTE: I'm no where - while starting tomcat on a separate putty / linux console -OR within Gradle build script, providing any value or setting JAVA Agent for Jacoco. I'm getting integrationTest.exec file and test.exec file already so not sure if JVM needs to be stopped once IT tests are complete running. I don't think I need those as i have valid file size for .exec files.
My ?:
- Why sonar is not getting IT coverage on the dashboard even though I'm setting / passing the following variable correctly:
sonar.jacoco.itReportPath=build/jacoco/integrationTest.exec
-bash-3.2$ cat sonar-project.properties
# Root project information
sonar.projectKey=com:company:product:ProjectA
sonar.projectName=ProjectA
sonar.projectVersion=1.0
# optional description
sonar.projectDescription=ProjectA Service
#Tells SonarQube that the code coverage tool by unit tests is JaCoCo
sonar.java.coveragePlugin=jacoco
#Tells SonarQube to reuse existing reports for unit tests execution and coverage reports
sonar.dynamicAnalysis=reuseReports
# Some properties that will be inherited by the modules
sonar.sources=src/java,test/java,src/java-test
# Sonar Unit Test Report path
sonar.jacoco.reportPath=build/jacoco/test.exec
# Sonar Integration Test Report Path
sonar.jacoco.itReportPath=build/jacoco/integrationTest.exec
sonar.junit.reportsPath=build/UT/results
# Sonar Binaries
sonar.binaries=build/classes/main
Narrowing down the cause: I think it's due to the .exec file for Integration test. To proove it: I passed UT exex file to both reportsPaths in Sonar variables i.e. the following and SonarQube picked both UT/IT test coverage. This prooves that if .exec file for IT tests is good (which I think it's But I need to double check) then Sonar will pick the .exec file and show a valid coverage % instead of 0.0%. Note: the following is just to proove if Sonar is picking the values or not. itReportPath variable should use the .exe file which is generated by Integration tests by Jacoco.
sonar.jacoco.reportPath=build/jacoco/test.exec
# Sonar Integration Test Report Path
#sonar.jacoco.itReportPath=build/jacoco/testintegrationTest.exec
sonar.jacoco.itReportPath=build/jacoco/test.exec
OK Found the issue. I was running integrationTest task in Gradle and was NOT attaching the jacocoagent.jar (as per Jacoco documentation) to the target JVM (Tomcat's instance) scope. Once I did that, I removed jacoco { ... } section from integrationTest task in Gradle (build.gradle or GRADLE_HOME/init.d/some.common.gradle file as this attach jacoco agent to the Java JVM in which Gradle is running). Now, once jacocoagent.jar was attached to Tomcat's JVM (as per the line below which I added in Tomcat's startup.sh script and added the variable to the command which starts Tomcat), then I ran Gradle (integrationTest) task for running IT tests.
PROJ_EXTRA_JVM_OPTS=-javaagent:tomcat/jacocoagent.jar=destfile=build/jacoco/IT/jacocoIT.exec,append=false
Then while Gradle was in progress, tests ran and I got a file (jacocoIT.exec at the given location) with some file size BUT this is not yet the final one. I had to stop the Tomcat session/JVM instance by running Tomcat's stop.sh script. Once Tomcat was stopped, I saw jacocoIT.exec file size increased significantly and this was the valid final jacocoIT.exec file (which I needed for sonarRunner Gradle task OR sonar-runner exectuable to pick and successfully push IT code coverage data to project's sonar dashboard). Once done, I got both UT + IT and it's combined code coverage.
sonar.jacoco.reportPath=build/jacoco/UT/jacocoUT.exec
sonar.jacoco.itReportPath=build/jacoco/IT/jacocoIT.exec

jenkins error FATAL: Unable to find build script at C:\selenium tests for moveon\moveon4tests1\build.xml

I am using Jenkins and Ant to run my selenium tests. It works fine when I run them on my local machine.
Now I have a Jenkins server which is on a different location and I have to run my tests on that server.
when I tried to run the tests on that server Its is failing because it couldn't find the build.xml file. can you please let me know how can I change the home directory path?
Started by user :**********
Building in workspace /var/lib/jenkins/jobs/moveon4 java tests/workspace
FATAL: Unable to find build script at C:\selenium tests for move\movetests1\build.xml
Build step 'Invoke Ant' marked build as failure
Finished: FAILURE
Are you using "Invoke Ant" in your Jenkins job configuration for the build step that executes your Ant build ? If so, the build file location is hidden away in the Advanced section - it's an annoying quirk of Jenkins.