We are trying to add two properties in the sonar-project.properties file namely, sonar.coverage.exclusions and sonar.cpd.exclusions. When trying to exclude the test directory, the sonarcloud analysis log considers the path given for sonar.coverage.exclusions but ignores the path for sonar.cpd.exclusions. Here is a screenshot of the analysis log and sonar-project.properties file,
Test files are automatically excluded from coverage and duplications calculations. Rather than trying to get them excluded, the focus should be on getting them properly identified as test files. For that, you should start by narrowing your sonar.sources definition (if possible) to your source directories and files so that not everything is identified as a source file. Doing so will remove your test files from consideration by analysis. You may then choose to go further and identify your test files to analysis using the sonar.tests property.