Best practices for testing

RECOMMENDATION: We recommend a development process that includes all major types of testing – unit, integration, UI automation, performance, and security. 

Following is a list of all major types of testing and the recommended best practices in the context of add-on development:

Unit testing

We recommend using a powerful mocking framework when testing custom code that has Sitefinity CMS dependencies. JustMock provides for unrestricted mocking of dependent objects, including non-virtual methods, sealed classes, static methods and classes, as well as non-public members and types.

Integration testing

When developing for Sitefinity CMS, you need to cover your custom code with integration tests that use the Sitefinity CMS context in order to test your custom logic in a real environment.
Two alternatives for integration testing are currently available:

Going forward, we recommend using MSTest V2 test framework although Sitefinity CMS web test runner tool will continue to work.

UI automation testing

When testing the developed add-on, we recommend using a setup with an empty Sitefinity CMS application with the add-on installed on it. This environment can be used for the execution of GUI automation tests that verify that the add-on works as expected from an end-user perspective. We recommend ensuring that the test cases cover all steps of the installation, import of content, and use of the given add-on.

Security testing

In addition to the Basic Security Practices for Web Applications, we recommend using static application security testing (SAST) and dynamic application security testing (DAST) tools.

This section contains

Implement unit tests
Learn about unit tests and approaches to follow in order to implement good unit tests in Sitefinity CMS.
Create integration tests with MSTest V2 framework
This section contains information about creating integration tests project with NuGet and creating integration tests for Sitefinity CMS using MSTest V2 framework.
Create integration tests with Sitefinity CMS web test runner
This tutorial explains how to create a project that contains integration tests and how to run the tests via Sitefinity CMS web test runner.
Want to learn more?
Enhance your Sitefinity skills by enrolling in free training sessions. Become Sitefinity certified through Progress Education Community to strengthen your professional credentials.