SpecFlowOSS / SpecFlow

#1 .NET BDD Framework. SpecFlow automates your testing & works with your existing code. Find Bugs before they happen. Behavior Driven Development helps developers, testers, and business representatives to get a better understanding of their collaboration
https://www.specflow.org/
Other
2.22k stars 751 forks source link

Behavior inconsistency when using ".." in test data #2752

Closed serge-rsvz-inasti closed 3 weeks ago

serge-rsvz-inasti commented 3 weeks ago

SpecFlow Version

3.9.74

Which test runner are you using?

SpecFlow+ Runner

Test Runner Version Number

N/A

.NET Implementation

.NET 6.0

Project Format of the SpecFlow project

Sdk-style project format

.feature.cs files are generated using

SpecFlow.Tools.MsBuild.Generation NuGet package

Test Execution Method

Visual Studio Test Explorer

SpecFlow Section in app.config or content of specflow.json

N/A

Issue Description

When utilizing two dots ("..") in the test data of SpecFlow scenarios, the behavior becomes erratic, leading to unexpected outcomes. This issue was encountered specifically in the context of defining test scenarios for the "Retirement Age Calculation for Self-Employed Individuals" feature.

Example of behaviou: image image

Steps to Reproduce

Define a SpecFlow scenario outline with placeholders for calculation date, birth date, gender, and retirement age. Use two dots ("..") to represent dynamic values in the scenario outline examples. Execute the SpecFlow scenario.

` Feature: Retirement Age Calculation for Self-Employed Individuals

Scenario Outline: Determine retirement age based on birth date and calculation date Given the calculation date is "..calculate_date".. And the birth date is "..birth_date".. And the gender is "..gender".. When I calculate the retirement age Then the retirement age should be ..retirement_age..

Examples: | calculate_date | birth_date | gender | retirement_age |

| 1984-01-01             | Any          | Male   | 65             |
| "                      | "            | "      | "              |
| 1984-01-01..2009-01-01 | "            | "      | "              |

`

Link to Repro Project

No response

serge-rsvz-inasti commented 3 weeks ago

I see what I did wrong, I had replaced < and > by ".." at some point, breaking the test definition.

serge-rsvz-inasti commented 3 weeks ago

False positive