During initial configuration, I’ve mistakenly added this pattern **/*_test.go to Global Source File Exclusions list which caused a “Coverage on New Code 0.0%” problem in code analysis. After excluding this pattern from the list and rerunning the scan, it seems that Sonar is not looking for test files anyways.
This causes some problems as it seems impossible to retrospectively confirm that tests actually exist for the code. Moreover, inspecting the “Code” tab for the project, the test files are missing:
You don’t need a reset; the analysis parameters are read and applied fresh at each analysis.
What you need to do is specify the locations of your test files. Yes, you’ve set an inclusion, but on its own it won’t do anything, because an inclusion say “of all the files defined, only use these”.
Try this instead:
Global Source File Exclusions:
**/testdata/**
sonar.sources=[comma-delimited list of source file directories] sonar.tests=[comma-delimited list of test file directories - NO WILDCARDS]