1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-09-16 09:26:22 +02:00

docs: add unit test tags flag (#4947)

As we use tags for the unit test files, they don't run if one does not provide the tags=unit flag to the test execution command. This change adds the description of how one is to do this when running the tests in a shell, as well as how to add it to the VS Code extension.

Co-authored-by: tiloKo <70266685+tiloKo@users.noreply.github.com>
This commit is contained in:
Oliver Feldmann
2024-09-13 14:32:57 +02:00
committed by GitHub
parent dbeb46223e
commit 442d9ffe0c

View File

@@ -271,7 +271,7 @@ httpClient.SetOptions(clientOptions)
1. [Global function pointers](#global-function-pointers)
1. [Test Parallelization](#test-parallelization)
Unit tests are done using basic `golang` means.
Unit tests are done using basic `golang` means. As the test files are tagged add the corresponding tag to the run command, as for example `go test -run ^TestRunAbapAddonAssemblyKitCheck$ github.com/SAP/jenkins-library/cmd -tags=unit`. In VSCode this can be done by adding the flag `"-tags=unit"` to the list of `"go.testFlags"` in the `settings.json` of the go extension.
Additionally, we encourage you to use [github.com/stretchr/testify/assert](https://github.com/stretchr/testify/assert)
in order to have slimmer assertions if you like. A good pattern to follow is this: