Invoking the data generator from the command line
Do we have the ability to invoke the data generator from the command line or as a part of the deployment of the database (i.e. using theDeploy Selectioncommand)?
This would be useful in automated build setups where we need to perform some sort of intermediate check after a successful creation of the database on the server but before actually loading some (test) data in it.
-Tanveer Rashid
In CTP3, we do not provide a tool/executable to invoke a data generation plan from the command line. However, we do provide a public API for invoking a .dgen so you can write a simple executable yourself. The call you need to make is:
DBTest.GenerateData(
string dataGeneratorFilePath,
string connectionString); The DBTest class is located in namespace Microsoft.VisualStudio.TeamSystem.Data.UnitTesting.
Thanks!
DataGenerator is also exposed as a MSBuild task. This makes it very easy to incorporate DataGeneration into any build process. A simple project file using the MSBuild task is:
<Project DefaultTargets="DataGen" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--Import the settings-->
<Import Project="$(MSBuildBinPath)\Microsoft.VisualStudio.TeamSystem.Data.targets" />
<Target Name="DataGen">
<DataGeneratorTask
ConnectionString="$(ConnectionString)"
SourceFile="$(SourceFile)"
PurgeTablesBeforePopulate="$(PurgeTablesBeforePopulate)"
/>
</Target>
</Project>
There are other options on the build task and I would expect this to be flushed out more in future releases.