lundi 1 juin 2015

SQL Server Project Automate Unit Testing

I have a SQL Server (2012) project in VS2013. I also have an app.config with Local configuration and [tfsbuildserver].sqlunittest.config with server connection string and a relative path.

When performing a check-in executes a build definition that makes deploy and run the tests. The deploy done correctly, but when tests throws me the following error:

An error occurred while SQL Server unit testing settings were being read from the configuration file. Click the test project, open the SQL Server Test Configuration dialog box from the SQL menu, add the settings to the dialog box, and rebuild the project.

app.config:

<configuration>
  <configSections>
    <section name="SqlUnitTesting" 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>
  <SqlUnitTesting AllowConfigurationOverride="true">
    <DatabaseDeployment DatabaseProjectFileName="[RELATIVEPATHLOCAL]"
      Configuration="Release" />
    <DataGeneration ClearDatabase="true" />
    <ExecutionContext Provider="System.Data.SqlClient" ConnectionString="Data Source=[LOCALSERVER];Initial Catalog=[DATABASE];Integrated Security=True;Pooling=False"
      CommandTimeout="30" />
    <PrivilegedContext Provider="System.Data.SqlClient" ConnectionString="Data Source=[LOCALSERVER];Initial Catalog=[DATABASE];Integrated Security=True;Pooling=False"
      CommandTimeout="30" />
  </SqlUnitTesting>
</configuration>

[tfsbuildserver].sqlunittesting.config:

<SqlUnitTesting>
  <DatabaseDeployment DatabaseProjectFileName="[RELATIVEPATHTFS]"
    Configuration="Release" />
  <DataGeneration ClearDatabase="true" />
  <ExecutionContext Provider="System.Data.SqlClient" ConnectionString="Data Source=[SERVERTEST];Initial Catalog=[DATABASETEST];Persist Security Info=True;User ID=[USER];Password=[PASS];Pooling=False"
    CommandTimeout="30" />
  <PrivilegedContext Provider="System.Data.SqlClient" ConnectionString="Data Source=[SERVERTEST];Initial Catalog=[DATABASETEST];Persist Security Info=True;User ID=[USER];Password=[PASS];Pooling=False"
    CommandTimeout="30" />
</SqlUnitTesting>

Tests run correctly locally. The error occurs when performing the build definition

Sorry for my English.

Thanks

Aucun commentaire:

Enregistrer un commentaire