Error connecting to database when unit-testing RRS feed

  • Question

  • User39841677 posted
    Hi, guys! I have a 3-tier application. I'm trying to test my DAL with VS.NET 2005 Beta 2 testing capabilities, but I keep on getting error:
    Test method DalTests.Persona.Insert threw exception:  System.Configuration.ConfigurationException: Invalid section name. The section 'dataConfiguration' does not exist in the requested configuration file 'C:\Documents and Settings\alex\Local Settings\Application Data\VSEqtDeploymentRoot\33ef7eee-b2c0-46fb-9a94-a992da1484db\Out\vstesthost.exe.config' or the file 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50215\Config\machine.config'. Make sure that the 'enterpriseLibrary.configurationSections' configuration section exists in one of the files and that the section 'dataConfiguration' is defined..

    DalTests is my unit testing project and Persona is the name of the main class.

    I've tried to solve it checking at web.config, machine.config and even I made a .config file myself from Enterprise Library manager, but everything is useless.

    Hope any one can lend me a hand with this. Thank you!
    Friday, October 21, 2005 4:54 PM

All replies

  • User-1683643362 posted

    Sounds like you're missing a config file or you are using the wrong config file. In order to use Enterprise Library's configuration application block, you will need to use the config GUI to open your web.config file and create a data access application block config section and configure all the attributes. Once you finish that, the config GUI will generate a new config file in your application root directory called dataconfiguration.config. One thing I have noticed is that you have to manually copy this file to your bin directory or the application will not find it.

    Hope that helps.

    Thursday, October 27, 2005 7:26 PM
  • User-2096861742 posted
    Hi Alextirado,

    I'm running VS2005 Team System and attempting to unit test a business class. I'm running into the same problem you described aboved. I'm getting this configurationException:invalid section name. Were you ever able to find the solution to this? I tried modifying the web.config and machine.config as well, but it did not help. Any feedback to this issue is greatly appreciated.

    Friday, November 4, 2005 2:01 PM
  • User-1683643362 posted
    Can you post your config files with changed values for your DB and user account info? I have run into this type of problem when I modify or customize my config file after I use the configuration GUI to create my config files.
    Friday, November 4, 2005 2:37 PM
  • User-2096861742 posted

    I was able to resolve this by adding an app.config file to my class library project. Apparently, when unit testing in vs2005, you need to add an app.config file to your class library project if you are referencing any xml setting with custom sections. The app.config should have the custom sections defined. Thanks Alexjando for your help.

    Monday, November 7, 2005 3:12 PM