A console version of NCrunch is available for teams that need to make use of NCrunch features outside Visual Studio. For example, in order to use NCrunch on a team build server.
The tool is limited to a single end-to-end build and test run over a solution and does not include continuous behaviour. This makes it ideal for using NCrunch's parallel execution and distributed processing features as a part of any batch process.
The tool is available through a separate installer. This makes it possible to use it on a machine that does not have Visual Studio installed. Note that SDKs are often still required for the tool to be able to build your projects.
As with NCrunch's Visual Studio plugin, the console tool requires an NCrunch license in order to work. However, because NCrunch is licensed per user (not per machine), there is no need for already licensed users or teams to purchase an additional license in order to use it. As long as one member of a team is already a licensed NCrunch user, the team is free to install the NCrunch console tool on their build server using this team member's license code.
The console tool can work with both NCrunch Named User and Company Seat licenses. It can also be used with a 30-day evaluation license.
The goal of the licensing for this tool is simply to make sure that any team using the tool already holds NCrunch licenses. If no team member has an NCrunch license, a license must be purchased to use this tool (outside its 30-day evaluation).
Because many continuous integration servers do not run under the desktop user profile, the console tool will store its licensing information at machine level. This is different from the NCrunch Visual Studio plugin, where licenses are stored under the user profile. In order to use the tool, you must first specify your license with the following command:
Note that this can also be used to turn on the 30-day evaluation license.
You can also specify license details using the command line. For example:
ncrunch.exe /license "Joe Bloggs" "1234-1234-1234-1234-1234-1234-1234-1234-1234"
The console tool uses the NCrunch core engine in its entirety. This means it is capable of loading the projects inside a solution, parsing them, analysing them, creating workspaces, building, instrumenting output assemblies and executing tests. It is essentially a headless version of NCrunch. On completion of one full engine cycle, the console tool will write a series of reports to disk then self-terminate.
Useful features include:
Because the tool operates with the same constraints as the NCrunch VS plugin, it is also a useful on a CI server to ensure that team members not using NCrunch have not broken the build for team members that are using NCrunch.
The tool is controlled via command-line parameters. For a detailed list of available options, simply execute the tool with no parameters specified.
It's important to consider that any server using the tool must have installed any SDKs and components that would normally be required to build a solution and run its tests. The NCrunch console tool is subject to the same constraints as any team build server in terms of software requirements. You may or may not need to install Visual Studio or the Windows SDK depending upon the nature of your solution.
The tool will obtain its solution and project level configuration from the NCrunch configuration files inside the codebase. If you experience problems with the tool on a CI server not working the same as the VS plugin, ensure that you have these configuration files checked into your source control system.
For a full setup and usage guide, see the console tool usage guide.
After an execution run, the tool will write the following reports into the results output directory:
The exit codes returned by the console tool will vary depending upon the result of the execution run.
|3||General Failure (caused by internal failures and/or incorrect parameters)|
|5||Some tests were not run (Introduced in v2.24. For many people, tests not running on a build server is considered an error case)|