1) TeamCity runs Gradle file to build and test all modules in a project.
2) Gradle invokes TestNG to run the test cases.
4) Test failure causes build failure and TeamCity sends out emails to the users.
There is unwanted stacktrace in the email which we don’t want to send. We are only interested in the details which is stored in the Java variable (in step 3) and we can do System.out.println() and this variable data will be sent in the mail. If there is any other elegant solution where-in we can push our custom data to email without depending on Stdout statements, we are open to that too.
Also, I want this feature to be project specific. Our changes for one project should not affect the email templates of other projects. For your reference, I have attached herewith a sample email that was sent by TeamCity.
Please let me know how to go about it.