Unit Tests
  • 13 Jan 2023
  • 1 Minute to read
  • Dark
    Light
  • PDF

Unit Tests

  • Dark
    Light
  • PDF

Article summary

Unit tests are one of the earliest stages of automated testing that take place during a build and deployment pipeline and are typically run by a third-party tool or framework such as Visual Studio, NUnit, and others. In BuildMaster, unit tests are executed with specific operations in a deployment plan. The results are recorded and linked to the build in context.

Unit tests runs are organized into groups, a convenient mechanism to separate results of different test projects, consolidate common tests for historical comparison, or identify specific tests to use in a pipeline stage approval.

Running Unit Tests

Unit tests are run and recorded with specific operations depending on the unit test framework. The following test frameworks are supported by BuildMaster through the following extensions and operations:

FrameworkExtensionOperationGitHub
Visual Studio TestWindows SDK (formerly MSTest)Execute-VSTestsource
NUnitNUnitExecute-NUnitsource
JUnitJavaExecute-JUnitsource

For instructions on usage of a specific unit test operation, visit the auto-generated documentation in your BuildMaster instance or the associated extension's GitHub wiki.

Pipeline Stage Approval

To prevent a build with failed unit tests from being deployed to a pipeline stage, add a Unit Test automated approval to the target stage. This approval verifies that the tests recorded at the last execution in the previous pipeline stage either all passed or none failed, with inconclusive tests that depend on the approval configuration.

Viewing Test Results and History

All executed tests are recorded and displayed on the overview page of the associated build, organized by group. Logs and histories for specific tests are available on the Unit Test Details page.

Custom Unit Tests

Because operations are extensible, it is relatively easy to create custom operations for any unit test framework. For examples, see the source code for any of the Inedo supported extensions and the IUnitTestRecorder documentation of the Inedo.SDK.


Was this article helpful?

What's Next