|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: 2 days ago @ 10:59 AM
Points: 1,109,
Visits: 523
|
|
Comments posted to this topic are about the item SQL Unit Testing
Alejandro Pelc
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, September 11, 2012 3:05 PM
Points: 3,
Visits: 18
|
|
is it possible to test ssrs reports?
Regards, KarthikShanth.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: 2 days ago @ 3:06 AM
Points: 1,026,
Visits: 751
|
|
sounds interesting.
The main issues I guess would be around identities/autoincrements and anything with password in the call!
Do you have some way of resetting the database after?
|
|
|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Yesterday @ 12:34 AM
Points: 449,
Visits: 1,772
|
|
RichardB (4/8/2009) sounds interesting.
The main issues I guess would be around identities/autoincrements and anything with password in the call!
Do you have some way of resetting the database after?
Hi RichardB,
you could either backup the database, run the test and then restore the backup or take a snapshot of the database and restore that after the unit test.
This would guarantee a database being in the same state for each unit test run.
Regards
GermanDBA
Regards,
WilliamD
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: 2 days ago @ 10:59 AM
Points: 1,109,
Visits: 523
|
|
Hi there, GermanDBA is right, you should create some sort of backup/restore strategy or include the DB creation / data population prior to run the tests and then just drop the database
Alejandro Pelc
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: 2 days ago @ 10:59 AM
Points: 1,109,
Visits: 523
|
|
Hi karthikshanth, You can actually test the calls to the database, so in a certain way you are testing the SSRS backend. If you want to test the reports, there's a free tool called WatIN (http://watin.sourceforge.net) you can use to do that. It uses the IE and records all the activity in the page. It has its limitations but you can make it work.
Thanks, Alejandro
Alejandro Pelc
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Wednesday, January 16, 2013 7:40 AM
Points: 136,
Visits: 259
|
|
This sounds like it could have many uses. Thanks for the contribution.
The more you are prepared, the less you need it.
|
|
|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 8:02 AM
Points: 80,
Visits: 341
|
|
Interesting article and very timely for me. My big question is how do you detect errors/slow running queries etc? Do you need to run profiler again to detect database problems? Is there any means to detect when the newly revised code doesn't error, but is inserting/updating incorrect data? When you have a 150gb OLTP database, it is difficult to determine problems down at the row/column level. Any ideas on this?
Cheers, Mike Byrd
Mike Byrd
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: 2 days ago @ 10:59 AM
Points: 1,109,
Visits: 523
|
|
Hi Mike,
The test will validate if it runs without errors. Because you're executing stored procedures or t-sql commands, if there's an error, the unit test will fail, so the overall test will fail (it'll show you, for instance, 10 test ok and 1 failed). Also, when you configure the test in a test solution in visual studio, you can configure the maximum execution time, and if it takes more than that time, the test will fail. About the data, the whole idea of unit testing is testing all the different aspects of your database, including sending bad data just to validate your error handling. Of course, you must customize the output to do that, inserting some c# code... Finally, I don't know if I would run unit tests on a 150 GB database just to validate the changes. I'll do that to test performance, but not for reviewing that changes didn't break existing procedures. Of course, every scenario is different...
Thanks ! Alejandro
Alejandro Pelc
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: 2 days ago @ 3:06 AM
Points: 1,026,
Visits: 751
|
|
GermanDBA (4/8/2009)
you could either backup the database, run the test and then restore the backup or take a snapshot of the database and restore that after the unit test.
Only issue being that it's a 1.5TB database... so around a day to restore.
|
|
|
|