A sample implementation of BDD UI tests with C# / SpecFlow
The feature files, step definitions and page objects were written for https://github.com/andreasneuber/automatic-test-sample-site. Readme in that repo has further details how to set it up.
Microsoft Visual Studio Community 2022 (with .NET desktop development workload)
- git clone
- Double-click file
csharp-cucumber-selenium-framework.sln
- Solution opens in Visual Studio
- Go to "Extensions" > "Manage Extensions" and get "SpecFlow for Visual Studio 2022"
- Right-click on solution, build solution
- Go to "View" and open the "Test Explorer" window
- Click green "Run All Tests In View" button
Especially ChromeDriver needs frequent updating.
- Go to "Tools > NuGet Package Manager > Manage NuGet Packages for Solution..."
- Go to tab "Updates"
- Update
- Right-click on solution, build solution
- Close and reopen solution
Open file app.config
and find key "Browser". You can choose between:
- chrome
- chrome_headless
- firefox
- edge
- safari After changing the browser, rebuild the solution.
Step-by-step guide for LivingDoc Generator
To view the "SpecFlow LivingDocs" comfortably an extension is required.
Step SpecFlow+ build step.
in file azure-pipelines.yml
will generate and upload the report.
Report will appear under menu item "Overview > SpecFlow+ LivingDoc".
- Duplicate line:
CTRL + E + V
- Go to definition:
F12
- Quick code formatting:
Ctrl + K , Ctrl + D
See app.config > appSettings
See app.config > appSettings
Error "csharp-cucumber-selenium-framework\bin\Debug\chromedriver.exe". Access to the path 'csharp-cucumber-selenium-framework\bin\Debug\chromedriver.exe' is denied.
- Run
taskkill /f /im chromedriver.exe
- Clean solution