Logging Test Results into custom table, gets rolled back?
I'm using SQL Test to write some tests to check the performance of some of our ERP API's (e.g. record the execution times in a loop of 100, check that the majority fall within 1 Standard Deviation of pre-recorded norms), and although I have my Fail conditions coded in the SQL Test, I also want to log the results into a separate table, so if we do get a failure I can see what the details are. Unfortunately SQL Test must be rolling back this write when it occurs, because I end up with no data left in the table. Does this sound like it is working as intended for SQL Test, and is there a way to disable this when running a particular test?
(When I run the SQL script outside of SQL Test it does record into the logging table).
Thanks.
(When I run the SQL script outside of SQL Test it does record into the logging table).
Thanks.
Tagged:
Best Answer
-
Jon_Kirkwood Posts: 441 Gold 1Thank you for reaching out on the Redgate forums regarding your query with SQL Test.
Reading your process it looks like this may be a concern with tsqlt, which is the process running behind SQL Test. tsqlt is an open-source database unit testing solution of which Redgate is a sponsor however we do not own/maintain their codebase
Sadly we do not handle tsqlt support directly, you can gain access to their various channels to ask questions, pull their code & review the program functionality.
Some handy links to assist you further
Website - https://tsqlt.org/
Post a question in the tSQLt Google group - https://groups.google.com/g/tsqlt?pli=1
Stack Overflow - https://stackoverflow.com/questions/tagged/tsqlt
Slack - https://sqlcommunity.slack.com/ (channel #tsqlt)
Of interest, I did look at their codebase and searched for rollbacks, there were a number of hits including a file - CaptureTestExecTimes.sql which looks similar to the experience you are outliningJon Kirkwood | Technical Support Engineer | Redgate Software
Answers