Getting test results easier in Jenkins - grails

When I run grails tests via jenkins I can check the console to see everything passed.
I'll see something like this:
Tests PASSED - view reports in /Users/me/developer/gradlemucks/grails_2/hello-world/target/test-reports
Is there anyway I could put in a hyperlink somewhere in Jenkins to the test reports so that I could just click thru to the report? Thanks

According to the testing guide, Grails outputs both .html and .xml formatted results from the tests by default. You can configure Jenkins to read the .xml files:
Install the JUnit or xUnit plugin.
Add a Post-build Action to Publish JUnit test result report.
Set Test report XMLs path to build/test-results/*.xml (or whatever path your JUnit .xml output files are dumped to).
This will permit you to click through the tests run for any build from the left sidebar within Jenkins.

Have you looked at the Side Bar Link Plugin? It allows you to add arbitrary links to the left side menu of a job.

Related

Getting access to the allure report statistics in Jenkins (tests with Webdriverio)

I have a set of tests which run within Jenkins and at the end of the tests (in the post section) I generate an allure report. The tests are created with Webdriverio.
The last time I did anything like this, I was using standard selenium running with Junit and due to that combination, the Jenkins Rest API had access to things like failedCount, skipCount, passes and failed counts. This however seems to only be possible with JUnit.
Does allure expose this to Jenkins somehow - or am I going to have to try and scrape the statistics from a pre-generated report?
(as a side note, I have tried to configure a second reporter in webdriverio, but while that seems to create some xml files locally, the folder I configure is not appearing on Jenkins. Also, webdriverio doesn't support JUnit as a framework - currently it's using mocha.)
I eventually managed to figure this out.
There is url which you can go to to get a json file with the summary information.
So if you report is at /allure - then you navigate to /widgets/summary.json

Generate complete kotlintest report in a Jenkins pipeline?

I am using kotlintest with gradle. When I run my tests in IntelliJ I get to see the whole Given/When/Then structure. This is also reflected in the report I can generate using the IntelliJ Export Test Results function. This works perfectly and does exactly what I want.
Sadly, when I run the tests using gradlew test it only picks up the Then blocks. That means that while all tests are run correctly, the generated report looks ugly.
The problem is that I want to generate an HTML report automatically in a Jenkins pipeline. At the moment the result is useless, because it does not contain the Given and When blocks.
Is it possible to somehow generate a complete HTML report, with all Given/When/Then blocks in a Jenkins pipeline?

Identifying failures in Jenkins Console Output

We run CI tests via Jenkins and review the results via Jenkin's Console Output. If one of the tests doesn't pass, it is printed to the Console in red. Nevertheless, the output is very long and it is tedious to search the entire log to find instances of red output. Are there any good solutions to the issue?
For instance, Gerrit's user interface displays file diffs and a user can use keyboard shortcuts n or p to jump to the next/previous diff block. Is there any such solution/plugin... for Jenkins?
There's the Collapsing Console Sections Plugin:
This plugin allows the creation of sections in build consoles.These sections can be individually collapsed to hide unimportant details. A floating outline widget is available to navigate through all the sections of a build.
and the Console Parser Plugin:
The console parser plugin parses the console log generated by the Jenkins build allowing for:
...
highlighting of errors, warnings , and info
...
separating the comparison log by sections
collapsible sections for faster viewing
You should use a reporting plugin in Jenkins corresponding to the test framework you have used in your project. e.g. If you are using TestNG , then Jenkins has a publish TestNG reports plugin for filtering out test results.
Similarly for Cucumber - there is pretty cucumber reports plugin.

Unable to generate cucumber reports in jenkins. net.masterthought.cucumber.ValidationException: None report file was added

I am using jenkins to run jobs that uses maven with cucumber . my jobs are running succesfully. I have also managed the plugin Cucumber report in jenkins. But when i view the report i am getting the message as shown in below picture.
I have tried to install various plugins like Jenkins plugin, standalone but with no joy. These are shown as options in the bottom right of the report.
Any clue is helpful. I have tried to check this error in stackover flow also. I didnt get any clue
I could see the reports file in xml which is created by surefire plugin. Any way i can achive reporting part in my project
I managed to get reports in jenkins now.
Previously Jenkins is unable to find the json file in my project.
I have set the path of json file as target and i could able to see the reports.
This might help for those who are looking for answer.
#CucumberOptions(
features= "C:\\Users\\dd pc\\workspace\\PracticeCucumber\\src\\main\\java\\com\\qa\\feature\\Test.feature",
glue= {"com\\qa\\stepDefinition"},
format= {"pretty","html:test-output_1",
"json:target/cucumber-reports/CucumberTestReport.json"},
plugin = ("json:target/cucumber-reports/CucumberTestReport.json"),
monochrome= true,
dryRun= false
)
I am able to solve by providing **/*.json
under Post-build Actions/Cucumber Report/JSON Report Location/ File Include Pattern = **/*.json
First of all in runner file we need to provide following plugin as follows: plugin= {"json:target/cucumber.json" }
Now in Jenkins job, in "post build" section during configuration, add cucumber reports, click on advanced option and provide 'target' text in "JSON Reports Path" text field. Save the job, it will run and will work fine.
Note: target text is the name of folder which we have provided in runner file for generating reports in Json, also cucumber report plugin works on json so need to generate report in json.
I my case the problem was in two jobs over the same test repository (one for Chrome one for Firefox), where one deletes report files after the job while second job was already running and vice versa.

How to instruct Jenkins to look for email template in user defined path (OTHER THAN $JENKINS_HOME/email-templates)

I have groovy email template(for Selenium Robot framework test execution) for Jenkins. Jenkins master is controlled by a remote team. So for placing this template in $JENKINS_HOME/email-templates, we need to raise a ticket and wait from 2 to 3 days. Also we expect, there might be changes required in template. So we are planning to put our templates inside our source code repository (GIT). so in the Jenkins test job, we checkout the test script together with email templates.
How to instruct Jenkins to look for the template in workspace folder instead of $JENKINS_HOME/email-templates in Jenkins Master
Sadly it seems you would need to modify the email-ext plugin as the search path is hardcoded into it.
You can see it here, check the occurrence on line 69 in file src/main/java/hudson/plugins/emailext/EmailExtTemplateAction.java
Changing it to another path would be trivial, however adding multiple locations you'd probably have to put some work in.
Edit: I wonder if it would be possible to put the wanted stuff into some txt file as a build step, and then load it into the mail content via some template configuration. If you have access to the job configuration this might be worth checking.
You can copy the template into the build workspace (e.g. with SCM step), and then email-ext can reach it:
${SCRIPT, template="${WORKSPACE}/foo.template"}

Resources