WebAii� DocumentationLanguage Filter
C# VB

Go back to ArtOfTest homepage.
logo
Skip Navigation Links.

Looking for a topic you can't find here? Feel free to let us know.

Using the Application's .config File

Instead of programmatically setting the configuration, the application or test program can use an application .config file to fetch the appropriate settings. The WebAii infrastructure has a built in .NET Config SectionHandler (under the 'ArtOfTest.Core' namespace) that can read the configuration settings from the .config file associated with the application or test. You place the settings in your .config file as follows:

  1. First add the following line to the 'configSections' section:

    <configSections>

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

    </configSections>

  2. Then add the settings you need under the 'WebAii.Settings' section.

    Note: It is not necessary to include all of WebAii's settings in your .config file. You only need to add settings for those you wish to override. The WebAii framework uses default values for any setting not explicitly set in the .config file.

    Note: The configuration setting names are case sensitive e.g.  AnnotateExecution will not be recognized and will cause an exception to be thrown while annotateExecution will be recognized and used.

    <WebAii.Settings

      annotateExecution="true"

      annotationMode="All"

      baseUrl="http://www.testserver.net/"

      logAnnotations="false"

      logLocation="D:\WebAiiLogs\"

    />

Here is an example of a complete app.config file that contains all of WebAii's configuration settings:

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

<configuration>

  <configSections>

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

  </configSections>

 

  <WebAii.Settings

    annotateExecution="true"

    annotationMode="All"

    aspNetDevServerPort="-1"

    baseUrl="http://www.testserver.net/"

    clientReadyTimeout="30000"

    createLogFile="true"

    defaultBrowser="InternetExplorer"

    enableScriptLogging="false"

    enableSilverlight="false"

    enableUILessRequestViewing="false"

    executionDelay="0"

    executionTimeout="20000"

    killBrowserProcessOnClose="false"

    localWebServer="None"

    logAnnotations="false"

    logLocation="D:\WebAiiLogs\"

    queryEventLogErrorsOnExit="true"

    recycleBrowser="false"

    scriptLoggingPort="8099"

    simulatedMouseMoveSpeed="0.3"

    waitCheckInterval="500"

    webAppPhysicalPath="C:\Aot\webtest\artoftest.testing\pages"

    useHttpProxy="false"

    verboseHttpProxy="false"

  />

 

</configuration>

In your test code initialization, you read these settings by simply setting the UseConfig flag to true when calling the Manager() constructor. If you use the BaseTest template (which is what the VsUnit, MbUnit, NUnit and xUnit templates do) this call is done for you by BaseTest during the Initialize call:

C#

Manager mgr = new Manager(true);

Visual Basic

Dim myManager As Manager = New Manager(True)

Note: If you are using WebAii's BaseTest (which the WebAii VS item templates use), there is no need to for your test code to read from the app.config file as shown above. The base class already does that for you. Read the item template's comments for the initialization routine for more details.
Copyrights © 2007-2009 ArtOfTest, Inc. All rights reserved. Privacy Policy | Terms of Use