|Is there a way to display the execution time for each test?||Erlis||8/3/12 6:09 AM|
I would like to know if there's a way to display the execution time for each test. I've done something on the database that is causing one of the test to run really slow and I don't know which one. It will be really easy to find the test if this functionality exists.
Thanks for this tool!!
|Re: Is there a way to display the execution time for each test?||Dennis Lloyd Jr||8/3/12 6:41 AM|
tSQLt doesn't currently have this functionality. We've been waiting for someone to ask for it ;-)
Last last year, I had done a proof of concept to see how hard it would be. I've attached the script that implements that proof of concept here. However, I never fully tested it, and the code is a little old - therefore, I can't confidently say it works in the current release of tSQLt. If you want, you can try it out.
What this script does is add a Start and End time column to the TestResult table and then value those two columns in when tests are executed. This code only modifies the default result formatter - in other words, it would only work when you execute tSQLt.RunAll in Management Studio. It will not display the results in the XML output or in SQL Test.
Hopefully this helps you troubleshoot you're problem!
|Re: Is there a way to display the execution time for each test?||Erlis Vidal||8/3/12 8:02 AM|
Thanks you!!! It is working great!
I've found the slow test and fixed the issue.
This should be included in the official version of tSQLt.
|Re: Is there a way to display the execution time for each test?||Dennis Lloyd Jr||8/7/12 7:19 AM|
Glad it helped! We'll be including it in an upcoming release. Not sure how soon though, but we'll try to get it in earlier than later :-)
|Re: Is there a way to display the execution time for each test?||Dave Green||8/12/12 10:20 AM|
That's a great addition to tSQLt and seems to work for the simple tests I've run. I agree with Erlis that this should be included in the official release.
I've updated the XMLFormatter to export the test times so that a Continuous Integration tool can use the times too. I attach the script as it may well be of use to others.
I've tested with TeamCity (7.0.3), as that is what I have immediate access to. It should work with any CI server that can read the original XML output - but use at your own risk.
I hope that it helps someone,