Skip to content

Conversation

bbaumann
Copy link

@bbaumann bbaumann commented Oct 3, 2014

Hi!

I've extended the @browser tag principle to match any @key:value tags. I needed it for a multi-language site (needed to test all the sites but the language did not impact the test logic).
I've let the IoC for the browser tag but any other @key:value tag is stored in the scenario Context as is.

Updated test cases are provided with the update.

We use it since July and everything's fine in our company. If you think that it could be useful to other people, feel free to merge it.

Regards,
Benjamin

When you annotate a scenario with @key:value, the value is stored in the
ScenarioContext as is, no IoC. No more combinatory explosion with
language or other settings that don't  impact your test logic.
@romerod
Copy link
Member

romerod commented May 1, 2015

Is it that generic, what about the InitializeSeleneniumAndLanguage method?

@bbaumann
Copy link
Author

bbaumann commented May 6, 2015

The InitializeSeleneniumAndLanguage method is in the CalculatorFeature.feature.cs file which is generated by the plugin. The name of the method depends on the key part of the @key:value syntax. The code generating these method can be found in SeleniumNUnitTestGeneratorProvider.cs line 117 :

string methodName = "InitializeSelenium"+String.Join("",orderedTags);
string initializeSeleniumArgs = String.Join(",",orderedTags).ToLowerInvariant();
//Create the call to the initialization Method
testMethod.Statements.Insert(0, new CodeSnippetStatement(methodName+"(" + initializeSeleniumArgs + ");"));

So yes it is generic ^^ If you prefer I may adapt my test case so that it uses an abstract concept for the @key:value instead of @language:FR one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants