Custom emails in teamcity


I am using TestNG to run my Java/JavaScript test cases. For testing JavaScript modules, am using FuncUnit. The use-case is as follows:



1) TeamCity runs Gradle file to build and test all modules in a project.


2) Gradle invokes TestNG to run the test cases.


3) TestNG runs the Java unit test case. Inside this test case am using Selenium to open the FuncUnit test case HTML page in a browser. After the FuncUnit test case run is completed, I am using Selenium to compile the test results and store it in a Java instance variable. In case of detecting any JavaScript test failure, I am failing the Java unit test case using assetTrue().


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.




Please sign in to leave a comment.