Specflow – Api – How to not open a browser on api tests


I am probably overthinking this but I have not figured it out yet. Any help would be appreciated. My API tests are opening a browser on start.

I have an existing Specflow solution and I am adding restsharp to it. I created a folder called restsharp and started adding my api features and steps to it. Maybe this should have been a new project in the solution? I want to be able to run the ui tests and then do some api calls at the end for some tests but I will also have api only tests.

My BeforeScenario hook starts my browser so when I run an api test, it starts the browser automatically.

[BeforeScenario]
Browser.StartDriver();

--StartDriver pulls an env variable for which browser to start chrome, edge etc. with all the options to start with. 

How do I resolve this?



Source link

Leave a Comment