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

Fix for #271 Fix External Data Plugin support of Rule Background Steps #272

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# [vNext]

* Fix: Rule Backgounds cause External Data Plugin to fail (#271) @clrudolphi
## Bug fixes:
* Modified VersionInfo class to force it to pull version information from the Reqnroll assembly
* Fix: Reqnroll.CustomPlugin NuGet package has a version mismatch for the System.CodeDom dependency (#244)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Feature: ExternalDataWithRuleBackgroundFromCSV

This feature demonstrates that Rule Background steps are handled appropriately when using the External Data Plugin.
This test validates a regression.

Rule: Steps in Background are properly executed
Background:
Given my favorite color is blue
@DataSource:products.csv
Scenario: The basket price is calculated correctly
The scenario will be treated as a scenario outline with the examples from the CSV file.
The CSV file contains multile fields, including product and price.
Given the price of <product> is €<price>
And the customer has put 1 pcs of <product> to the basket
When the basket price is calculated
Then the basket price should be €<price>
And the color given as my favorite was blue
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using NUnit.Framework;
using Reqnroll;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace XReqnroll.ExternalData.ReqnrollPlugin.IntegrationTest.StepDefinitions
{
[Binding]
internal class BackgroundStepsDefinitions
{
[Given("my favorite color is {word}")]
public void GivenMyFavoriteColorIs(string color)
{
_color = color;
}

private string _color;

[Then("the color given as my favorite was {word}")]
public void ThenTheColorGivenAsMyFavoriteWas(string color)
{
Assert.That(_color, Is.EqualTo(color));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ protected virtual void AcceptRule(Rule rule)
OnRuleVisiting(rule);
foreach (var ruleChild in rule.Children)
{
if (ruleChild is ScenarioOutline scenarioOutline) AcceptScenarioOutline(scenarioOutline);
if (ruleChild is Background background) AcceptBackground(background);
else if (ruleChild is ScenarioOutline scenarioOutline) AcceptScenarioOutline(scenarioOutline);
else if (ruleChild is Scenario scenario) AcceptScenario(scenario);
}
OnRuleVisited(rule);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private void OnScenarioVisitedInternal(Scenario scenario, Scenario transformedSc

protected override void OnBackgroundVisited(Background background)
{
_featureChildren.Add(background);
_currentChildren.Add(background);
}

protected override void OnRuleVisiting(Rule rule)
Expand Down