简体   繁体   中英

generate test data to perform integration tests of stored procedures

I have a legacy application asp.net web form application that accesses a sql server 2005 database without any proper data access layer. In other words, it is not very amenable to automatic integration tests using NUnit. I would like to add some stored procedures to the database and test them via automatic integration tests (ideally using NUnit + C# as that's what I am familiar with).

I have a cleaning script for the database which puts it in a pristine state so I could use this during Setup/Teardown. What I am looking for is some very quick way to pump test data into the database. Any feedback regarding this in my scenario would be very much appreciated. Option I am currently looking at are (EF, Dapper, easy objects) but maybe there is an easier way? Thanks!

Visual Studio 2005, 2008, and 2010 had a really nice data generation tool that I used quite frequently. Unfortunately they removed it in 2012. If you are still running 2010 (Ultimate or Premium) you should have access to it. It's nice and robust allowing you define different plans for different fields either of known types or using regular expressions.

http://msdn.microsoft.com/en-us/library/aa833237(v=vs.100).aspx

I've wrapped them in my builds so that my unit tests and codedUI tests feed off of them. When they removed it in 2012 we switched to simple hand coding using what we had gleaned from the outputs of this tool. If you're just looking for a one and done though this will get it for you since it's a legacy app you're trying to maintain.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM