SpecFlow icon indicating copy to clipboard operation
SpecFlow copied to clipboard

Extract Scenarios from dll

Open javed0211 opened this issue 2 years ago • 6 comments

Link to Feature Request

No response

Implementation Idea

Hi Team,

Our company heavily utilizes SpecFlow for testing across various projects. We are currently in the process of developing an end-to-end solution, but our test cases are scattered across multiple repositories. We do not want to go through the process of rewriting them again. We were wondering if there is a way to extract the scenarios from the feature.cs file or dll and use them to build an end-to-end flow.

We have attempted to extract the test steps, but we have not been able to extract the scenarios as a whole. Are there any solutions or methods that can assist us in achieving this goal?

Thanks, Javed Khan

javed0211 avatar Jan 16 '23 13:01 javed0211

We include the feature files as resources in the compiled assembly. Does this help you?

SabotageAndi avatar Jan 16 '23 15:01 SabotageAndi

It might not help us, I guess. How do I choose test cases / scenarios if I add feature files in compiled assembly?

javed0211 avatar Jan 16 '23 15:01 javed0211

Ok, then I missunderstood your use case. At which point do you want to have the scenario text? Depending on that, perhaps there is a way to find it.

SabotageAndi avatar Jan 17 '23 12:01 SabotageAndi

My goal is to use Hangfire to schedule test cases, but I am facing some challenges. I am trying to extract the test cases from various projects' dll or feature.cs files and build a single job for end-to-end testing. While I have been successful in extracting the test methods from the dll files, I am unable to execute them. Additionally, this approach causes issues with 'specflow' hooks not being executed. Furthermore, I attempted to extract methods from feature.cs for each scenario, but this caused the test context to be null. If my explanation is unclear, please let me know and I will provide more information.

javed0211 avatar Jan 17 '23 13:01 javed0211

So you want to create your own test runner. If so, bad luck. SpecFlow is written to be used with NUnit, xUnit or MSTest. It is highly integrated with them. One thing are the hooks.

SabotageAndi avatar Jan 17 '23 15:01 SabotageAndi

No, I dont want to create my test runner. I am using specflow.MsTest in all my projects. I just want to create a bridge between test cases to build end to end test suite.

javed0211 avatar Jan 17 '23 15:01 javed0211