How to send nunit results from jenkins to email - nunit

I've set up my jenkins to send emails after nunit tests are passed. How can I configure that the body of mail contains nunit results from TestResult.xml file? Maybe there is some plugin to jenkins?

I think you should take a look to the Email-ext plugin, it will allow you to decide what you want to send (and in your cae attach NUnit report).

I've found suitable solution for me: use Jelly script as described here:
https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin

Related

Use Jenkins to read email, download attachment, and run a script

I'm trying to configure the poll-mailbox-trigger-plugin to do this but having trouble setting it up. Unsure if downloading an attachment is possible with this plugin.
Here's what I'm trying to do
Jenkins reads email
If subject = "My Subject", download its attachment to /opt/file.csv
Run /opt/script.py
I'd like to do this in Jenkins but I may settle to write a script that can do all of the above steps instead and then have Jenkins just monitor it somehow.
Any suggestions?
Edit: There is an open feature request for this jenkins plugin for exactly this functionality.
https://issues.jenkins-ci.org/browse/JENKINS-27575
Downloading attachments is now available since version 1.022.

How to send REST request with build parameters in Jenkins Post Build Actions?

I am working on a CI system with Jenkins. But now I got a problem. I need to do the following steps.
1:Jenkins build
2:Deploy to Tomcat
3:find a way to send the build parameters (Job Name, build number...) to a web server (I am using REST now).
4:Web Server trigger testing system.
5:Jenkins get the result from testing system.
6:update build status
7:send emails.
I have problem with the step 3. I need to send those info after the deploy. I am thinking a way as following.
write those parameters to a file during build step, then call a script or Java problem to process the file and send out those info by REST.
But that is ugly. Is there any better ways to do it?
Side questions
Can groovy do this?
How to import groovy http-builder library to Jenkins?
I found a walk around solution.
1: ran echo command during the build to get the build ID and print to log.
2:wrote a small Java program to get the JSON response of the build then sent the necessary info as rest request to the server you set. The program is like a message forwarder.
3:in post build actions, use groovy post build to fetch the log then call the Java program.

Team City - Add Gallio test result xml to build display

Im using TeamCity with Gallio/XUnit/Specflow and trying to display our unit/acceptance test results. I believe the output is NUnit xml test result format.
Our unit tests auotmatically display using the command runner with Gallio. The acceptance tests are run through a large Powershell script which calls Gallio (Run-Gallio).
Results are output to acceptance-test-results.xml. Is there a way to display the acceptance-test-results.xml in TeamCity (6.5.5)?
To do this in a PowerShell script add the following
Write-Output "##teamcity[importData type='nunit' path='C:\SomeDirectory\YourResults.xml']"
You can use built in TeamCity feature importdata service message:
<!-- Send to TeamCity a service message using MSBuild -->
<Message Text="##teamcity[importData
type='nunit'
path='$(OutputPath)\UnitTestsReport.xml']"
Importance="High" />
For more details see: Build Script Interaction with TeamCity - Importing XML Reports
Thought this might be useful also for other people that came to this SO post with slightly different requirements. It's the public wiki for TC that covers this particular area.
http://confluence.jetbrains.com/display/TCD8/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-ImportingXMLReports

how to get ANT script to send an email when the build succeeds or fails?

I have an ANT script that works fine.
When the build succeeds I'd like it to send an email that has "build succeeded" in the subject and include the build's console output as the email body.
When the build fails I'd like it to send an email that has "build failed" in the subject and include the build's console output as the email body.
Can someone tell me an easy way to do this? Thanks!
Rob
The ant mail logger should be what you need.
1st answer is right
however, I build all my stuff with jenkins, hence use that to send emails
it integrates with ldap/active directory too

Hudson email triger

I like to send email using hudson ext-email plugin, but with diferent triger than build status. I like to set hudson evn during buil or read it from env file (using env-file plugin) and depends of his value send email or not. How to do that?
BR.Marcin
To conditionally send out an email based on an environment variable set in the build, you'll have to use a scripting language such as Groovy.
Here's an article discussing how to use a Groovy script inside Email-ext.