AllRounder.ai
Chapters in this course

Enrol to start learning

Reading is open to everyone. Enrolling is free, and it is what unlocks the audio lessons, practice tests and progress tracking.

Enrol free

25.13.1. Definition

Interactive Audio Lesson

Session 1: Introduction to Code Coverage

Unlock the classroom podcast

The transcript is free to read. A free account plays the conversation back.

Sarah
SarahInstructor

Today, we are going to learn about code coverage. Can anyone tell me what that means?

Noah
Noah

Is it how much of the code we actually test when we run our unit tests?

Sarah
SarahInstructor

Exactly! Code coverage measures the percentage of code that is executed when your tests run. Why do you think that's important?

Isabella
Isabella

It probably helps us find parts of the code that we haven't tested yet, right?

Sarah
SarahInstructor

Absolutely! It helps identify untested areas, which can contain potentially risky bugs. This is crucial in delivering reliable software.

Session 2: Tools for Measuring Code Coverage

Unlock the classroom podcast

The transcript is free to read. A free account plays the conversation back.

Robert
RobertInstructor

Now, let's talk about some tools. What tools do you think can measure code coverage?

Akash
Akash

I think I've heard of JaCoCo!

Ananya
Ananya

And Cobertura, right?

Robert
RobertInstructor

Exactly! JaCoCo and Cobertura are popular code coverage tools. They provide detailed insights into which parts of your code are not covered by tests.

Noah
Noah

Are there others?

Robert
RobertInstructor

Yes, SonarQube is another valuable option that not only analyzes code coverage but also provides a broader overview of code quality.

Session 3: Goals and Best Practices for Code Coverage

Unlock the classroom podcast

The transcript is free to read. A free account plays the conversation back.

Sarah
SarahInstructor

What do you think a good target for code coverage would be?

Isabella
Isabella

Maybe around 80%?

Sarah
SarahInstructor

That's a great target! Generally, aiming for about 70-80% coverage is sensible because targeting 100% can lead to diminishing returns, especially on certain code types.

Akash
Akash

Like error logging?

Sarah
SarahInstructor

Exactly! Not all code needs to be tested to that extent, as long as critical paths are well covered.