The SonarQube documentation says very little about the the sonar.tests parameter, only that it is a “comma-separated paths to directories containing test source files”. I’d like to know how it actually impacts the analysis, in what aspects the specified directory are treated differently by the engine. (e.g. are they automatically excluded from code coverage calculations ? do they get different quality rules checked, etc.)
Yes, and to some degree yes (altho that may change in the future). Additionally, I believe tests are excluded from Lines of Code and Duplications calculations. And finally, you get a different icon in the UI when we know it’s a test file.
The parameter does not only work with Maven, but it must be specified manually if you’re not using one of the build systems (e.g. Maven) for which it’s automatically populated.