Unit Tests
  • 22 Apr 2021
  • 1 Minute to read
  • Dark
  • PDF

Unit Tests

  • Dark
  • PDF

Unit tests are one of the earliest stages of automated testing that occurs during a build and deployment pipeline and are typically executed by a third-party tool or framework such as Visual Studio, NUnit, and others. In BuildMaster, unit tests are run using special operations in a deployment plan, and the results are recorded and associated with 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 using specific operations depending on the unit test framework. The following test frameworks are supported by BuildMaster through the following extensions and operations:

Framework Extension Operation GitHub
Visual Studio Test Windows SDK (formerly MSTest) Execute-VSTest source
NUnit NUnit Execute-NUnit source
JUnit Java Execute-JUnit source

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 any failing unit tests from being deployed to a pipeline stage, add a "Unit Test" automated approval to the target stage. This approval will validate that tests recorded in the latest execution to the previous pipeline stage either all passed or none failed, where inconclusive tests are dependent upon the approval's configuration.

Viewing Test Results and History

Any executed tests are recorded and displayed on the overview page of their associated build, organized by group. Logs and history 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