I'm getting integration and unit tests coverage with sonarqube (v4.4). But the most important information is which parts of the code aren't covered by any of tests at all. I can easily get this information for whole projects on widgets, but on file view there is no option for overall coverage. Is this possible at all?
I'm attaching a screen that possibly will explain my intentions better.
This has been added in 4.5, see https://jira.codehaus.org/browse/SONAR-5474
Related
I am working on a project in Xcode for iOS app and I enabled "Gather coverage data" in the "Edit scheme -> Test".
I also created a test target with an empty unit test, the only one in the whole project so far and now when I run the test I can see that around 12% of code has been covered (The project has around 500 files in the project and there are many classes in the coverage report that are displayed as covered).
How is this possible? Did I miss something?
In wiki there is "In computer science, code coverage is a measure used to describe the degree to which the source code of a program is tested by a particular test suite." We have only one test suite and it is empty.
As of Xcode 8, running the tests actually instantiates the app. That means that all the initialization code is executed. This will show as covered code in the test coverage report.
I'm configuring continuous integration with TFS 2012. I have one problem need solve.
I need to exclude some paths from triggering builds.
For e.g. I have:
$/Project1
$/Project2
And I want that after each check-in of $/Project1 - build has been triggered. And it must build both $/Project1 and $/Project2.
But after checking in $/Project2 I don't want to trigger a build for that Build Definition.
In Source Settings of Build Definition are only functions "Active" and "Cloaked", but it isn't what I need.
Thanks a lot in advance.
P.S. The worth solution is to add the comment ***NO_CI*** on check-in. It will be great if there is some other way.
Based on the comments, this boils down to an X-Y problem. You can't do what you want to do, but the reason you want to do it is because you're trying to solve the wrong problem.
You're running the UI tests at the wrong point in your dev-test cycle. UI tests should not run during a build, they should run after a release. A change to your test project should absolutely result in a build.
Someone is developing UI tests against code that's not yet in source control, which makes no sense. If someone is writing tests against code, the code should be source controlled.
I'm guessing that someone is manually pushing uncommitted code out to a dev server, which is being used by someone else to write tests. Don't do this. Use a real release management solution so that as developers write code, each check-in is automatically deployed to a dev/QA environment. Then the folks writing the UI tests will have something to test against. What's the point in writing tests against code that's in such a state of flux that the developer responsible for it isn't even sure it's worth being source controlled? That just results in spending a lot of time rewriting tests as the code evolves.
Assuming you set everything up properly, every commit of the application code will result in the current set of tests being run against the latest commit. Every commit of the test code will result in the new set of tests being run against the existing application code. The two things (application code and test code) should be coupled, and should always build together.
And one last thing, mostly opinion: UI tests are awful and serve very little utility. They are brittle, slow, and hard to maintain. I have never seen a comprehensive UI test suite actually provide value. UI tests are best served as a small set of post-release smoke tests. Business logic should be primarily unit tested, with a smaller suite of integration tests to back it up.
Is there any way I could JUST get the unit test code coverage results on SONAR. My project is to just focus on the code coverage and not on code issues/violations/rules etc.
It would be a big time saver for me. As the project that I am dealing with has million lines of code. I have all my jacoco.exec files generated and appended. Sonar analyses in and out of our code and which takes hours. code standards,rules,violations,issues for which my project is not concerned off.
Any help on this would be highly appreciative.
Regards
Eajaz
This is really an edge case for the use of SonarQube.
If you use an empty quality profile for analysis, you should not get any issue on your code, only metrics - including coverage, which seems your main concern.
I have an full fledged android application and its source code but there is no JUnit or any other automated test cases are available for the app. How can I do code coverage test for it?
Is Jacoco any plugin like Gradle can be helpful in this scenario?
Thanks in adavance.
Our Java Test Coverage Tool can collect code coverage statistics regardless of how the application is exercised. It is not dependent on any specific unit test framework (although it can work any, including none).
If you run it with tests, you get "code coverage from tests". If you simply exercise the application manually, you get "what code does this manual operation exercise?" If you do a thorough manual exercising of the code, you get the equivalent of "what code does all of my manual testing" exercise.
Reasking my older question:
Java test coverage: who covers what?
Background: I look at sonar's coverage report for a class and want to know, which test contributes to the coverage of a specific line / branch, so that it easy to got to that test and add the test for the newly introduced if-branch.
Are there other (preferably free) alternatives to clover in the IDE? Perhaps even such that they can be included into sonar ?
Or maybe tricks to enhance, accumulate information with some scripting in emma-reports ?
Or even further, patch emma or cobertura to log the required info (instead of logging a "1" for counting, one could well log the names of class under test and the test, I assume)
Thanks!
You should definitely give a try to JaCoCo. Its integration with Sonar allows to benefit from new features, for example :
merge coverage by unit and integration tests. See http://www.sonarsource.org/sonar-3-3-in-screenshots/
track the relations between tests and tested code (since sonar 3.5). You can find a screenshot on the documentation page: http://docs.codehaus.org/display/SONAR/Resource+Viewer#ResourceViewer-CoverageTab