allure-framework / allure-framework/allure-csharp

Omitting paramNameRegex and paramValueRegex results in error

Open
#440 0 comments 0 reactions 0 assignees View on GitHub
bug theme:specflow
Dominant language
C#
Stars
125
Forks
76
Avg merge
1d 2h
Merged PRs (30d)
18

Description

#### I'm submitting a ...
- [x] 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:

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

The feature file:

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

The step definition:

```csharp
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

Contributor guide

Open the contributing guide

Research direction

Start at AllureTestTracerWrapper.StartStep and follow the call through ITestTracer.TraceStep, using the allureConfig.json example to reproduce the missing-pattern case with a two-column table. Determine and document the intended handling for omitted paramNameRegex and paramValueRegex. Done means the reproduced scenario no longer throws an ArgumentNullException and follows the selected table-conversion behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.