c# - Run Specflow with Xunit but gives error nunit.framework -
i'm having weird problem, have googled everywhere , point out have done,
i have simple specflow test login, after browser opening, error.
test name: check if login 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: @ system.reflection.runtimeassembly._nload(assemblyname filename, string codebase, evidence assemblysecurity, runtimeassembly locationhint, stackcrawlmark& stackmark, intptr pprivhostbinder, boolean throwonfilenotfound, boolean forintrospection, boolean suppresssecuritychecks) @ system.reflection.runtimeassembly.internalloadassemblyname(assemblyname assemblyref, evidence assemblysecurity, runtimeassembly reqassembly, stackcrawlmark& stackmark, intptr pprivhostbinder, boolean throwonfilenotfound, boolean forintrospection, boolean suppresssecuritychecks) @ system.reflection.runtimeassembly.internalload(string assemblystring, evidence assemblysecurity, stackcrawlmark& stackmark, intptr pprivhostbinder, boolean forintrospection) @ system.reflection.runtimeassembly.internalload(string assemblystring, evidence assemblysecurity, stackcrawlmark& stackmark, boolean forintrospection) @ system.reflection.assembly.load(string assemblystring) @ techtalk.specflow.unittestprovider.unittestruntimeproviderhelper.getassertmethodwithformattedmessage(string assemblyname, string typename, string methodname) @ techtalk.specflow.unittestprovider.nunitruntimeprovider.testinconclusive(string message) @ techtalk.specflow.infrastructure.testexecutionengine.onafterlaststep() @ specflow.generatedtests.uitest.smoke.features.loginfeature.scenariocleanup() @ specflow.generatedtests.uitest.smoke.features.loginfeature.checkifloginisworking() in c:\**\login.feature:line 17 result message: not load file or assembly 'nunit.framework' or 1 of dependencies. system cannot find file specified.
i have changed app.config
file to
<?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"/> <!-- additional details on specflow configuration options see http://go.specflow.org/doc-config --> <stepassemblies> <stepassembly assembly="specflow.assist.dynamic" /> </stepassemblies> </specflow> </configuration>
the weird thing if run normal selenium test ( not specflow ) works directly.
this part of generated feature file
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 working\r\nas expected , 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(); }
any ideas can missing?
thanks in advance.
this normal behavior since if install specflow
nuget package installed based on nunit have install nuget xunit specflow
install-package specflow.xunit -version 2.1.0
update if have done try add nunit package
This can occurs when there isn't any method matching a step in a scenario (ie: bad regex...)
ReplyDelete