I am using jacoco agent to generate my coverage reports in the form of xml files by running the command:
java -jar <path>/sample_projects/beta/jacoco-code-coverage/jacoco-code-coverage-example/src/main/resources/lib/jacococli.jar report <path>/sample_projects/beta/jacoco-code-coverage/jacoco-code-coverage-example/target/jacoco-it.exec --classfiles <path>/sample_projects/beta/jacoco-code-coverage/jacoco-code-coverage-example/target/classes/com --sourcefiles src/main/java/ --xml <path>/sample_projects/beta/jacoco-code-coverage/jacoco-code-coverage-example/target/report.xml
This basically writes to jacoco-it.exec file and it saves previous coverage data as well.
But I want coverage analysis per request made, is there any way I can erase previous data collected by jacoco agent.
So basically I got the solution just reset the exec dump at my middleware after the request has been made in this order I am able to get the coverage analysis per request.
ExecDumpClient execDumpClient = new ExecDumpClient();
execDumpClient.setReset(true);
execDumpClient.dump("localhost", 36320);
Related
All, I have a test suite developed using spock-groovy framework. The output of this is a set of html files. I have a requirement to run this test as part of a docker container on cloud. After the test execution, I would like to get a summary of the test results and also a link of the html files to view the details of these results.
Is there a library already available for parsing the test results for spock? How can I get this done using Java from the app running in the container?
Build tool: gradle.
I created the docker container using the Dockerfile. The entrypoint for this docker container is a shell script which sets required variables and then executes the command gradle clean test....
Few issues I am trying to resolve:
The container is able to execute the tests but I am unable to get the results out of that container. I am trying the approach as mentioned in point 2 below to get the results out of the container.
I have added def cleanupSpec() {....} method where I am trying to send a notification to slack channel. As I see from inside the container, this step is not getting executed. When I run this app locally, I am able to see the notification being sent.
I am trying to generate report using PMD command line tool. My aim is to find out the difference in the violations count after I have changed the code. The intention is to highlight if any new violations have occurred after the previous run of pmd tool.
This is the command I have used for running the pmd tool. It is able to generate report in html format.
./pmd.bat -dir "C:\Source_code_folder\" -cache "C:\temp\temp.txt" -f html -R "C:\Source_code_folder\rules.xml" > C:\temp\temp.html
The expectation is to print delta violations count on screen. One of the ways which I thought was to extract info from the report manually(using script), sum it and echo the result. I'm not aware of any option inbuilt in pmd which does the same.
There is no such functionality in PMD at the moment.
There is, however, an issue raised where you might wish to add your input.
https://github.com/pmd/pmd/issues/2116
I am trying to run the data artisans examples available at github. I read the tutorial and added the needed SDKs and downloaded the files for NYCFares and Rides. Whenever i am running the RideCount.java example i get a Job Execution Failed.
Here is the link to the git repo for the RideCount class file.
Github repo RideCount.java
here is the error
It appears that the nycTaxiRides.gz file has somehow been corrupted. The line that is shown in your screenshot should have these contents
914757,START,2013-01-03 10:00:57,1970-01-01 00:00:00,-73.982796,40.781418,-73.97155,40.761257,1,2013002770,2013017291
The code that parses the input is complaining that not all of the fields are present. I suggest you re-download the data file, being careful not to decompress or otherwise alter it. Chrome can do this, or wget, or curl, but some browsers will introduce problems.
I'm new to Jenkins and am trying to setup CI for my iOS app. I've created a unit test target in the project and have configured Jenkins to properly build and run my unit tests, but the build fails when trying to actually output the rest results xml file and I'm not sure what I'm doing wrong. I borrowed a lot of ideas presented from these sources:
https://www.raywenderlich.com/22816/beginning-automated-testing-with-xcode-part-22
http://www.sailmaker.co.uk/blog/2013/04/02/advanced-jenkins-for-ios-and-mac/
My actual console log after a build looks like this:
=== BUILD TARGET run_to_it OF PROJECT run_to_it WITH CONFIGURATION Debug ===
Check dependencies
=== BUILD TARGET run_to_itTests OF PROJECT run_to_it WITH CONFIGURATION Debug ===
Check dependencies
** BUILD SUCCEEDED **
Recording test results
ERROR: Step ‘Publish JUnit test result report’ failed: No test report files were found. Configuration error?
Finished: FAILURE
My build step execute shell looks like this :
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer/
security unlock-keychain -p ${KEYCHAIN_PASSWORD} ${KEYCHAIN_PATH}
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k ${KEYCHAIN_PASSWORD} ${KEYCHAIN_PATH}
xcrun xcodebuild clean build CODE_SIGN_IDENTITY="${CODE_SIGNING_IDENTITY}" PROVISIONING_PROFILE=${PROVISIONING_PROFILE} OTHER_CODE_SIGN_FLAGS="--keychain ${KEYCHAIN_PATH}"
xcodebuild -target run_to_itTests -configuration Debug -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO TEST_AFTER_BUILD=YES GCC_TREAT_WARNINGS_AS_ERRORS=NO WANT_IOS_SIM=YES OBJROOT="${WORKSPACE}"/tmp/objs build | /usr/local/bin/ocunit2junit
My post build step for where the test reports are to be placed looks like this:
I've ensured I've installed the necessary plugins as well as installing the ocunit2junit gem in the /usr/local/bin directory as well as having installed the JUnit plugin in Jenkins.
I'm not 100% sure if any xml file is being generated at all as I've looked through every folder in the Jenkins workspace and see no such xml file anywhere. I'm not sure if I need to explicitly specify this file to be created in any of the build steps or if it is handled by default. I've looked far and wide on the internet and I've not been able to conclusively figure out the problem.
For context: My Jenkins server is running on my Mac at the moment. I have a Jenkins user with a workspace on my local machine. I'm also running macOS Sierra and I'm not sure if there could be any permissions issues with the test-reports folder. I see that the folder is being created but no xml file is ever placed inside of it.
If I remove the Publish JUnit test report result then my project will build successfully.
Value on Test report XMLs field (Publish JUnit test result report option) seems to be correct. If you don't have any xml file inside this directory after your build, the problem is inside your test (and generation of xml junit result file), not in Publish JUnit test result report configuration.
Can you be sure that your unit test generate result inside xml file, with Junit format?
Once the code coverage is enabled in the project properties window . Once the tets case is run or the package it contains of.Junit test case result can be viewed. To generate a code coverage report run -> code coverage -> generate report and will select the test case what we have executed. we can view the report either in HTML view and code coverage report in RAD.
The applciation is of project level and when i try to get code coverage report , whatever package or the test case executed only some packages are been covered and those packages are not no where related to executed test case.
Is it like by default, few packages are considered for coverage ???????
It would be great if someone explains in a better way....