> ## Documentation Index
> Fetch the complete documentation index at: https://docs.incredibuild.com/llms.txt
> Use this file to discover all available pages before exploring further.

# IBTestConsole Command Interface (for NUnit, GTest)

The following chapter includes instructions on how to configure and run Incredibuild for Unit Tests to run in Assembly-level mode or Test-level mode with the NUnit framework. The setting that specifies the Assembly or Test level modes for NUnit is specified within the IBTestConsole command, as described below.

## Supported Frameworks:

IBTestConsole supports the following frameworks:

* NUnit 2

* NUnit 3

* Google Test (Gtest)

IBtestConsole will automatically detect the executed framework. However, if you want to force it to run a specific framework, you can use the /test=NUnit3 or /test=NUnit2 CLI command line options.

## Running the IBTestConsole

To configure and run the IBTestConsole, you should first run the **IBTestConsole.exe** file, located in the Incredibuild installation folder. This is a console application that initializes Incredibuild for Unit Tests in various modes of operation, according to its various parameters.

IBTestConsole uses the following syntax:

IBTestConsole \[command] \[options]

* Command- The original command of your Unit tests framework. The command may include specific flags (described below)

* Options – One of the options described in the section below.

### Supported Framework Command Flags

The following framework command flags are supported by Incredibuild for Unit Tests. Each framework version includes different flags as described below. To learn more about each flag, see the [Nunit 3 CLI reference](https://github.com/nunit/docs/wiki/Console-Command-Line) and [Nunit2 CLI reference](https://nunit.org/docs/2.6.2/consoleCommandLine.html).

#### *NUnit 2 Supported Flags*

* /run
* /runlist
* /include
* /exclude
* /result, /xml
* /noresult, /noxml
* /framework
* /timeout

#### *NUnit 3 Command Flags*

* @FILE
* `--testlist=FILE`
* `--where=EXPRESSION`
* `--config=NAME`
* `--framework=FRAMEWORK`
* `--timeout=MILLISECONDS`
* `--seed=SEED`
* `--skipnontestassemblies`
* `--result=SPEC`
* `--noresult`
* `--shadowcopy`
* `--noheader`, `--noh`
* `--params` | p=PARAMETER
* `--dispose-runners`

#### *GTest Command Flags*

* `--gtest`\_output
* `--gtest`\_filter

### IBTestConsole Options

The following options can be added at the end of the IBTestConsole command.

| Option               | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | Notes                                                                                                                                                                                                                                                                                                                         |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| /help                | Show this message on the screen                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |                                                                                                                                                                                                                                                                                                                               |
| /logfile=\<filename> | Specifies the log file name                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |                                                                                                                                                                                                                                                                                                                               |
| /loglevel=\<level>   | Sets logging level. Can be \[trace,debug,info,warning,error,fatal]                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |                                                                                                                                                                                                                                                                                                                               |
| /openmonitor         | Opens the Build Monitor when a test is run                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                                                                                                                                                                                                                                                               |
| /targetdir=\<path>   | Specifies the working directory on which the test framework operated.                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | This command should be used in case the IBTestConsole was not initiated from the same directory as the test assemblies.                                                                                                                                                                                                       |
| /testlevel=\<level>  | Specifies the test distribution level. Supported values=\[auto, assembly, deep, suite, \<number of cores to engage>]Assembly/test level – /testlevel=default will use assembly level distribution. Number of cores – The number of cores to be used in the test level distribution. Incredibuild will distribute all the tests evenly between the cores (e.g. if there are 1000 tests and N=200, each of the 200 cores will run 5 tests).Deep – Uses all the available cores in the pool, while striving to run each test in a different core. | The number of cores to be used may determine the efficiency of the parallelization. In general, you should set the /testlevel=N command option so that N should be around x2.5 of the number of cores that you have on your local machine. To learn more about test level optimization, see Advanced Test Level Optimization. |
| /test=\{framework}   | Forces IBTestConsole to handle the executed command as a specific framework.                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | By default, IBTestConsole will try to detect the target framework executed. Use this option to force IBTestConsole to handle the executed command as a specific framework. Supported frameworks:NUnit2NUnit3                                                                                                                  |

### Return Codes

IBTestConsole return the following return codes:

| Code | Description                                                                                                                                                                                                                                                                                                        |
| ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| 0    | Successfully exited. This means that no internal error occurred during any of the following stages:user cmdline was correctdiscovery stage finished fineall tests were successfully executedThe results were successfully merged (even with test failures)Console output was displayed to the user (if applicable) |
| 1    | Internal error during execution for any of stages described above                                                                                                                                                                                                                                                  |
| -1   | Unexpected internal error. in real shouldn't ever occur                                                                                                                                                                                                                                                            |
