1

Is it possible to use jacoco in sonar without writing junit as I have added jacoco plugin in sonarqube but when I ran the sonar scanner then it is showing 0% code coverage. Please advise me on this as I am new to this work.

1
  • Nope, You cannot measure code coverage for tests, without executing the tests. Commented Jan 28, 2016 at 17:47

2 Answers 2

6

JaCoCo is a coverage tool that will record, during an execution of the Junit test where the execution went through your code.

So short answer is : no. This makes absolutely no sense.

(this is a bit simplified but given the question I am keeping things short here).

Sign up to request clarification or add additional context in comments.

Comments

1

you can use jacoco java agent, which has nothing to do with junit, and just run your code, then report the code coverage. See this doc for more details

https://www.jacoco.org/jacoco/trunk/doc/agent.html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.