While analysing test files , junit pre-defined rules are not getting applied

28 Views Asked by At

While analysing test files using junit pre-defined rules. Except this rule “TestCases should contain tests” , none of the junit rule is getting applied to the Junit test files. Why?

command = ['java', 
          '-jar', 
          sonar_scanner_jar, 
          '-Dsonar.projectKey={}'.format(project_name), 
          '-Dsonar.host.url=http://localhost:9000',
          '-Dsonar.sources={}'.format(src_directory),
          '-Dsonar.tests={}'.format(test_directory),
          '-Dsonar.language=java', 
          '-Dsonar.sourceEncoding=UTF-8', 
          '-Dsonar.java.binaries={}'.format(binfile), 
          '-Dsonar.java.tests.binaries={}'.format(test_binfile),
          '-Dsonar.login=admin', 
          '-Dsonar.password=****', 
          '-Dsonar.inclusions={}'.format(','.join(srcfiles)),
          '-Dsonar.test.inclusions={}'.format(','.join(junitfiles)),
          '-Dsonar.projectBaseDir={}'.format(source_directory),
          '-Dsonar.java.libraries={}'.format(cur_dir+"/sonaranalysis/lib"),
          '-Dsonar.java.test.libraries={}'.format(cur_dir+"/sonaranalysis/test_lib")
          ]

This is the command that I’m using. Pre-defined rules are working perfectly for the source files but not for the junit files.

  • Sonarqube server version : 8.x
  • Sonar-scanner-cli : 4.8
  • Java version to run the server : 17
  • Java version to run the files : 8
0

There are 0 best solutions below