2015-06-01 47 views
1

我在VS2013中有一個SQL Server(2012)項目。我也有一個帶本地配置的app.config,帶有服務器連接字符串和一個相對路徑的[tfsbuildserver] .sqlunittest.config。SQL Server項目自動化單元測試

執行簽入時執行構建定義,該構建定義將部署並運行測試。部署正確,但測試時拋出我下面的錯誤:

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> 

測試運行正確本地。執行構建定義時發生錯誤

對不起,我的英語。

感謝

回答

0

原來的問題是,我有<SqlUnitTesting>之前前導空格,一旦這些被拆除的試驗運行如預期,並刪除

<?xml version="1.0" encoding="utf-8" ?> 

網址:Link Resolved