Hi,
What are people's thoughts on supporting the MsTest TestContext object in SpecFlow?
To get a TestContext for use in TestMethods, a class that is decorated with the TestClass attribute must have a public non-static TestContext property, such as follows:
public TestContext TestContext { get; set; }
The test runner calls the setter. Your own code in the TestMethods should only be using the getter. Also a TestContext is passed to the AssemblyInitialize and ClassInitialize methods.
The TestContext object isn't for sharing information across methods of the TestClass so it's not like SpecFlow's FeatureContext and ScenarioContext.
The TestContext's usefulness is very limited but it does provide potentially valuable information. For example, the TestContext has a DeploymentDirectory property. The directory location of the test could be discovered in other ways but it would be far more convenient to just have what the test runner and test framework provide.
When the test provider is MsTest, should the TestContext be exposed or its information be added to the FeatureContext?
Thanks