This is a migrated thread and some comments may be shown as answers.

unable to locate app.config through mstest.exe

6 Answers 342 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 30 Jan 2011, 09:22 PM
Exception:
Initialization method MyTests.InitializeTest threw exception.
 
System.Configuration.ConfigurationErrorsException: System.Configuration.ConfigurationErrorsException:
 An error occurred creating the configuration section handler for WebAii.Settings: Could not load file
 or assembly 'ArtOfTest.WebAii' or one of its dependencies. The system cannot find the file specified.
 (C:\MyTests\bin\Debug\TestResults\akharlamov 2011-01-30 12_53_49\Out\MyTests.dll.config line 5) --->
 System.IO.FileNotFoundException: Could not load file or assembly 'ArtOfTest.WebAii' or one of its
 dependencies.

App.config (Build Action: Content, Copy to Output Directory: Copy always):
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="WebAii.Settings" type="ArtOfTest.WebAii.Core.SettingsConfigSectionHandler, ArtOfTest.WebAii" />
  </configSections>
  <WebAii.Settings
      annotateExecution="true"
      baseUrl="http://local.mytests.com"
      clientReadyTimeout="50000"
      defaultBrowser="FireFox"
      enableScriptLogging="false"
      enableUILessRequestViewing="false"
      executionDelay="0"
      executionTimeout="60000"
      localWebServer="None"
      logLocation="C:\WebAiiLog\MyTests"
      queryEventLogErrorsOnExit="false"
      simulatedMouseMoveSpeed="1"
      webAppPhysicalPath="/"
      recycleBrowser="false"
      killBrowserProcessOnClose="true"
  />
</configuration>

Run:
mstest /testcontainer:MyTests.dll

I can run my tests through visual studio without issues, however when I run them through the command prompt I have an issue running the tests, I am getting an exception stating that my app.config file is missing even though I can see it in the bin/Debug folder. I am wondering what I am doing wrong?

UPDATE: tried adding:
<section name="WebAii.Settings" type="ArtOfTest.WebAii.Core.SettingsConfigSectionHandler, ArtOfTest.WebAii, Version=2.0.50727, Culture=neutral, PublicKeyToken=4fd5f65be123776c"/>
and just 2.0.5.0, but no luck.


-Thank You.

6 Answers, 1 is accepted

Sort by
0
Andrew
Top achievements
Rank 1
answered on 03 Feb 2011, 08:24 PM
bump, anyone have any ideas?
0
Cody
Telerik team
answered on 04 Feb 2011, 07:19 PM
Hello Andrew,

The problem is that you haven't fully specified which WebAii dll to use as documented here. You need to expand your configSections like this:

<configSections>
  <section name="WebAii.Settings" type="ArtOfTest.WebAii.Core.SettingsConfigSectionHandler, ArtOfTest.WebAii, Version=2010.3.1307.0, Culture=neutral, PublicKeyToken=4fd5f65be123776c" />
</configSections>

Be sure to substitute the version number for the actual version you have installed.

Greetings,
Cody
the Telerik team
Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment
0
kwee
Top achievements
Rank 1
answered on 25 Oct 2011, 07:29 PM
Hi,

I ran into the same problem and agree that putting the version string into the .cfg solves the problem.
However, I would like to get a better explanation of why Visual Studio 2010 did not need the version string, while mstest does.
Is there a way to say "version=ignore" so that mstest will work similar to Visual Studio?

Thanks,
0
Cody
Telerik team
answered on 28 Oct 2011, 04:51 PM
Hello Kwee,

I am sorry we don't have a good explanation nor a solution to this. I've logged a feature request for it.

Greetings,
Cody
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
kwee
Top achievements
Rank 1
answered on 12 May 2012, 02:39 AM
I believe I have a working ( and possibly partial ) explanation now. I'll report it, to add to the knowledgebase,
and so that others can improve on it.

On the command line:
1) If you use mstest /testcontainer option, then app.config must contain a fully specified identity
   See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270
   The app.config is copied to the mstest run directory as <target>.config for execution.

2) If you use mstest /testmetadata option, then app.config can remain partial. This retains the older obsoleted behavior as
   defined in the whitepaper. This mimics the behavior of VS2010, which allows partial identities.
   Sometimes the .vsmdi file is not correctly written out. Check that it contains <TestLink> sections.

Example of a fully specified identity for ArtOfTest.WebAii assembly
    <section name="WebAii.Settings" type="ArtOfTest.WebAii.Core.SettingsConfigSectionHandler, ArtOfTest.WebAii,Version=2012.1.411.0, Culture=neutral, PublicKeyToken=4fd5f65be123776c" />
Example of a partially specified identity for ArtOfTest.WebAii assembly
    <section name="WebAii.Settings" type="ArtOfTest.WebAii.Core.SettingsConfigSectionHandler, ArtOfTest.WebAii" />
0
Cody
Telerik team
answered on 14 May 2012, 10:15 PM
Hi kwee,

Thank you for this new information! We'll work on adding it to our online documentation. I've granted you Telerik Points for pointing us to this article.

Regards,
Cody
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Andrew
Top achievements
Rank 1
Answers by
Andrew
Top achievements
Rank 1
Cody
Telerik team
kwee
Top achievements
Rank 1
Share this question
or