REST API Specialist in continuous integration Code alchemist Roch Delsalle Leader in performance and mobile affiliation in Europe, Latin America and the region of the Middle East.
of 5 lines covered : 80 % 1 out of 2 branches covered : 50 % ! if(cond) { line1 line2 line3 line4 } else { line5 } If your test only goes in the cond being true and never runs the else branch : You would have:
covered : 100 % Branches covered : 50 % def testMe(cond1:Boolean, cond2:Boolean) = { if (cond1) line1() if (cond2) line2() } If your test only goes in the cond1 being true and cond2 being true: You would have: In order to get 100% branches covered, you will have to add a test with cond1 and cond2 as false