开发者

Regression tests for T-SQL stored procedures

I would like to regression test t-sql stored procedures. My idea is to specify for each SP multiple input parameter sets. The SP should be executed wi开发者_如何学JAVAth these parameters, results should be written to disc. Next time the new results should be compared with results stored before.

Does anybody know a good tool for something like that? Should not be that hard to implement, but in practice you will need functionality like "ignore that column" or something like that. And I would assume that such a tool should already exist!?

cheers, Achim


I would use a unit test suite like DbUnit. DbUnit will set up your database, run the stored procedure and then verify the result, and optionally roll back the database ready for the next test. It represents input data and expected results as XML files, which you can reverse engineer from the data and schema already in the database.

To regression test, you use db unit to run the stored procedures under test once, and collect the output (without validating it). This defines your baseline that you run subsequent regression tests against.

DbUnit has a nice abstraction for tabular data, which can be fetched from CVS files, XML files or database objects.

The test inputs and expected results are are easy to diff and store in version control, since they are stored as XML. As mentioned, you can also load and save data from CSV files.

DbUnit is a great tool for testing database function, the project page, and the FAQ are good resources to get started.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