-
Notifications
You must be signed in to change notification settings - Fork 46
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
The @ignore attribute is not inherited to the scenarios from rule #111
Comments
Let's confirm expected behavior:
|
@clrudolphi I think for other tags it works in general: this test verifies that for scenario outlines. So the only problem is with the For this we would need to extend the sample feature (with and ignored rule) and the assertion block here: https://github.com/reqnroll/Reqnroll/blob/main/Tests/Reqnroll.SystemTests/Generation/GenerationTestBase.cs#L129 |
@gasparnagy I could use some guidance. I have added a confirming test as you suggested. It currently fails (as expected). [Xunit.SkippableFactAttribute(DisplayName="Rule ignored scenario")]
[Xunit.TraitAttribute("FeatureTitle", "Sample Feature")]
[Xunit.TraitAttribute("Description", "Rule ignored scenario")]
public async System.Threading.Tasks.Task RuleIgnoredScenario()
{
string[] tagsOfScenario = ((string[])(null));
System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary();
global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Rule ignored scenario", null, tagsOfScenario, argumentsOfScenario, TagHelper.CombineTags(featureTags, new string[] {
"ignore"}));
#line 41
this.ScenarioInitialize(scenarioInfo);
#line hidden
if ((global::Reqnroll.TagHelper.ContainsIgnoreTag(tagsOfScenario) || global::Reqnroll.TagHelper.ContainsIgnoreTag(featureTags)))
{
testRunner.SkipScenario();
}
else
{
await this.ScenarioStartAsync();
#line 42
await testRunner.WhenAsync("the step passes", ((string)(null)), ((global::Reqnroll.Table)(null)), "When ");
#line hidden
}
await this.ScenarioCleanupAsync();
} The value of "ignore" is concatenated with the feature-tags and then stored in the CombinedTags field of the ScenarioInfo during the call to the constructor of the ScenarioInfo. But the check for whether to call testRunner.SkipScenario(), in the subsequent lines, for Ignore doesn't look at the tags on the SI, it only looks at the test method variable, tagsOfScenario, and the test Class field, featureTags. Should this if() statement be retrieving the scenarioInfo.CombinedTags Property and using that value in the call to TagHelper.ContainsIgnoreTag()? Secondly, the XUnit.SkippableFactAttribute does not include a Skip property like the other 'ignored' test in the feature-file: [Xunit.SkippableFactAttribute(DisplayName="Ignored scenario", Skip="Ignored")] Is the presence of that value required in order for the test to be ignored or does the method invocation of SkipScenario() cause the test to be ignored? |
@clrudolphi regarding my memories ignoring works in the following way: For scenarios the But you should move the Was it failing only for xUnit or also for the others? Is the generated code similar for the others too? |
@gasparnagy I now have something working. Pls review this and let me know your thoughts. I am somewhat cautious of unintended side effects.
The System test condition is added to the section that checks for Ignored tests: _vsTestExecutionDriver.LastTestExecutionResult.LeafTestResults
.Should().ContainSingle(tr => tr.TestName.StartsWith("Rule ignored"))
.Which.Outcome.Should().Be(expectedIgnoredOutcome); I've modified the code generator so that the dynamic check for ignore now looks like this: if ((global::Reqnroll.TagHelper.ContainsIgnoreTag(scenarioInfo.CombinedTags) || global::Reqnroll.TagHelper.ContainsIgnoreTag(featureTags)))
{
testRunner.SkipScenario();
} This passes with all three test frameworks. Edited to add link to a draft PR #113 |
@gasparnagy Answered as a review at the PR: I think this is good as it is. |
Fixed by #113 |
Reqnroll Version
1.0.1
Which test runner are you using?
xUnit
Test Runner Version Number
2.7.0
.NET Implementation
.NET 8.0
Test Execution Method
Visual Studio Test Explorer
Content of reqnroll.json configuration file
No response
Issue Description
In case the
@ignore
is placed on theRule
keyword it is not effective.Steps to Reproduce
Have a feature file like:
Run the tests: S1 is not ignored.
Adding the
@ignore
directly to the scenario works.Link to Repro Project
No response
The text was updated successfully, but these errors were encountered: