V3 Documentation
Search

Capabilities

Capabilities serve to allow you to specify restrictions on which grid nodes can be used for executing specific tests or builds. This concept applies only when using NCrunch's distributed processing and has no relevance when using only the local machine to run tests.

A common problem when setting up distributed processing for a complex solution is that some of the solution's projects or tests may have very specific infrastructure needs. For example, a solution may contain a Windows Store project (which can only be built using Windows 8.1 or above), or contain tests that make use of a local database not configurable on all nodes within the grid. Capabilities allow you to inform NCrunch on what individual grid nodes are capable of so that the engine will not attempt to use them for tasks they would fail to correctly process.

Capabilities are essentially nothing more than simple strings that are cross-checked between tasks and grid nodes. This means you can name them however you like, as long as this naming is consistent across the grid.

Using capabilities, it's possible to configure NCrunch to avoid building certain projects or running certain tests on the client machine hosting Visual Studio. This can be very useful for allowing developers to do work on projects that require specialised SDKs or infrastructure in order to be built, as this work can be delegated to grid nodes that are able to handle it.

Using DistributeByCapabilitiesAttribute, it is possible to use capabilities to duplicate the execution of tests across different machines in the grid, enabling fast and simple multi-platform testing of applications.

Node/Client Configuration

The capabilities of a grid node can be specified in a global context using the capabilities of this computer configuration setting, accessible in the grid node configuration tool. By default, a machine will not have any capabilities specified.

Because the grid client (Visual Studio) is also a task processor, it can have capabilities specified using the same global setting, which can be found inside the NCrunch Configuration Window inside Visual Studio.

Project Required Capabilities

When capabilities are assigned to a project, any machine not configured with the same capability will not attempt to build the project. You can assign capabilities to projects using the Required Capabilities configuration setting.

Test Required Capabilities

When capabilities are assigned to tests, any machine not configured with the same capability will not attempt to execute the test. These capabilities can be assigned at test, fixture, or assembly level using the RequiresCapabilityAttribute.