2017-03-24 1 views
1
내가 이상한 문제에 봉착

을 제공 사방 검색 좀 그리고 내가 이미 한 일을 지적, xUnit의 실행 Specflow하지만 오류 nunit.framework

내가 로그인을 테스트하는 간단한 specflow을 가지고 있지만, 브라우저가 열리고 있습니다.이 오류가 발생합니다.
Test Name: Check if Login is working 
Test FullName: SpecFlow.GeneratedTests.UITest.Smoke.Features.LoginFeature.CheckIfLoginIsWorking 
Test Source: C:\**\Login.feature : line 7 
Test Outcome: Failed 
Test Duration: 0:00:02,676 

Result StackTrace: 
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) 
    at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) 
    at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) 
    at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) 
    at System.Reflection.Assembly.Load(String assemblyString) 
    at TechTalk.SpecFlow.UnitTestProvider.UnitTestRuntimeProviderHelper.GetAssertMethodWithFormattedMessage(String assemblyName, String typeName, String methodName) 
    at TechTalk.SpecFlow.UnitTestProvider.NUnitRuntimeProvider.TestInconclusive(String message) 
    at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep() 
    at SpecFlow.GeneratedTests.UITest.Smoke.Features.LoginFeature.ScenarioCleanup() 
    at SpecFlow.GeneratedTests.UITest.Smoke.Features.LoginFeature.CheckIfLoginIsWorking() in C:\**\Login.feature:line 17 
Result Message: Could not load file or assembly 'nunit.framework' or one of its dependencies. The system cannot find the file specified. 

나는 또한 직접 작동

<?xml version="1.0" encoding="utf-8"?> 
<configuration>, 
    <appSettings> 
    <add key="xunit.diagnosticMessages" value="true"/> 
    </appSettings> 
    <configSections> 
    <section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" /> 
    </configSections> 
    <specFlow> 
    <unitTestProvider name="xUnit"/> 
    <!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config --> 
    <stepAssemblies> 
     <stepAssembly assembly="SpecFlow.Assist.Dynamic" /> 
    </stepAssemblies> 
    </specFlow> 
</configuration> 

이상한 것은 내가 정상 셀레늄 테스트를 실행하면 (specflow되지 않음)이다에 app.config 파일을 변경했습니다.

또한 생성 기능 파일

using TechTalk.SpecFlow; 


    [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "2.1.0.0")] 
    [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 
    public partial class LoginFeature : Xunit.IClassFixture<LoginFeature.FixtureData>, System.IDisposable 
    { 

     private static TechTalk.SpecFlow.ITestRunner testRunner; 

#line 1 "Login.feature" 
#line hidden 

     public LoginFeature() 
     { 
      this.TestInitialize(); 
     } 

     public static void FeatureSetup() 
     { 
      testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(); 
      TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Login", "Check if Login functionality is working\r\nas expected and see if correct username " + 
        "is poping up", ProgrammingLanguage.CSharp, ((string[])(null))); 
      testRunner.OnFeatureStart(featureInfo); 
     } 

     public static void FeatureTearDown() 
     { 
      testRunner.OnFeatureEnd(); 
      testRunner = null; 
     } 

     public virtual void TestInitialize() 
     { 
     } 

     public virtual void ScenarioTearDown() 
     { 
      testRunner.OnScenarioEnd(); 
     } 

     public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo) 
     { 
      testRunner.OnScenarioStart(scenarioInfo); 
     } 

     public virtual void ScenarioCleanup() 
     { 
      testRunner.CollectScenarioErrors(); 
     } 

     public virtual void SetFixture(LoginFeature.FixtureData fixtureData) 
     { 
     } 

     void System.IDisposable.Dispose() 
     { 
      this.ScenarioTearDown(); 
     } 

모든 아이디어를 어떻게 누락 될 수의 일부인가?

미리 감사드립니다.

+0

config에서 unitTestProvider를 변경 한 후에는 파일의 모든 코드를 다시 생성해야합니다. NUnit 클래스를 참조하는 정적 코드를 포함 할 수 있습니다. 벌써 했니? –

답변

0

당신이 Specflow을 설치하는 경우가 NUNIT 에 따라 설치되는 패키지 nuget 때문에 이것은 정상적인 동작입니다 그래서 당신은 업데이트 install nuget xunit for specflow

Install-Package SpecFlow.xUnit -Version 2.1.0 

에 당신이 NUNIT 패키지

를 추가하려고 할 경우이
+0

예. 내가 allready = =/ – Dymond

+0

내 업데이트를 사용해 문제를 해결할 수 있는지 확인하는 것을 잊어 버렸습니다. –