Test coverage using Sonar

3

I would like to know if anyone else has already used Sonar to do test coverage analysis, I have the following problem, I have two projects.

Project A : This is implemented in my tests, using Selenium + Testng
Project B : It is a project where I want to evaluate the coverage of the tests. >

I would like to know if there is any way to set Sonar so that when running project A , the coverage analysis is done on project code B?

    
asked by anonymous 29.07.2014 / 19:59

2 answers

1

I did not do this, but according to Sonar documentation you can configure a multi-module project and include multiple projects through certain settings in the sonar-project.properties file.

For example, consider the following folder structure:

Configuration file:

# Root project information
sonar.projectKey=org.mycompany.myproject
sonar.projectName=My Project
sonar.projectVersion=1.0

# Some properties that will be inherited by the modules
sonar.sources=src

# List of the module identifiers
sonar.modules=module1,module2
    
29.07.2014 / 22:48
1

Look, we can not really measure test coverage when using Selenium because we can not clearly connect the source code to Selenium test scripts as it does with unit testing (which has the instrumentation of bytecodes to do this connection).

Coverage based on functional / acceptance automations refers to requirements / accepted, not code, which makes this coverage analysis impossible. Recommended reading: link

The closest thing to this, for example, is being able to track an accepted scenario / criterion and analyze the coverage on it. There is a tool that does this and has integration with Sonar called Thucydides

Take a look at this report . Here is an example of use .

    
06.08.2014 / 15:25