How do I generate test data using Visual Studio 2012?
I found these 2 articles on how to do it using VS 2010. But what about VS 2012?
My database is an SQL-Server 2008-R2 database.
Thanks in advance.
At this point I have a test project, with a test class and a blank test method. Just for fun, let's run this test and see what happens. Visual Studio 2012 has a window called Test Explorer for interacting and running unit tests. In Visual Studio, select Test | Windows | Test Explorer to open this window, shown in Figure 2.
And Visual Studio 2012, with its unit testing framework, provides the ability to easily implement test-driven development in an organization. In Part 2 of this column, I will continue to build off this example, and show in more detail how to use the unit test framework in Visual Studio 2012.
The tests act as documentation for the system The tests serve as a suite of regression tests, ensuring that future code changes don't break existing functionality Visual Studio 2012 supports the concept of TDD through its unit testing framework.
Create a data source that contains the values that you use in the test method. The data source can be any type that is registered on the machine that runs the test. Add a private TestContext field and a public TestContext property to the test class. Create a unit test method and add a DataSourceAttribute attribute to it.
While this feature was in Visual Studio 2010 (if you added VSTE DBPRO), it did not make the cut for Visual Studio 2012 / SSDT (yet). This does not mean it will not make it into the product before the next release - it is the sort of thing that could come as a feature pack, power tool or even in a service pack. Same with database unit testing and data compare functionality.
As I suggested in a comment, in the meantime you could use a 3rd party tool like RedGate's SQL Data Generator. Also see this question for some other options. And hang in there. :-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With