Testing stored procedures using MSTest (.Net)?

There are a few solutions to this problem: Run the database data creation script after each test. You only need to create the data, not the tables, stored procedures and triggers. These should remain static while running your tests.

If data creation is still too time consuming, this won't work Isolate the data creation scripts by table and recreate the table data necessary for each test fixture and only run those scripts before each test in that particular feature. This would speed things up, but you're still creating the dataset before each test and could still be too slow to execute before each test Best Option: Wrap each test in a transaction. I am assuming all the databases you listed support transactions.

Simply, open a transaction, execute your test, verify the results and then rollback the transaction. The rollback will undo any data changes you have made. As long as you use the same connection to execute the stored procedure modifying the data and to verify the results, the changes should be available to the connection, but not committed to the database.

There are a few solutions to this problem: Run the database data creation script after each test. You only need to create the data, not the tables, stored procedures and triggers. These should remain static while running your tests.

If data creation is still too time consuming, this won't work. Isolate the data creation scripts by table and recreate the table data necessary for each test fixture and only run those scripts before each test in that particular feature. This would speed things up, but you're still creating the dataset before each test and could still be too slow to execute before each test.

Best Option: Wrap each test in a transaction. I am assuming all the databases you listed support transactions. Simply, open a transaction, execute your test, verify the results and then rollback the transaction.

The rollback will undo any data changes you have made. As long as you use the same connection to execute the stored procedure modifying the data and to verify the results, the changes should be available to the connection, but not committed to the database.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions