Hi @Vlkmr - welcome to the community!
The scanner uses a number of different criteria to decide whether a project is a test project or not. Unfortunately, they are not all documented in one place - the docs refer to some of them (see “Detection of Test Projects”), and others are described in the targets file.
Here’s what I think is a comprehensive list:
- the project file contains
<SonarQubeTestProject>false</SonarQubeTestProject>
or<SonarQubeTestProject>true</SonarQubeTestProject>
- the project file contains the MSTest ProjectTypeGuid:
3AC096D0-A1C2-E12C-1390-A8335801FDAB
- the project file contains the legacy
Service
GUID{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}
that added by the Test Explorer to mark a project as a containing tests - the project file contains the
ProjectCapability
TestContainer (for new SDK-style MSBuild projects) - the project file name matches the RegEx set in the property
sonar.msbuild.testProjectPattern
, which by default is.*Tests?\.(cs|vb)proj$
- a couple of special cases where the build process creates temporary projects (e.g. Microsoft Fakes, WPF). Note that the “real” MSBuild projects are still analyzed as non-test projects; only the temp projects are not analysed.
I’ve created a ticket to update the documentation: S4MSB #774
Also, ticket #770 is about improving the logging during build so it should be easy to tell from the build output why a project is being classified as a test project.