How to use Service Messages through Java application?



I am new to teamcity. Please give some sample java program, so it should support the following teamcity service messages.


Let’s suppose I have three java test classes (e.g.,, and TeamCity provides on-the-fly reporting with specially formatted messages using a java program(e.g.


##teamcity[testStarted name='test1']

##teamcity[testFailed name='test1' message='failure message' details='message and stack trace']

##teamcity[testFinished name='test1' duration='50']


##teamcity[testStarted name='test2']

##teamcity[testFailed type='comparisonFailure' name='test2' message='failure message' details='message and stack trace' expected='expected value' actual='actual value']

##teamcity[testFinished name='test2' duration='150']


##teamcity[testIgnored name='test3' message='ignore comment']





You can output the messages into stdout (e.g. use System.println() for each line). When TeamCity detects the output and reports corresponding tests.

Can you explain why do you need the service messages? What is your original goal?


Thanks for quick and correct response..

My main goal is write a java class which will integrate our java test cases with teamcity and Test report by using Service Messages.


I just wanted to make sure that this is your custom tests framework since TeamCity comes with integrated support for JUnit and TestNG frameworks.


I have custom tests framework. I am not using any JUnit and TestNG frameworks.


Please sign in to leave a comment.