Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate test data using Visual Studio 2012?

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?

  • SQL Server 2008 R2 Test Data Load Using VS2010
  • Generating Test Data for Databases by Using Data Generators

My database is an SQL-Server 2008-R2 database.

Thanks in advance.

like image 518
Cesar Daniel Avatar asked Sep 26 '12 22:09

Cesar Daniel


People also ask

How do I run a test in Visual Studio 2012?

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.

What is the Visual Studio 2012 unit testing framework?

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.

What is TDD 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.

How do I create a data source for a test method?

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.


1 Answers

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. :-)

like image 136
Aaron Bertrand Avatar answered Oct 13 '22 18:10

Aaron Bertrand