I'd like to configure jasmine-maven-plugin to make jenkins unstable if a test fails but the only options appear to be:
set haltOnFailure true and have failures break the build
set haltOnFailure false and have failures reported in the logs but the build succeeds.
Is there a way to check the logs post-test and mark the build unstable?
Sam Hasler's answer only works for freestyle Jenkins jobs. We use Maven jobs and this configuration option of the JUnit Jenkins plugin is unavailable for Maven jobs. So I was looking for a more universal solution.
What we did in order to get it working is to reconfigure the Jasmine Maven plugin so as to
no longer halt the build upon test failures and
write the Jasmine test reports to target/surefire-reports where Jenkins expects to find them. This has the additional advantage that we now also see the failed Jasmine test in the build job alongside our Java tests.
<haltOnFailure>false</haltOnFailure>
<jasmineTargetDir>${project.build.directory}/surefire-reports</jasmineTargetDir>
Now our build jobs are yellow (unstable) as expected, no longer red (failed).
Found the answer myself!
I had to configure jenkins to also look at the jasmine junit report:
under Publish JUnit test result report add **/TEST-jasmine.xml to Test report XMLs, comma separated if there is something there already:
**/TESTS-TestSuites.xml,**/TEST-jasmine.xml
Related
I am encountering an issue with a Maven build job on Jenkins -
when it runs on "agent2" it succeeds!
when the same job runs on "agent2" it fails a specific test every time...
the code is the same in both runs.
we use Maven Integration plugin.
artifact resolve from artifactory.
edit with more info:
java 1.8, a junit test that uses assert - on one agent gets an expected value - while on the other not. there are no clear-to-the-eye differences between the agents - trying to find out what this difference may be. the code is pulled from bitbucket and then built with maven(clean install)
any ideas?
Thanks!
I am using Maven and the failsafe plugin to execute a set of runners that run integration tests.
One of these runners execute tests that involve altering my configuration. For this reason, I would like this runner to be executed only when the other tests have finished executing. Otherwise, there is the possibility of unrepresentative tests.
How can I go about this?
To expand on #khmarbaise comment, in Testng you have annotations that can help you set and reset config files
http://testng.org/doc/documentation-main.html#annotations
I am running tests via Jenkins and Maven using surefire-report:report goal. Even when some tests fail, Jenkins displays the Job as successful due to correct completion of the job. The Surefire Reports are correct corresponding to the test results. Are there any ideas how to configure Jenkins to run and report the tests properly?
Thanks in advance!
I'm looking at using Sonar to reduced the number of plugins I've had to install in Jenkins to get some decent code analysis (and sonar seems to do more and present it better). However when I kick of the sonar job the JUnit / Concordion tests are executed. I don't want these tests run as Jenkins is already executing the tests.
How do I stop the tests executing and just perform code analysis?
I've installed sonar 3.7.3 and executing using the Gradle sonar-runner plugin and specifying the :sonarRunner task.
I'm just facing the same issue and it seems that you can run :sonarqube -x test to avoid having tests run before.
You can set the sonar.dynamicAnalysis property to false. This will skip tests and only perform the static analysis part.
See http://docs.codehaus.org/display/SONAR/Analysis+Parameters#AnalysisParameters-OptionalParameters
In a multi module mvn 3.0 build, I set forkedProcessTimeoutInSeconds to one hour. If tests in module A hang, I hit surefire threshold which will fails the build and skips remaining modules. We use a junit timeouts which should kill hung tests prior to this but some scenarios encounter this problem. I'd like to keep my builds running while I investigate enhancements to our junit runner.
Current Command Line: mvn clean install -Dmaven.test.failure.ignore
How I can change the surefire timeout behavior to move to next module and continue the build?
Does anyone have tips for testing one's junit framework?
I was going to review the surefire project's integration tests for ideas for both items. I plan to have a junitsystest module which activated by a specific profile so I can test various problematic situations outside of my builds.
According to Mastering The Maven Command Line – Managing failures --fail-at-end or --fail-never will provide the desired results. Surefire timeout continues to be reported but doesn't halt the build.
Not recommending in the long run as it lengthens bad build times
mvn clean install -Dmaven.test.failure.ignore --fail-never