go code coverage report in Jenkins with cobertura plugin - jenkins-plugins

I have installed cobertura plugin in Jenkins and ran unit tests with below command #go test -cover -p 1 $PKGS | go-junit-report > report.xml. I could see report.xml is created with code coverage but I see below error in Jenkins console. Could you please let us know what is the issue and how to resolve this.
/bin/sh -xe /tmp/hudson1811800402022775798.sh
[Cobertura] Publishing Cobertura coverage report...
FATAL: Unable to find coverage results
java.io.IOException: <workspace>/report.xml is not a cobertura coverage report, please check your report pattern
at hudson.plugins.cobertura.CoberturaPublisher$ParseReportCallable.invoke(CoberturaPublisher.java:566)
at hudson.plugins.cobertura.CoberturaPublisher$ParseReportCallable.invoke(CoberturaPublisher.java:536)
at hudson.FilePath.act(FilePath.java:1018)
at hudson.FilePath.act(FilePath.java:996)
at hudson.plugins.cobertura.CoberturaPublisher.perform(CoberturaPublisher.java:343)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720)
at hudson.model.Build$BuildExecution.post2(Build.java:185)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:665)
at hudson.model.Run.execute(Run.java:1766)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
[Cobertura] No coverage results were found using the pattern '**/report.xml' relative to '<some directory>'. Did you enter a pattern relative to the correct directory? Did you generate the XML report(s) for Cobertura?
Build step 'Publish Cobertura Coverage Report' changed build result to FAILURE
Finished: FAILURE

I have followed below steps to generate coverage report (for go language)
gocovxml
Install gocov xml using below commands
$ go get github.com/axw/gocov/...
$ go get github.com/AlekSi/gocov-xml
execute go test command if you have multiple packages
gocov test $PKGS -p 1 | gocov-xml > report.xml
Provide report.xml in publish cobertura coverage report (Post build action in Jenkins)
**/report.xml

Related

How to make app compatible with Android 12 (Snow Cone)

I am trying to build my Ionic App to support Android 12. It works fine upto Android 11, but is not supporting Android 12.
==Supported credentials to Android 11==
package.json
“cordova-android”: “^9.1.0”
build.gradle file:
defaultBuildToolsVersion=“29.0.2”
defaultMinSdkVersion=22
defaultTargetSdkVersion=30
defaultCompileSdkVersion=30
config.xml file:
preference name="android-targetSdkVersion" value="30"
==Tried increasing sdk to 31==
package.json file:
“cordova-android”: “^10.0.0”
build.gradle file:
defaultTargetSdkVersion=31
defaultCompileSdkVersion=31
config.xml file:
preference name="android-targetSdkVersion" value="31"
added android:exported=“true” in MainActivity in ..\platforms\android\app\src\main\AndroidManifest.xml
Error :
FCMPlugin: Support for Gradle v4 or lower is deprecated. Please upgrade to a newer version.WARNING:: Configuration ‘compile’ is obsolete and has been replaced with ‘implementation’ and ‘api’.
It will be removed in version 7.0 of the Android Gradle plugin.
For more information, see Add build dependencies | Android Developers.
WARNING:: Using flatDir should be avoided because it doesn’t support any meta-data formats.
Task :app:processDebugMainManifest FAILED
…\platforms\android\app\src\main\AndroidManifest.xml Error:
Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See <activity> | Android Developers for details.
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ‘:app:processDebugMainManifest’.
Manifest merger failed : Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See <activity> | Android Developers for details.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use ‘–warning-mode all’ to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See Command-Line Interface
BUILD FAILED in 3s
15 actionable tasks: 1 executed, 14 up-to-date
Command failed with exit code 1: …\platforms\android\gradlew cdvBuildDebug -b …\platforms\android\build.gradle
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
I have tried all forums and posts, nothing seem to works. Anybody has an idea on how to make this work?

R Missing Package error when uploading to shinyapps.io

