Delen via


Configuratiebestanden voor assembly's

TAEF ondersteunt configuratiebestanden voor testassembly's. Een configuratiebestand moet dezelfde naam hebben als uw testassembly + ".config". Als u een testassembly hebt met de naam MyUnitTests.dll, moet uw configuratiebestand de naam MyUnitTests.dll.confighebben.

Het configuratiebestand moet in dezelfde map worden geplaatst als het testassemblybestand.

.NET-configuratiebestanden

De .NET-configuratiebestanden zijn XML-bestanden in de volgende vorm:

<configuration>
    <appSettings>
        <add key="AssemblySetup" value="Assembly setup configuration information"/>
        <add key="ClassSetup" value="Class setup configuration information"/>
        <add key="TestSetup" value="Test setup configuration information"/>
        <add key="Test" value="Test configuration information"/>
    </appSettings>
</configuration>

Het configuratiebestand is een verzameling naam-/waardeparen.

Het configuratiebestand lezen uit uw tests

U kunt de klasse System.Configuration.ConfigurationManager gebruiken om gegevens uit uw configuratiebestanden te lezen. Bijvoorbeeld

NameValueCollection appStgs = ConfigurationManager.AppSettings;
Log.Comment(appStgs["AssemblySetup"]);