Running Testcomplete scripts with Octopus Deploy

By Dries Marckmann

It was becoming more and more clear that just running a deployment without testing that the deployment has gone as planned, and yesterday we had a deployment gone bad…Luckily it was on the test environment and not on production.

So my conclusion was that we have to do some automated system or UI testing apart from the unit & scenario tests we run in the build. We have just bought a license for Testcomplete (http://smartbear.com/products/qa-tools/automated-testing-tools) to automate our tests, so it would be sweet if we could run our tests right after a deployment.

I took a relatively simple test to try to implement in the deployment process: a simple text-check on a webpage. First I had to find out how to start testcomplete from the command line and specify a test. Refer to the documentation for this, because it is well specified how to do this. The step from command line to powershell is a breeze after that.

There is however a problem: Testcomplete doesn’t just return success or failure, it generates logfiles. So we are stuck with the process of extracting the results from the logfile. I run TestComplete in silent mode and export the log to an mht file, which is a multipart mime file. The script unpacks this file, finds the root.xml file amongst all the parts (decodes base64 format) and gets the status code from the xml. You can look in this script to see the details.

After this worked locally I installed a Tentacle on the testcomplete server and tried to start kick off the powershell script with Octopus. It started, but the test result failed because I could not navigate to the website in my script. This is because of the fact that the Tentacle runs as local system and is thus bound to the system. I used an AD user as the service account for Tentacle and it worked as charm.

Happy deploying!

(PS: There might be easier ways to get the results from TestComplete or to parse a multipart mime document. If you know, please tell me, because this is not the most elegant way…)

Comments: 0

Leave a Reply

Your email address will not be published. Required fields are marked *