Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Omitting paramNameRegex and paramValueRegex results in error #440

Open
1 of 3 tasks
delatrie opened this issue Dec 4, 2023 · 0 comments
Open
1 of 3 tasks

Omitting paramNameRegex and paramValueRegex results in error #440

delatrie opened this issue Dec 4, 2023 · 0 comments

Comments

@delatrie
Copy link
Contributor

delatrie commented Dec 4, 2023

I'm submitting a ...

  • bug report
  • feature request
  • support request => Please do not submit support request here, see note at the top of this template.

What is the current behavior?

Omitting paramNameRegex and paramValueRegex of specflow.stepArguments in allureConfig.json results in the following error if a step contains a two-column data table:

  Message: 
System.ArgumentNullException : Value cannot be null. (Parameter 'pattern')

  Stack Trace: 
ThrowHelper.ThrowArgumentNullException(ExceptionArgument arg)
RegexCache.GetOrAdd(String pattern)
Regex.IsMatch(String input, String pattern)
AllureTestTracerWrapper.StartStep(StepInstance stepInstance)
ITestTracer.TraceStep(StepInstance stepInstance, Boolean showAdditionalArguments)
TestExecutionEngine.ExecuteStep(IContextManager contextManager, StepInstance stepInstance)
TestExecutionEngine.Step(StepDefinitionKeyword stepDefinitionKeyword, String keyword, String text, String multilineTextArg, Table tableArg)
TestRunner.Then(String text, String multilineTextArg, Table tableArg, String keyword)
SelectiveRunTestRunner.CallStepOfSelectedScenario(Action`4 stepFn, String text, String multilineTextArg, Table tableArg, String keyword)
SelectiveRunTestRunner.Then(String text, String multilineTextArg, Table tableArg, String keyword)
MyFeatureFeature.MyScenario() line 8
RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

allureConfig.json:

{
  "specflow": {
    "stepArguments": {
      "convertToParameters": "true"
    }
  }
}

The feature file:

Feature: My feature
  Scenario: My scenario
    Then a step with a table
      |a|b|
      |1|2|

The step definition:

using Allure.Net.Commons;
using TechTalk.SpecFlow;

namespace ClassLibrary2;

[Binding]
public class Class1
{
    [Then("a step with a table")]
    public void MyStep(Table table)
    {
        
    }
}

What is the expected behavior?

Tables with two columns should be either skipped (i.e., converted to attachments) or, probably, converted to step parameters according to the rules for horizontal data tables.

What is the motivation / use case for changing the behavior?

Some users might want to convert one-row tables to parameters while skipping all two-column tables with more than one row entirely.
Currently, there is no way of doing this. Users are forced to make up name and value patterns that don't match enything.

Please tell us about your environment:

  • Test framework: SpecFlow@3.9.74
  • Runner: SpecFlow.NUnit@3.9.74
  • Allure adapter: Allure.SpecFlow@2.11.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant