问题
I am using commandline build step in teamcity to run the testcomplete tests via a batch file.The tests are running fine,but I do not see any information regarding the passed/failed tests in teamcity. Basically TestComplete generates some log files after running the tests.But I am not sure how to get these files to teamcity and display it as test results.
I tried to follow this http://community.smartbear.com/forum/post/?mode=singleThread&thread=ca03299b-97e2-47a7-b634-e0102c6f5761 , but it describes using MSBuild instead of commandline to run the tests. Wondering if the test results can be exported to teamcity via commandline as well.
Also I tried to add a custom tab to teamcity project configuration as mentioned here http://confluence.jetbrains.net/display/TCD65/Including+Third-Party+Reports+in+the+Build+Results . But that tab does not in any of the build configurations under that project.
回答1:
You can use teamcity Service Messages to achieve the reporting of tests that you are looking for. Service Messages are simply formatted output (that you write to standard output) that teamcity recognises and reports in the build results. You can easily report when a test started, ended and optionally failed, all of which teamcity will display in its GUI. For example:
teamcity[testStarted name='testname']
More test output should you want any
teamcity[testFinished name='testname' duration='1000']
Teamcity will assume the test passed, unless you output a ##teamcity[testFailed name='testname'] message.
For more information, see http://confluence.jetbrains.net/display/TCD65/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-ServiceMessages. Look at the Reporting Tests section.
回答2:
I never dealt with TeamCity, but I think that I can give you a couple of tips.
When a TestComplete test is launched via command line, the tool provides the caller with an exit code that tells whether there were any errors or warnings during test execution. The list of the existing exit codes can be found in the TestComplete Exit Codes help topic.
If TeamCity provides you with a possibility to use Active scripts (like SmartBear Automated Build Studio), you can consider working with the tool using its COM object. This approach provides with more possibilities for setting up tests and controlling the execution. Information on this can be found in the Working With TestComplete via COM - Overview topic.
回答3:
TestComplete
supports exporting the result log into a file of XML\HTML\MHT format.
You can do it by calling the Log.SaveResultsAs()
method, for details see the help|index of the TestComplete
menu. With the XML\HTML|MHT result file, I believe your teamcity should integrate it.
来源:https://stackoverflow.com/questions/9584699/how-to-export-testexecute-testcomplete-results-to-teamcity