Hi Rohan, here you can find some details how JaCoCo calculates complexity figures:
https://www.jacoco.org/jacoco/trunk/doc/counters.html This also includes a definition how we calculate covered/missed complexity based on covered branches. We use coverage status of branches because this is what we can measure (JaCoCo hat noch mechanism to record path coverage). Also cyclomatic complexity is is an upper bound for the number of required test cases. In your case is is actually possible to get full branch coverage with 2 test cases. See https://en.wikipedia.org/wiki/Cyclomatic_complexity#Implications_for_software_testing <https://en.wikipedia.org/wiki/Cyclomatic_complexity#Implications_for_software_testing> Regards, -marc > On 1. May 2018, at 09:28, Rohan Garg <[email protected]> wrote: > > I have the following code : > > > package my; > > import java.util.Scanner; > > public class greatest { > > public static void findGreat(int a,int b,int c) > { > if(a>c) > System.out.println(a+" is greatest"); > else > System.out.println(c+" is greatest"); > if(b>c) > System.out.println(b+" is greatest"); > else > System.out.println(c+ " is greatest"); > > } > > public static void main(String[] args) { > // TODO Auto-generated method stub > > Scanner my = new Scanner(System.in); > > > int a = Integer.parseInt(args[0]); > int b = Integer.parseInt(args[1]); > int c = Integer.parseInt(args[2]); > > findGreat(a,b,c); > > > } > > } > > > The McCabe complexity for this is 3, which is correctly reported by the tool. > However running JaCoCo for just two of the following arguments: > > my.greatest 4 2 3 (TF) > my.greatest 1 3 2 (FT) > > gives missed complexity as 0. > > Should it not report 1 as missed complexity as it still missed one of the > Linearly Independent Paths? > > Thanks and regards, > Rohan > > > -- > You received this message because you are subscribed to the Google Groups > "JaCoCo and EclEmma Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jacoco/9c588e6f-6ec8-4a6a-9071-d324ad1319ad%40googlegroups.com > > <https://groups.google.com/d/msgid/jacoco/9c588e6f-6ec8-4a6a-9071-d324ad1319ad%40googlegroups.com?utm_medium=email&utm_source=footer>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/C3E14C0B-DDF2-474A-847D-F067662BEFA5%40mountainminds.com. For more options, visit https://groups.google.com/d/optout.
