2017-10-03 31 views
0

Je continue d'obtenir cette erreur lorsque j'essaie d'exécuter mes tests Specflow. Je l'ai essayé de supprimer le bac, supprimé tous les paquets NuGet et les réinstallée, a modifié leLes tests Specflow ne démarrent pas

app.config, but this error still persist 


Test Name: CreateAnEmailCampaign 

Result Message: 
OneTimeSetUp: System.Configuration.ConfigurationErrorsException : Configuration system failed to initialize 
    ----> System.Configuration.ConfigurationErrorsException : Unrecognized configuration section sectionGroup. (C:\Users\bin\Debug\Demo.dll.config line 11) 


<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <configSections> 
    <section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" /> 
    </configSections> 


    <sectionGroup name="NUnit"> 
    <section name="TestRunner" type="System.Configuration.NameValueSectionHandler" /> 
    </sectionGroup> 
    <NUnit> 
    <TestRunner> 
     <!-- Valid values are STA,MTA. Others ignored. --> 
     <add key="ApartmentState" value="STA" /> 
    </TestRunner> 
    </NUnit> 
    <runtime> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
     <dependentAssembly> 
     <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> 
     <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" /> 
     </dependentAssembly> 
    </assemblyBinding> 
    </runtime> 
    <specFlow> 
    <!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config --> 
    <!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config --><!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config --><unitTestProvider name="NUnit" /></specFlow></configuration> 
+0

s'il vous plaît poster votre app.config –

+0

S'il vous plaît partager app.config et Demo.dll.config –

+0

app.config @VijayanathViswanathan ajouté –

Répondre

0

Dans le appconfig vous avez posté, l'élément sectionGroup est pas un enfant de configSections et donc l'erreur -

Section de configuration non reconnue sectionGroup.

Pour résoudre ce problème, déplacez le sectionGroup à l'intérieur du configSections comme indiqué ci-dessous.

<?xml version="1.0" encoding="utf-8"?> 
 
<configuration> 
 
    <configSections> 
 
    <sectionGroup name="NUnit"> 
 
     <section name="TestRunner" type="System.Configuration.NameValueSectionHandler" /> 
 
    </sectionGroup> 
 
    <section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" /> 
 
    </configSections> 
 
    <NUnit> 
 
    <TestRunner> 
 
     <!-- Valid values are STA,MTA. Others ignored. --> 
 
     <add key="ApartmentState" value="STA" /> 
 
    </TestRunner> 
 
    </NUnit> 
 
    <runtime> 
 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
 
     <dependentAssembly> 
 
     <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> 
 
     <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" /> 
 
     </dependentAssembly> 
 
    </assemblyBinding> 
 
    </runtime> 
 
    <specFlow> 
 
    <!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config --> 
 
    <!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config --> 
 
    <!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config --> 
 
    <unitTestProvider name="NUnit" /> 
 
    </specFlow> 
 
</configuration>

+0

Smashing, merci @AK_ –

+0

Salut @ kristian-dimitrov, s'il vous plaît marquer la réponse acceptée si cela a fonctionné pour vous. Merci. –