How to get sonarqube code coverage on tests running on wildfly server - java

I'm running my integration tests on wildfly server. 1st we deploy our artifact and then another test project will consume the API of deployed project and do complete integration testing. Is there a way to report the code coverage sonarqube ?

Presumably your IT suite produces reports. You simply need to wait to do the analysis until after the IT is done, then feed the resulting reports into the analysis.

Related

Build the testing repo before deploying to production in Jenkins

So I have a BDD testing project for a service and what I want is that as soon as I merge a branch into the master branch of that service then that BDD testing should be triggered first and if every test case passes then only it should allow to deploy the service to production.
The BDD is written in Cucumber-Java.
You need to configure this in a CI server such as Jenkins.
You can consider these steps, when setting up Jenkins, to achieve your use case:
Use Git-hooks; This will trigger a Jenkins pipeline as soon you merge a branch into the master. Check this article for more info https://kohsuke.org/2011/12/01/polling-must-die-triggering-jenkins-builds-from-a-git-hook/
Then in Jenkins, run your BDD project. Here is a nice article, which explains how cucumber projects are setup and run in Jenkins:
https://faun.pub/running-cucumber-tests-with-jenkins-a5a3a8df07eb
When your cucumber project passes, then write a script in Jenkins to deploy into production (This would be a separate stage in Jenkins). Although I would recommend you to deploy this into a staging server or something like Artifactory, which would hold your release package and have a manual step to deploy into production.
Finally here is a detailed article that gives step by step explanation of how you could integrate NoCodeBDD with Jenkins. Though this article is for NoCodeBDD, you could copy these steps and apply them for any BDD project by changing some parts of the script.
https://blog.nocodebdd.com/integrate-nocodebdd-and-jenkins-to-run-bdd/

Integration test after deploy with fail-safe plugin

How would you run integration test separately after deploy is done.
In jenkins we will build, unit test, run some kind of embedded integration tests.
Then it will deploy to remote server.
How can I run Integration tests against remote deployed server? Running same fail-safe plugin will build the application again. The test will be rest-assured java based tests. How to invoke them without rebuilding the app?
Is the only way to somehow play with profiles? Profile for build and test and profile for black box integration(skiping unit tests and embedded integration test)
Maybe I can bind to maven validate phase, which will skip compilation with profile activating "black-box" fail-safe execution(for validation phase only)

TFS and TestNG - Possible to Execute TestNG test(s) within TFS2015?

TFS and TestNG - Possible to Execute TestNG test(s) within TFS2015?
I have uploaded a Java Maven project to a Repo in my instance of TFS.
My java Maven project comprises of TestNG Test / classes
I can see that there is a Maven plugin within the TFS which also has a JUnit link.
4. I cant see any option to enable me to execute TestNG tests within the TFS, is it even possible?
It's able to use Maven task to build a Java application or test the application including TestNG test. Detail steps please refer this tutorial: Get started testing Java applications with Visual Studio Team Services
For test result report just follow juherr's reply in this question.
Yes you should be able to run your TestNG tests.
I think its eventually going to be Maven that is going to be executing your tests.
Maven makes use of surefire-plugin to basically execute your tests. For TestNG here's two of executing tests via surefire-plugin
If your test matches the default pattern "/Test*.java", "/*Test.java", "**/*TestCase.java" (See here)
Create a suite xml file for TestNG (See here) and have surefire plugin refer to it (see here).

I am trying to use junit with my app on bluemix the build is successful locally but on bluemix it fails due to line coverage check

I have uploaded an app on bluemix and recently integrated junit, the coverage check is passed locally but on bluemix the coverage check/line coverage fails
Yes it's a devops question, I unchecked the cobertura generated report files and forgot to check the test case before commit. Silly me :/

Running cucumber-jvm in Jenkins

After some research into running Cucumber on Jenkins I have come to a dead end, I have read some post here about Running Cucumber but most are error not the process.
Running via command line the problem here is that I don't know how to call this in Jenkins after building.
I have Jenkins running on an Ubuntu server. Everything for building a maven project is setup, but how would one run the Runcukes file or setup the pom file in a way to call cucumber to start running?
Wire up a Maven task to run cucumber. As cucumber generates stubs for junit, maven's surefire plugin will run the tests nicely.
Jenkins has full support for running maven builds, so you won't have any issues there.

Categories

Resources