This is a scaffolding project to get started with C#, XUnit & SnapTest generated code.
Clone this repository.
Install the snaptest-cli via npm install -g snaptest-cli
.
You will generate the tests via a snaptest CLI command. The easiest way get the command is via the chrome extension's "generate code" icon next to the folder/test you want.
Example CLI command: snaptest -r csharp -s xunit -t <your access token> -a <user/project/org> -d <me/userid/projectid>
For more in-depth options, check out the snaptest-cli readme.
-
If you're snaptest tests utilize environments, you'll need to set them up in this project. Test/Environment data is passed in to the tests using .NETs configuration builder via the SnapTest.cs "glue" file. It currently uses the "In-memory collections" config provider, but can pull data from many sources: Microsoft.Extensions.Configuration
-
To run the tests, you'll need a Selenium server running & Chromedriver.
This project is setup to test in Chrome, so you'll need chromedriver. We've included a standalone version of the selenium server in the /selenium folder which you can run via:
java -jar ./selenium/selenium-server-standalone-3.0.0-beta3.jar
It's recommended to get a grid server running, ideally via selenium docker.
This file is required for Snaptest tests to run. It provides:
- loading environment/test data configuration into the tests.
- extending the basic suite/test/action reporting.
- configuring of the target selenium server, concurrency, and browser type.
Run dotnet test
to run all your tests
dotnet test --logger=trx
This command will generate an XML report of the tests ran.