locked
Problem with AllowConfigurationOverride

    Question

  • I want to deploy a database unittest project. As described in Visual Studio 2010 Database Projects Guidance Document and in How to: Run Database Unit Tests from Team Foundation Build I have created and deployed an additional <Server>.dbunittest.config file. I have copied the app.config file including the DatabaseUnitTesting element and just changed to path of the Database project.

    When executing the tests, I get a Test run failed message:

    An error occurred while reading file C:\Projects\MyProject\Main\TestResults\Name_LT-XY2 2010-09-09 16_49_40\Out\LT-XY2.dbunittest.config : Expected to find an element.

    And an error message for every single test:

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

    Any idea what might be wrong or which element my be missing?

    Thanks
    Hans-Peter 

    Thursday, September 09, 2010 3:19 PM

Answers

  • I had the same issue and in the dbunittest.config

    It works now with only the below in my file.

    <DatabaseUnitTesting>
      <DataGeneration ClearDatabase="true" />
      <ExecutionContext Provider="System.Data.SqlClient" ConnectionString="Data Source=xxx;Initial Catalog=xxx;Persist Security Info=True;User ID=xxxx;Password=xxx;Pooling=False"
          CommandTimeout="30" />
      <PrivilegedContext Provider="System.Data.SqlClient" ConnectionString="Data Source=xxx;Initial Catalog=xxx;Persist Security Info=True;User ID=xxx;Password=xxx;Pooling=False"
          CommandTimeout="30" />
    </DatabaseUnitTesting>

    removed:

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

        <configSections>
            <section name="DatabaseUnitTesting" type="Microsoft.Data.Schema.UnitTesting.Configuration.DatabaseUnitTestingSection, Microsoft.Data.Schema.UnitTesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
        </configSections>

    and

    </configuration>
    • Marked as answer by Hans-Peter Wednesday, September 15, 2010 11:42 AM
    Tuesday, September 14, 2010 6:33 PM

All replies

  • No idea?

    :-( Hans-Peter

    Tuesday, September 14, 2010 5:53 AM
  • I had the same issue and in the dbunittest.config

    It works now with only the below in my file.

    <DatabaseUnitTesting>
      <DataGeneration ClearDatabase="true" />
      <ExecutionContext Provider="System.Data.SqlClient" ConnectionString="Data Source=xxx;Initial Catalog=xxx;Persist Security Info=True;User ID=xxxx;Password=xxx;Pooling=False"
          CommandTimeout="30" />
      <PrivilegedContext Provider="System.Data.SqlClient" ConnectionString="Data Source=xxx;Initial Catalog=xxx;Persist Security Info=True;User ID=xxx;Password=xxx;Pooling=False"
          CommandTimeout="30" />
    </DatabaseUnitTesting>

    removed:

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

        <configSections>
            <section name="DatabaseUnitTesting" type="Microsoft.Data.Schema.UnitTesting.Configuration.DatabaseUnitTestingSection, Microsoft.Data.Schema.UnitTesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
        </configSections>

    and

    </configuration>
    • Marked as answer by Hans-Peter Wednesday, September 15, 2010 11:42 AM
    Tuesday, September 14, 2010 6:33 PM
  • Very strange, indeed!

    Thanks

    Wednesday, September 15, 2010 11:43 AM