Test always succeeds


I am implementing a powershell script to test some additional functionality trying to follow this description:

However, although the script actually results in some tests being registered, it refuses to report errors. I am now back to your basic example. I have the following powershell build step (error output: error, script: source):

Write-Host("##teamcity[testStarted name='className.testName']")
Write-Host("##teamcity[testStdErr name='className.testName' out='error text']")
Write-Host("##teamcity[testFinished name='className.testName']")

Resulting build log:

[13:27:12]Step 1/5: Output to build log (Powershell)
[13:27:13][Step 1/5] ##teamcity[buildStatisticValue key='buildStageDuration:firstStepPreparation' value='156.0']
[13:27:13][Step 1/5] ##teamcity[buildStatisticValue key='buildStageDuration:buildStepRUNNER_18' value='0.0']
[13:27:13][Step 1/5] Starting:   C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe  -NonInteractive -ExecutionPolicy ByPass -Command - <  D:\JetBrains\buildagent\temp\buildTmp\powershell6640337654487221076.ps1
[13:27:13][Step 1/5] in directory: D:\JetBrains\buildagent\work\7e3fac8e390ca38d
[13:27:13][Step 1/5] className.testName
[13:27:13][className.testName] [Test Error Output] error text
[13:27:13][Step 1/5] Process exited with code 0
[13:27:13][Step 1/5] ##teamcity[buildStatisticValue key='buildStageDuration:buildStepRUNNER_18' value='536.0']

I would expect the test to fail, but it succeeds!

1 comment
Comment actions Permalink

Hi Kim,

testStdErr service message is used to report the test output. To fail and finish test please use

testFailed and 
testFinished messages.

Please sign in to leave a comment.