Skip to content

Commit

Permalink
docs: add unit test tags flag (#4947)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
o-liver and tiloKo authored Sep 13, 2024
1 parent dbeb462 commit 442d9ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion documentation/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 442d9ff

Please sign in to comment.