Scenario: Parameter count mismatch.

2,071 views
Skip to first unread message

Rahul Dixit

unread,
Dec 5, 2013, 12:43:23 AM12/5/13
to spec...@googlegroups.com
Hi All,

When executing a scenario I get the below error:

TargetParameterCountException was unhandled by user code: Parameter count mismatch.

All my methods and bindings have accurate paramter nubmers where they are called.
Interestingly this exception is thrown when the debugger gets to the Scenario:.... line.
It does not throw it on a Given When Then line.
Its failing before getting to my regex bindings. Can anyone help me out here please? Thanks.

Below is stack trace:   at System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at System.Delegate.DynamicInvoke(Object[] args)
   at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration)
   at TechTalk.SpecFlow.Bindings.BindingInvokerExtensions.InvokeHook(IBindingInvoker invoker, IHookBinding hookBinding, IContextManager contextManager, ITestTracer testTracer)
   at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireEvents(HookType bindingEvent)
   at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireScenarioEvents(HookType bindingEvent)
   at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnScenarioStart(ScenarioInfo scenarioInfo)
   at TechTalk.SpecFlow.TestRunner.OnScenarioStart(ScenarioInfo scenarioInfo)
   at SpecFlow.LoginFeature.ScenarioSetup(ScenarioInfo scenarioInfo) in c:\Users\Rahul\Documents\Visual Studio 2012\Projects\ShoutwikiGeneratedFinal\ShoutwikiGeneratedFinal\Login.feature.cs:line 0
   at SpecFlow.LoginFeature.LoginToShoutwiki() in c:\Users\Rahul\Documents\Visual Studio 2012\Projects\ShoutwikiGeneratedFinal\ShoutwikiGeneratedFinal\Login.feature:line 41

Oliver Friedrich

unread,
Dec 5, 2013, 4:25:20 AM12/5/13
to spec...@googlegroups.com
Please have a look at the generated NUnit code behind/designer file. Every scenario is matched by an NUnit test case in which a new ScenarioInfo instance is created which is then passed into the ScenarioSetup() method and from there further down.

Is it possible that something is wrong with that ScenarioInfo instance? Could your generated code file be somehow stale? Did an update to SpecFlow happen without regenerating the code files, maybe?

--


2013/12/5 Rahul Dixit <rahul.di...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "SpecFlow" group.
To unsubscribe from this group and stop receiving emails from it, send an email to specflow+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Rahul Dixit

unread,
Dec 5, 2013, 9:53:16 PM12/5/13
to spec...@googlegroups.com
Figured out the issue. I had a BeforeScenario method to which I has supplied an input and output paramter. Removed them and it worked. Thanks.
Reply all
Reply to author
Forward
0 new messages