|Number of votes:||5|
Integration testing a EPiServer Commerce site can be tricky. How would you know how to initialize everything in a way so that your tests behaves similar to how your site behaves?
In an attempt at answering this question for you I’ve created a sample project for integration testing EPiServer Commerce projects. It’s posted on github.com under the MIT-license and you can find it here:
This sample project doesn’t use selenium or any other web driver to test the UI but instead it aims to initialize an EPiServer Commerce site in a test context so that you can test your business logic below your UI layer.
The README for the project should help you get started but I still want to highlight the requirements. EPiServer Commerce requires the Full-Text Search feature to be enabled on your SQL server and you need a version that supports snapshots. The user running the tests also need access to the master database to be able to create databases. I’ve tried isolating most of the database specific code in the Database class so that if you want a different approach on how to reset state between tests you can replace that one class.