I want to add the test run info on the TeamCity build log tab, for eg if my test failed because of a bug and gives an error, I want to show the error on the build log. I tried using TeamCity service messages for this but it is not working as I would expect. Maybe I am missing something or doing it incorrectly. Please advise. All suggestions are welcome. Thank you!
This is how I am using the service messages. I am entering the messages in my .bat file which I am running from TeamCity.
##teamcity[testStarted name='SmokeTest1']
run SmokeTest1.bat
##teamcity[testFailed name='SmokeTest1' message='error']
##teamcity[testFinished name='SmokeTest1']
The above code runs my test and always says that my test failed based on my 'testFailed' command. What I want is that it should check if my test actually failed and report if failed (maybe it can check for some keywords to check if my test failed). But it seems like what is happening is that I am already telling it that the test has failed with the message 'error'. I wouldn't know before running the test if it is going to fail. Am I missing something here?
Also, in the below example, are we supposed to enter the error even before running the test? So, if I use testStdErr and enter an error, it will always report that error irrespective of if that error really occurred during my test run?
##teamcity[testStarted name='SmokeTest1']
run SmokeTest1.bat
##teamcity[testStdOut name='testname' out='text']
##teamcity[testStdErr name='testname' out='error text']
##teamcity[testFinished name='SmokeTest1']
Thank you!