# Get use of test results

You can read the resulting tests, run them, and view coverage. The SARIF reports are also available.

## Read generated tests

You can find the resulting tests in the default `tests` directory unless you have
changed it manually.

Test names look like `test_%filename%.cpp`.

[[images/vscode/vscode-test-folder-file.PNG|Test folder]]

Tests are grouped into _regression_ or _error_ regions with the passing or failing tests correspondingly.

Regression region:

[[images/vscode/vscode-test-region-regression.PNG|Regression region]]

Error region:

[[images/vscode/vscode-test-region-error.PNG|Error region]]

Test structure follows the [Google Test format](http://google.github.io/googletest/).

According to settings, tests may have short or verbose descriptions:
* Verbose descriptions include parameter declarations, expected and actual values, and the function call (as in the 
  examples above).
* Short descriptions are concise checks suitable for utility functions with many branches to cover (see below).

[[images/vscode/vscode-concise-test.PNG|Concise test descriptions]]

## Run tests with coverage

To run _the given test_ right from the **Editor**, use the **Run Test With Coverage** CodeLens above it.

[[images/vscode/vscode-run-codelens.PNG|Run tests from Editor]]

To run _all the tests in the file_, use the **Run Tests With Coverage** CodeLens located above `namespace UTBot`.

[[images/vscode/vscode-run-all-codelens.PNG|Run all tests from Editor]]

You can also go to **View** > **Command Palette...** and enter _Run All Tests and Show Coverage_.

[[images/vscode/vscode-command-palette-run-all-tests.PNG|Run all tests from Command Palette]]

After the test run, the line coverage information appears in the Visual Studio Code gutter near the source code:
* green — covered
* yellow — partially covered
* red — uncovered

[[images/vscode/vscode-coverage.PNG|Coverage information]]

If the **Show Test Results** setting is activated, UnitTestBot C/C++ displays the test run results near the test 
headers. The green dots mark the passing tests, while the red triangles mark the failing tests.

[[images/vscode/vscode-coverage-show-results.PNG|Showing test results]]

## Get SARIF reports

You can find the SARIF reports in the `utbot_report` directory.

### SARIF

SARIF is the Static Analysis Results Interchange Format — a standard, JSON-based format for the output of static 
analysis tools. For more information, please refer to [SARIF Tutorials](https://github.com/microsoft/sarif-tutorials/blob/main/README.md).

To get the most out of the `.sarif` files right in Visual Studio Code, install the
[SARIF Viewer](https://marketplace.visualstudio.com/items?itemName=MS-SarifVSCode.sarif-viewer).

[[images/vscode/vscode-sarif.PNG|SARIF viewer]]

