I have a jenkins pipeline with test stage that triggered via hook on gitlab. Is there any way to publish test results under gitlab for the triggered build?
Thank you
When looking at a problem like this I typically:
Check the : Jenkins Pipeline Steps Reference - there are gitlab related steps but I don't see anything about JUnit results
Check the Vendor's documentation GitLab's page on JUnit results - it looks like you have to use their runner to get JUnit results - you could investigate whether or not you can run this from your pipeline
Look to see if there is a REST api you can use. The Http Request Plugin is really easy to use to talk to various external servers - if GitLab has an API that you can call you may be able to implement it this way.
Related
We are using OpenShift. I have a confusion between buildconfig file vs jenkinsfile. Do we need both of them or one is sufficient. I have seen examples where in jenkinsfile docker build is defined using buildconfig file. In some cases buildconfig file is using jenkinsfile as the build strategy. Can some one please clarify on this
BuildConfig is the base type for all builds, there are different build strategies that can be used in a build config, by running oc explain buildconfig.spec.strategy you can see them all. If you want to do a docker build you use the dockerStrategy, if you want to build from source code using source2image you specify the sourceStrategy.
Sometimes you have more complex needs than simply running a build with an output image, let's say you want to run the build, wait for that image to be deployed to some environment and then run some automated GUI tests. In this case you need a pipeline. If you want to trigger and configure this pipeline from the OpenShift Web Console you would use the jenkinsPipelineStrategy in your BuildConfig. In the OpenShift 3.x web console such BuildConfigs are presented as Pipelines and not Builds even though they are all really BuildConfigs.
Any BuildConfig with the jenkinsPipelineStrategy will be executed by the Jenkins Build Server running inside the project. That Jenkins instance could also have other pipelines that are not mapped or visible in the OpenShift Web Console, there does not need to be a BuildConfig for every Jenkinsfile if you don't see the benefit of them appearing in the OpenShift Web Console.
The difference of running builds inside a Jenkinsfile and a BuildConfig with some non-jenkinsfile-strategy is that the build is actually executed inside the jenkins build agent rather than a normal OpenShift build pod.
At our company we utilize a combination of jenkinsFile pipelines and BuildConfigs with the sourceStrategy. Instead of running builds in our Jenkinsfile pipelines directly inside the Jenkins build agent we let the pipeline call the OpenShift API and tell it to execute the BuildConfig with sourceStrategy. So basically we still use s2i for building the images but the Jenkinsfile as our CI/CD pipeline engine. You can find some examples of this at https://github.com/openshift/jenkins-client-plugin.
I am trying to work out how I would integrate this shared library from GitHub into my code, since it is a shared class library, for starters I just want to run the integration tests, but I cannot work out how go get the test runner to run them.
I created a console application in my main project and a reference to the GoogleMapsApiTest in the console but I am not sure how to call the tests from there to run them.
GoogleAPIClassLibrary
I had to download the gui test runner and build it from GitHub. Link to project
now I can at least run the tests, I am still not sure how to use the library but that should help at least see how it is supposed to work.
I was able to run the unit tests by downloading the NUnit source code at the link in my post and then browsing to the output dll of the class project, to load the tests apparently the gui-test runner is no longer available for download, so hopefully that will help someone else out if they run into a need for running tests in NUnit.
Is there any way we can post JUnit results **/TEST-*.xml to Slack. I have tried all possible ways but couldn't able to solve the issue.
JUnit itself cannot do this. It is not the goal of this framework to publish things. For such purpose you would use a build script or tool like
Maven - https://github.com/moacyrricardo/maven-slack
Gradle - https://github.com/Mindera/gradle-slack-plugin
Or even more convenient a CI tool like
Jenkins - https://github.com/jenkinsci/slack-plugin
TeamCity - https://plugins.jetbrains.com/search/teamcity?correctionAllowed=true&search=slack
Travis CI - https://docs.travis-ci.com/user/notifications/#Configuring-slack-notifications
One of our test classes extends RemoteBaseTest but Jacoco ignores it completely.
How can I make Jacoco work with Sling Integration Testing?
For Unit Tests everything works as expected.
We are using Adobe CQ 5.6.1.
I see that this issue has been resolved: sling-issue-tracker-2810
but unsure how to implement it - is it even included in the latest CQ-Version yet?
If not how do I manually add it?
I don't know what RemoteBaseTest is but I assume you are running a JUnit "proxy" test which talks to the Sling JUnit server-side tests subsystem and causes the actual tests to run on your CQ server.
If that's correct, the actual test code doesn't run in the client JVM that's running RemoteBaseTest, it runs in the server JVM that's running CQ. So it's on the server JVM that you need to setup Jacoco to collect coverage data.
If you're running some tests on the client JVM (like common JUnit tests) and some on the server JVM via the Sling testing tools, Jacoco has functions to merge coverage data coming from different JVMs. We have this as a work in progress in https://issues.apache.org/jira/browse/SLING-1803 , which is not fully integrated in Sling yet but should be adaptable to any version of CQ.
I'm having problems setting up my Hudson server to run cpp unit tests so I can output an .xml file. I tried searching the web for some more straight forward instructions on how to set this up but still don't understand how to. It sounds like I need to set up ant to run...but how??
I'm currently running Hudson ver 1.352.
Any suggestions will be greatly appreciated.
Kat
I'm assuming you have some existing tests implemented in CppUnit that you can run by themselves. You could get these running in your Hudson job by using Ant, but since I don't think there is a CppUnit task for Ant you'd have to do it with an exec task.
It might be just as easy to call a shell script from Hudson to run your tests; you should then be able to get it to display the test results by checking the "Display JUnit test results" post-build action in your Hudson job and specifying the path to your results XML file (it's been a while, but as I remember CppUnit tests are in the same XML format as JUnit).
Let me know if I'm making any wrong assumptions.