Calling SpecFlow steps from API controllers/services
Hi SpecFlow team and fans
In our team we have been using SpecFlow and its features for several projects with tens of thousands of SpecFlow E2E tests for web apps. It is an awesome library with a lot of useful features and extension points.
However we are now facing a new requirement where we are supposed to build an ASP.NET Core 3.1 API that will be able to call SpecFlow step methods from its controllers/services without the feature files involved. So based on the API request we receive we are supposed to invoke corresponding step methods in the Binding classes. In other word this might lead to simulating a run of a SpecFlow feature scenario where each step (or a bunch of steps sequentially) are run from a .NET Core service and not from the generated *.feature.cs file.
As far as I know our classes with step methods usually depend on the ScenarioContext which is marked as internal and can be neither inherited nor newed up. During my searching I got to the TestRunner class, its dependency ITestExecutionEnginer and its implementation TestExecutionEngine. This class has a ton of dependencies for which some of the corresponding implementations are also internal. Do I have to provide custom implementation for all of these? Or is there another entry point to use in my approach? Unfortunately this is blocking problem for me at the moment.
Would you have any recommendations on how to overcome this? Is this actually feasible with all the internals of the SpecFlow library?
Thank you very much for help.
Please sign in to leave a comment.