Is there a way to display the execution time for each test?

207 views
Skip to first unread message

Erlis

unread,
Aug 3, 2012, 9:09:23 AM8/3/12
to ts...@googlegroups.com
Hi guys, 

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!!
Erlis 

Dennis Lloyd Jr

unread,
Aug 3, 2012, 9:41:59 AM8/3/12
to ts...@googlegroups.com
Hi Erlis,

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!

CaptureTestExecTimes.sql

Erlis Vidal

unread,
Aug 3, 2012, 11:02:47 AM8/3/12
to ts...@googlegroups.com
Hi Dennis, 

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. 

Erlis

Dennis Lloyd Jr

unread,
Aug 7, 2012, 10:19:12 AM8/7/12
to ts...@googlegroups.com
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 :-)

Dave Green

unread,
Aug 12, 2012, 1:20:39 PM8/12/12
to ts...@googlegroups.com
Hi Dennis,

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,

Dave
tSQLtXmlResultFormatterModifiedToOutputTestExecutionTimes.sql

Ben Carter

unread,
Apr 22, 2015, 4:12:59 PM4/22/15
to ts...@googlegroups.com
Hi,

I know this is an old thread, but is there any sort of ETA on this functionality being included in the official release? I'm very hesitant to use it if I have to perform a diff between it and the current install script to make sure that I'm not re-introducing bug(s) that were fixed. Especially since this was posted around three years ago.

Thanks!
Reply all
Reply to author
Forward
0 new messages