Hi team i wants to analyse my Selenium Java automation test scripts in sonarlint(eclipse) and sonarqube. These scripts use to reside in the path “src\test\java”(standard format which cannot be change). From the documentation i can see if java files have “test” keyword or folder in there path they are considered as Junit Test cases. In QEA domain these automation scripts with high code quality can play an important role for standardisation. I am using Maven build for the eclipse project. Please help to make analyse the project with standard java rules available in sonarlint for standard java files. The same project analysis i want to reflect in Sonarqube. Please help.!!
Reason for skipping rule on some file
Sonarlint and SonarQube rules to apply on Java Selenium Automation Test Scripts
That’s a topic that bubbles to the surface on a regular basis. This is the relevant ticket: MMF-1160. In the meantime, the workaround is to perform a second analysis with a different project key/name pair that explicitly configures
sonar.sources to point to your tests.
@ganncamp in administrator -> general settings -> Analysis Scope -> sonar.sources i added /Test.,/test/**/* but still only test rules/junit rules are getting applied over it. I am using maven project, and command “mvn clean verify sonar:sonar” to analyse my project. No specific property i mentioned/added in pom.xml. Only i edited the settings.xml file, located in $MAVEN_HOME/conf as mentioned in documentation. Any suggestion ??
My general advice is to set configs through the UI. However:
- values set at the global level are overridden by values set at the project level
- values set at the project level are overridden by values set in the analysis properties (in
- values set in the analysis properties are overridden by values set on the command line
So, you’ll need to pass your override on the analysis command line, e.g.
-Dsonar.sources=Test,test/**/*.java. Sorry I didn’t think to mention that detail earlier.