V5 Documentation

NCrunch Runtime Framework

The NCrunch Framework assembly is a .DLL file shipped with NCrunch.

The NCrunch.Framework.dll file is loaded into the GAC when NCrunch is installed. It's recommended that you copy this file into your project and reference it from there. Doing so will prevent your build from breaking for anyone that isn't using NCrunch. Note that using NCrunch.Framework.dll is not required for running NCrunch - it is simply used for unlocking some of the more advanced features (such as parallel execution).

The normal location of this file within the GAC is windows\assembly\GAC_MSIL\NCrunch.Framework\VERSION. You may need to open this location using a command prompt to access the file (Windows explorer will present a 'friendly' view instead).

NCrunch.Framework can also be installed using Nuget. When loading NCrunch.Framework from Nuget, ensure you are using a version of NCrunch that is consistent with this binary.

When you have established a reference to the NCrunch.Framework assembly from your test project, you can take advantage of NCrunch's runtime features.

Attributes used by NCrunch from the NCrunch.Framework assembly are not statically referenced by the NCrunch engine. This means it is possible for you to construct your own attributes under the same name and namespace as the existing attributes, and NCrunch will consider them as though they were inside the NCrunch.Framework assembly. This is a useful way to introduce NCrunch to a solution without needing to include a reference to the NCrunch.Framework assembly.

Most of these attributes can also be applied at assembly level, in which case NCrunch will behave as though they are applied to all test fixtures within the assembly.

Framework Assembly Contents

AtomicAttribute Marks a test fixture as atomic. All child tests in an atomic fixture must be run in the same processing task and cannot be targeted for separate execution.
CategoryAttribute Used to help with categorising tests. As not all test frameworks support categorisation at both fixture and method level, this attribute can sometimes be useful as an alternative to framework-specific attributes.
CollectControlFlowAttribute Controls whether a test should have its control flow data collected and reported by RDI.
DistributeByCapabilitiesAttribute Creates several copies of a test internally, each with a different capability assigned to it. This can be used for multi-platform testing using distributed processing.
DuplicateByDimensionsAttribute Creates several copies of a test internally, each with a different dimension. Dimensions can be accessed at run time for different behaviour. This allows several variants of a test, fixture or entire suite to be easily created with a single attribute.
EnableRdiAttribute Enables or disables NCrunch RDI for a test, fixture or assembly.
ExclusivelyUsesAttribute Used to mark tests or fixtures that make exclusive use of a resource or set of resources (useful when making use of parallel execution).
InclusivelyUsesAttribute As above, though this will mark inclusive use rather than exclusive use.
IsolatedAttribute Used to mark tests or fixtures that need to be executed in a separate task runner process (i.e. if they are sequence or state dependent).
MethodDataLimitAttribute Controls RDI's method data limit for a test, fixture or assembly.
NCrunchEnvironment A static class that contains a series of methods to help a test get more information about its execution environment.
RequiresCapabilityAttribute This attribute is used to declare capabilities that are required to exist on a computer before it is allowed to run a test.
RestrictToStringAttribute Controls whether RDI should restrict its calls to ToString methods for a test, fixture or assembly.
SerialAttribute When adorned with this attribute, tests (or fixtures) will never be executed concurrently with other tests by NCrunch. This is equivalent to marking these tests with an ExclusivelyUsesAttribute that shares the same resource as an InclusivelyUsesAttribute applied to all other tests in the solution.
StringLengthLimitAttribute Controls RDI's string length limit for a test, fixture or assembly.
TimeoutAttribute Used to give tests or fixtures a non-default timeout value. This can be used for test frameworks that do not have such an attribute themselves (such as MSpec).
UsesThreadsAttribute Specifies how many cores/threads a test is expected to use. This is used by the engine to avoid overloading systems with multithreaded tests.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download