3.3.3. Hands-on: Branch and condition coverage in IntelliJ

Course subject(s) Module 3. Structural Testing and Code Coverage

Showing branch and condition coverage in IntelliJ is a bit tricky.

  1. First, open the class test (tudelft.countletters.CountLettersTest.java)
  2. Then, “Run with Coverage”, the same way we did the previous time.
  3. We should now edit the Run/Debug configurations that were just created for this execution. You can do that by clicking on it in the right upper corner of IntelliJ. The configuration has the same name of the class. Click on Edit Configurations.
  4. Go to Code Coverage menu, and select Tracing. This is actually the configuration that makes IntelliJ collect data about the condition coverage.
  5. Click OK.
  6. Now, run this configuration with coverage again. There’s a button near the Run configuration (the third one should be the “Run with Coverage”.
  7. Now, you can go back to the class under test (tudelft.partition.example.countletters.CountLetters). Click on the yellow squares and understand how IntelliJ shows this information.
  8. See how the information is shown for the other yellow square we have there.
Creative Commons License
Automated Software Testing: Practical Skills for Java Developers by TU Delft OpenCourseWare is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Based on a work at https://online-learning.tudelft.nl/courses/automated-software-testing-practical-skills-for-java-developers/.
Back to top