From 046c56b903b84f476af87dd22ce826b4d9fa7346 Mon Sep 17 00:00:00 2001 From: Oliver Feldmann Date: Tue, 4 Jun 2024 12:23:09 +0200 Subject: [PATCH] docs: add unit test tags flag 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. --- DEVELOPMENT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 8ef0ed8a79..634f2ccb67 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -258,7 +258,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: