Dima Star
Dima Star

Reputation: 154

Email-ext Jenkins: How to send email with Tests statistics like Run: 10, Failed:2, Passed: 8

I use Maven+TestNG auto-tests run by Jenkins. I know that the is a token for failed tests like ${FAILED_TESTS} but it also includes long stack-trace which is difficult to read.

So I want Jenkins to send email like this: Run: 10, Failed:2, Passed: 8

Upvotes: 1

Views: 7746

Answers (3)

celikgumusdag
celikgumusdag

Reputation: 45

Total:${TEST_COUNTS, var="total"} 
Success:${TEST_COUNTS, var="pass"} 
Fail:${TEST_COUNTS, var="fail"}

Upvotes: 1

Josh Unger
Josh Unger

Reputation: 7163

Try -

Run: ${TEST_COUNTS}, Failed: ${TEST_COUNTS,var="fail"}, Passed: {$TEST_COUNTS,var="pass"}

You can also print out the skipped tests -

Skipped: ${TEST_COUNTS,var="skip"}

Take a look at the source code for TestCountsContent.java

Or are you saying this doesn't work with TestNG?

Upvotes: 1

Jeff Olson
Jeff Olson

Reputation: 6463

It looks like you could customize the email template by using the Email-ext plugin and Jelly templates.

See http://softwaretestautomationnotes.blogspot.com/2011/07/customizing-post-build-email.html for an example of this.

I don't know of any way to do this out of the box.

Upvotes: 2

Related Questions