Skip to content
This repository was archived by the owner on Dec 8, 2022. It is now read-only.

Commit a62a01f

Browse files
committed
NULL reference issue fix of @tag:Param #13
1 parent cc2a067 commit a62a01f

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

Unickq.SpecFlow.Selenium.Allure.Example/Features/F2.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ as
1818
#@Browser:BrowserStack_Win10_Chrome
1919
#@Browser:ChromeDebugs
2020
@Browser:ChromeDebug
21+
@Browsers:A
2122
Scenario Outline: Check website title
2223
Given I have opened https://translate.google.com/
2324
Then the title should contain '<string>'

Unickq.SpecFlow.Selenium.Allure.Example/Features/F21.feature.cs

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Unickq.SpecFlow.Selenium.Plugin/UnickqSpecFlowSeleniumGeneratorProvider.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public UnickqSpecFlowSeleniumGeneratorProvider(CodeDomHelper codeDomHelper)
4545
_codeDomHelper = codeDomHelper;
4646
}
4747

48+
4849
public void SetTestMethodCategories(TestClassGenerationContext generationContext,
4950
CodeMemberMethod testMethod, IEnumerable<string> scenarioCategories)
5051
{
@@ -56,7 +57,6 @@ public void SetTestMethodCategories(TestClassGenerationContext generationContext
5657

5758
var hasTags = false;
5859

59-
6060
foreach (var tag in categories.Where(cat => cat.Contains(":")).Select(cat => cat.Split(':')))
6161
{
6262
if (tag.Length != 2)
@@ -120,12 +120,17 @@ public void SetTestMethodCategories(TestClassGenerationContext generationContext
120120
i = i + 1;
121121
}
122122

123+
//ToDo: Fix for 2.4 @Tag:Param
123124
foreach (var field in _fieldsToGenerate)
124125
if (!field.Equals("Browser", StringComparison.OrdinalIgnoreCase))
125126
{
126-
testMethod.Statements.Insert(4,
127+
128+
testMethod.Statements.Insert(0,
127129
GenerateCodeSnippetStatement(
128-
$"testRunner.ScenarioContext.Add(\"{field}\", {field.ToLower()});"));
130+
$"//@{field} is not supported since 2.4 https://github.com/unickq/SpecFlow.Selenium.Plugin/issues/13"));
131+
// testMethod.Statements.Insert(0,
132+
// GenerateCodeSnippetStatement(
133+
// $"testRunner.ScenarioContext.Add(\"{field}\", {field.ToLower()});"));
129134
}
130135
}
131136
}

0 commit comments

Comments
 (0)