Documentation

Documentation
V4 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

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.
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).
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.
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.
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).
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download