- Overview
- Guides
- Concepts
- Considerations And Constraints
- Absolute File References
- Assembly Colocation Assumptions
- Concurrent Use Of Test Resources
- Cross Application Domain Testing
- Heavily Executed Code Under Test
- Implicit File Dependencies
- Multi Threaded Tests
- Netstandard Test Projects
- Project Atomicity
- Project Build Platform And Configuration
- Rdi Data Point Location
- Test Atomicity
- Unique Test Names
- Using NCrunch With Source Control
- Reference
- Global Configuration
- Overview
- Auto Adjust Clashing Marker Colours
- Build Log Verbosity
- Build Process Memory Limit
- Capabilities Of This Computer
- Coverage Marker Style
- Cpu Cores Assigned To NCrunch Or Ide
- Custom Environment Variables
- Disable Global Hotkey
- Engine Hosting Strategy
- Fast Lane Threads
- Fast Lane Threshold
- Grid Maximum Reconnection Attempts
- Grid Reconnection Delay
- Impact Detection Mode
- Listening Port
- Log To Output Window
- Logging Verbosity
- Marker Colours
- Max Failing Test Trace Log Size
- Max Number Of Processing Threads
- Max Passing Test Trace Log Size
- Max Test Runners To Pool
- NCrunch Tool Window Colors
- Node Id (Name)
- Password
- Performance Aggregation Type
- Performance Display Sensitivity
- Pipeline Optimisation Priority
- Rdi Storage Settings
- Sliding Build Delay
- Snapshot Storage Directory
- Solution Storage Data Limit
- Spinner Colours
- Terminate Test Runners On Complete
- Test Process Memory Limit
- Tests To Execute On This Machine
- Text Output Font
- Workspace Base Path
- Solution Configuration
- Overview
- Additional Files For Grid Processing
- Additional Files To Include
- Allow Parallel Test Execution
- Allow Tests In Parallel With Themselves
- Infer Project References Using Assembly
- Instrumentation Mode
- NCrunch Cache Storage Path
- Only Consider Tests Outofdate If Impacted
- Project Config File Storage Path
- Show Coverage For Tests
- Show Metrics For Tests
- Tests To Execute Automatically
- Project Configuration
- Overview
- Additional Files To Include
- Allow Dynamic Code Contract Checks
- Allow Static Code Contract Checks
- Analyse Line Execution Times
- Autodetect Nuget Build Dependencies
- Build Priority
- Build Process Cpu Architecture
- Build Sdk
- Collect Control Flow During Execution
- Consider Inconclusive Tests As Passing
- Copied Project Dependencies
- Copy Referenced Assemblies To Workspace
- Custom Build Properties
- Data Storage File Size
- Default Test Timeout
- Detect Stack Overflow
- Enable Rdi
- Files Excluded From Auto Build
- Framework Utilisation Types
- Ignore This Component Completely
- Implicit Project Dependencies
- Include Static References In Workspace
- Instrument Output Assembly
- Method Data Limit
- Ms Test Thread Apartment State
- Preload Assembly References
- Prevent Signing Of Assembly
- Proxy Process File Path
- Rdi Cache Size
- Required Capabilities
- Restrict Tostring Usage
- Run Pre Or Post Build Events
- String Length Limit
- Track File Dependencies
- Use Build Configuration
- Use Build Platform
- Use Cpu Architecture
- Runtime Framework
- Overview
- Atomic Attribute
- Category Attribute
- Collect Control Flow Attribute
- Distribute By Capabilities
- Duplicate By Dimensions
- Enable Rdi Attribute
- Environment Class
- Exclusively Uses Attribute
- Inclusively Uses Attribute
- Isolated Attribute
- Method Data Limit Attribute
- Requires Capability Attribute
- Restrict Tostring Attribute
- Serial Attribute
- String Length Limit Attribute
- Timeout Attribute
- Uses Threads Attribute
- Global Configuration
- Troubleshooting
- Tools
- Keyboard Shortcuts
- Manual Installation Instructions
NCrunch.Framework.NCrunchEnvironment class
NCrunch.Framework ClassWhen you are making use of the NCrunch.Framework assembly, you are able to make use of NCrunch's runtime features. All runtime features are currently attached to the NCrunch.Framework.NCrunchEnvironment class.
The NCrunchEnvironment class contains methods that allow you to query additional information about the context in which NCrunch is executing your tests. The following methods exist:
NCrunchIsResident()
public static bool NCrunchIsResident()
This method will return true if NCrunch is responsible for the execution of your test, or false if your test is being executed by another test runner. You can use this method to implement alternative logic in your test that may be suitable only for a continuous test runner.
Data supplied by this method is sourced from the NCrunch environment variable.
GetOriginalSolutionPath()
public static string GetOriginalSolutionPath()
This method will return the full file path of the .sln file for the solution currently open in your IDE. Note that this is the solution you are currently working with in the IDE, not a virtual solution created within an NCrunch workspace. This method is extremely useful for situations where you need to reference files on a relative path from the solution file where those files have not been included in the NCrunch workspace.
Data supplied by this method is sourced from the NCrunch.OriginalSolutionPath environment variable.
When executing on a grid node, this method will return the path of the solution file as it would exist within the stored solution snapshot on the node.
GetOriginalProjectPath()
public static string GetOriginalProjectPath()
This method will return the full file path of the .proj file for the applicable project currently open in your IDE. As with the GetOriginalSolutionPath() method, the path returned is that of the original project file as it is open within Visual Studio, not any temporary project files artificially constructed in NCrunch workspaces.
Data supplied by this method is sourced from the NCrunch.OriginalProjectPath environment variable.
When executing on a grid node, this method will return the path of the project file as it would exist within the stored solution snapshot on the node.
GetImplicitlyReferencedAssemblyLocations()
public static string[] GetImplicitlyReferencedAssemblyLocations()
This method returns an array of the full file paths of each of the assemblies implicitly referenced in the current domain through the use of the implicit project dependencies configuration setting.
Data supplied by this method is sourced from the NCrunch.ImplicitlyReferencedAssemblyLocations environment variable.
GetAllAssemblyLocations()
public static string[] GetAllAssemblyLocations()
This method returns an array of the full file paths of every assembly expected to be used in the current domain, including implicitly referenced assemblies using the implicit project dependencies configuration setting. Because this method returns assemblies that may not have yet been loaded into the current application domain, it can be a much more useful alternative to AppDomain.CurrentDomain.GetAssemblies().
Data supplied by this method is sourced from the NCrunch.AllAssemblyLocations environment variable.
IsHighPriorityTask()
public static bool IsHighPriorityTask()
Introduced in NCrunch v4.4.
This method returns 'True' when NCrunch is executing the current test with high priority. This can be used to implement conditional behaviour for tests that are being manually targeted in the NCrunch UI.
Data supplied by this method is sourced from the NCrunch.IsHighPriority environment variable.
GetDuplicatedDimension()
public static string GetDuplicatedDimension()
Introduced in NCrunch v4.4.
This method returns the dimension of the test being executed, as controlled by DuplicateByDimensionsAttribute.
Data supplied by this method is sourced from the NCrunch.DuplicatedDimension environment variable.