My Shiny program works fine locally on my PC (Windows 8, RStudio 0.99.489) but not when I upload it to shinyapps.io . I've tried 2 ways of packaging the data for upload - saveRDS on each object and save.image on the entire environment. Either way, when I upload it to shiny.io I get:
Preparing to deploy application...DONE
Uploading bundle for application: 77966...DONE
Deploying bundle: 350891 for application: 77966 ...
Waiting for task: 132618597
building: Parsing manifest
building: Building image: 344796
building: Installing packages
################################ Begin Task Log ################################
[2016-01-16T22:19:45.818533554+0000] Installing R package: magrittr (1.5)
Error in library(stylo) : there is no package called �stylo�
Execution halted
################################# End Task Log #################################
Error: Unhandled Exception: Child Task 132618599 failed: Error building image: Build exited with non-zero status: 1
Execution halted
It seems that Shiny isn't aware of the Stylo package. I tried to install it in my code, but that didn't help.
1. Does Shiny have all R packages?
2. If not, is there a list of which packages are available?
Thanks very much.
Are you including the stylo package at the top of your server.R file via library("stylo")? If you are doing that and it's giving you the error, try using require("stylo") instead.
From the docs, the rsconnect package is supposed to automatically detect what packages are necessary for your app. Probably worth a read (if you haven't already) just to be sure you're following everything correctly in order for rsconnect to do its job.
I solved the problem by doing a clean build of my environment -- imported data tables and functions from RDS files only, and carefully avoided references to unnecessary packages. I recreated the one function I needed from Stylo locally, so that I could be certain I wouldn't require it.

Not able to trigger JiraTestResultReporter plugin on Post Build Action in Jenkins

I want to log defects automatic on jira whenever any test case gets fail.for that i have used JiraTesttResultReport plugin.i have successfully able to create my report.xml file.but i got below errors:
Build step 'Publish JUnit test result report' changed build result to UNSTABLE
[JiraTestResultReporter] [INFO] Examining test results...
ERROR: Publisher JiraTestResultReporter.JiraReporter aborted due to exception
java.lang.NoSuchMethodError: hudson.model.AbstractBuild.getTestResultAction()Lhudson/tasks/test/AbstractTestResultAction;
at JiraTestResultReporter.JiraReporter.perform(JiraReporter.java:105)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:761)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:721)
at hudson.model.Build$BuildExecution.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:670)
at hudson.model.Run.execute(Run.java:1766)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:374)
On what version of Jenkins are you working?
JiraTestResultReporter does not work on Jenkins 1.577+
It's a known bug
A workaround is to build and install a snapshot of the plugin.

How to visualize code coverage information on Go GAE apps?

I am developing a server with the latest Go GAE SDK. I am running tests after every change:
goapp test -test.v=true
I am using -cover to record coverage as described by goapp help testflag:
goapp test -cover -test.v=true -test.coverprofile=c.out
[..]
coverage: 53.8% of statements
ok _/var/lib/jenkins/jobs/loyalty/workspace 30.464s
This completes successfully and prints the percentage of lines covered by tests. However, attempting to visualize the results fails:
goapp tool cover -html=c.out
cover: can't find "app.go": cannot find package "_/home/ingo/git/loyalty/" in any of:
/home/ingo/Downloads/go_appengine_sdk_linux_amd64-1.9.10/go_appengine/goroot/src/pkg/_/home/ingo/git/loyalty (from $GOROOT)
/home/ingo/git/loyalty/src/_/home/ingo/git/loyalty (from $GOPATH)
Does Go's cover tool only work on non-GAE apps? Do I have to package my app differently in order to visualize the coverage results?
I unsuccessfully asked this on golang-nuts before.
There is an open issue related to it. As a temporary workaround, I am running sed in between collecting and visualizing the coverage results.
goapp test -cover -test.v=true -test.coverprofile=c.out
sed -i -e "s#.*/\(.*\.go\)#\./\\1#" c.out
goapp tool cover -html c.out -o coverage.html

Automating silverlight unit tests using StatLight and TeamCity

What is the best way to run silverlight unit tests automatically using team city?
I have found StatLight which we had working well when we used cc.net, and it says that it has support for teamcity. Does this just mean the test results output file is compatible with teamcity? Do I need to create a command line runner to run the tests? If so how do I get the test results into team city?
Thanks
TeamCity has an extensibility feature where you can output special commands to the console and the TeamCity agent will capture the commands and publish the results within TeamCity.
If you get StatLight running on your desktop - do a regular console-run. Then do another run by giving it the "--teamcity" parameter. Notice the difference in the output?
In TeamCity you can setup a Command Line Build Runner
Command executable: "<Path to statlight.exe>"
Command parameters: "-x=%system.teamcity.build.checkoutDir%\PathToXap\SilverlightClient.Tests.xap --teamcity"
Hope this helps.
There's also a StatLight TeamCity plugin that adds a test runner.
You can try using Lighthouse Silverlight Unit Test Runner, it works with every Build Server including TeamCity and CCNet because it by default produces NUnit compatible xml results file:
http://lighthouse.codeplex.com/

Resources