how to run "only" single test in specflow while running it normally (ignore all tests except one)

Viewed 47

is there "only" (like in mocha) in specflow to run only this tests and ignore all the others?

I have thousands of tests so don't want to ignore 1 by 1.

I know that I can run only 1 manually, but I mean while running all the tests, to use some API like "only" to run only single test

1 Answers

You could implement BeforeScenario hook where you could fail tests other than the selected. The selected test could be marked with a tag e.g. 'OnlyThis' -> the logic of failing other test cases would be to verify if they are marked with the required tag.

I believe, there is no build-in option in SpecFlow.

It also depends on the test runner you use. You could filter tests e.g. using the test name.

Related