My customer wanted an ability to run tests on NUnit GUI with multiple Test Environment setups.
We created a configuration class and store all the setup configurations in the app.config as following example:
<batches>
<batch1>
ConnectionString = "Con1", baseAddress="add1"
</batch1>
<batch2>
ConnectionString = "Con2", baseAddress="add2"
</batch2>
</batches>
We're expecting when the BA/tester selected a category to run (i.e batch1) it will loads the configuration in the app.config under batch1 node, parses it to the BeforeTestRun hook to initialize environment and then starts all the tests.
But the problem is NUnit GUI only regconize the Specflow @Tags in scenarios and translate it to NUnitCategoryAttribute. That's why we have to use a custom generator to insert batch1 and batch2 as NUnitCategoryAttribute into the feature.cs file whenever custom tool runs and regenerate feature.cs files.
Now I successfully created the plugin and insert the categories, I found out NUnit framework does not support me query the current running category in TestContext, if I don't know which category is running, I can't load correct configurations for my test setup class.
Further more, NUnit categories does not work as parameter targets for the test method.
That's why I said this is a no go and I have to looking for better solutions.