Search code examples
unit-testingvisual-studio-2013sql-server-data-tools

Documentation for the SqlUnitTesting_VS2013 config file


Is anyone aware of where to find the documentation for the app.config section for database unit tests in Visual Studio 2013?

i.e. the documentation for:

<section name="SqlUnitTesting_VS2013" type="Microsoft.Data.Tools.Schema.Sql.UnitTesting.Configuration.SqlUnitTestingSection, Microsoft.Data.Tools.Schema.Sql.UnitTesting, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

Solution

  • I don't know where is the documentation about these config attributes. Check my question here SSDT Unit Test:. An error occurred while SQL Server unit testing settings were being read from the configuration file

    I came up with my own app.config (after lots of research and try&error) and it is working. Your database project need to deploy in order to make the tests run.

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <configSections>
        <section name="system.data.localdb" type="System.Data.LocalDBConfigurationSection,System.Data,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089"/>
        <section name="SqlUnitTesting_VS2013" type="Microsoft.Data.Tools.Schema.Sql.UnitTesting.Configuration.SqlUnitTestingSection, Microsoft.Data.Tools.Schema.Sql.UnitTesting, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      </configSections>
      <system.data.localdb>
        <localdbinstances>
          <add name="(localdb)\ProjectsV12" version="12.0" />
        </localdbinstances>
      </system.data.localdb>
      <SqlUnitTesting_VS2013>
        <DatabaseDeployment DatabaseProjectFileName="..\..\..\Database_Project_Name\Database_Project_Name.sqlproj"
            Configuration="Debug" />
        <DataGeneration ClearDatabase="true" />
        <ExecutionContext Provider="System.Data.SqlClient" ConnectionString="Data Source=(localdb)\ProjectsV12;Initial Catalog=Database_Name;Integrated Security=True;Pooling=False;Connect Timeout=30"
            CommandTimeout="30" />
        <PrivilegedContext Provider="System.Data.SqlClient" ConnectionString="Data Source=(localdb)\ProjectsV12;Initial Catalog=Database_Name;Integrated Security=True;Pooling=False;Connect Timeout=30"
            CommandTimeout="30" />
      </SqlUnitTesting_VS2013>
    </configuration>