app.config在nunit测试中进行验收测试
我写了一些specflow测试。 为了让这些测试运行,我需要在App.config中配置一些部分。 在Visual Studio中使用resharper作为测试运行器来运行测试它工作得很好,但是当使用NUnit测试运行器运行测试时,它看起来像App.config没有被读取,并且依赖于它的所有测试都失败了(在我的情况下每次测试)。
是否有可能让NUnit测试运行器读取为.dll指定的app.config?
更新:我使用NUnit的2.5.10版本。
我的app.config文件:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityMappingsConfiguration" type="OPF.KP.Business.EntitySettings, OPF.KP.Business, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" />
</configSections>
<entityMappingsConfiguration>
<entityMappings>
<entityMapping entityShortTypeName="ValidationResult" entityFactoryFullTypeName="OPF.KP.Business.Tests.ValidationResultStubFactory, OPF.KP.Business.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<entityMapping entityShortTypeName="Stillingsmelding" entityFactoryFullTypeName="OPF.KP.Business.FitNesseTests.StillingsmeldingFitNesseStubFactory, OPF.KP.Business.FitNesseTests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<entityMapping entityShortTypeName="Stillingsmeldingsfelter" entityFactoryFullTypeName="OPF.KP.Business.StillingsmeldingsfelterFactory, OPF.KP.Business, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<entityMapping entityShortTypeName="IInputModeSettings" entityFactoryFullTypeName="OPF.KP.Business.Tests.SettingsStubFactory, OPF.KP.Business.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</entityMappings>
</entityMappingsConfiguration>
<appSettings>
<add key="ShouldExecuteHistoricValidation" value="true" />
<add key="Kontrollstasjon.ValidatorService.Validate.ExecuteNoEnhetDuplicationVerification" value="false" />
</appSettings>
<specFlow>
<language feature="no" />
</specFlow>
</configuration>
链接地址: http://www.djcxy.com/p/51769.html