Writing test cases is hard work
The telephone app has a telephone, service, telephone
/* Phone( choice1 ), Service( choice2 ), Phone( choice3 ) randomly pick choice1, choice2, choice3 You measure the length of the list number of tests = aLegPhoneA.length * bLegPhoneA.length * aService.length this gets big. */ // lists of test cases aLegPhoneA = "pA1,pA2,pA3,pA4,pA5".split(",") bLegPhoneA = "pB1,pB2,pB3".split(",") cService = "pSv1,pSv2,pSv3,pSv4,pSv5,pSv6".split(",") tests =[] testHash =[] //generate a small proportion for ( i = 0 ; i < 50 ; i ++ ){ // generate random integers over a range bigger than var ra = Math.random()*100&-1 var rb = Math.random()*100&-1 var rc = Math.random()*100&-1 // use the random number to pick a test case phA = aLegPhoneA[ ra % aLegPhoneA.length ] phB = bLegPhoneA[ rb % bLegPhoneA.length ] cS = cService[ rc % cService.length ] // randomly pick a test case that do not go end to end tests[ tests.length ] = cS+"."+phA // randomly pick a test case tests[ tests.length ] = cS+"."+phA+"."+phB // testHash[ cS+"."+phA ] = cS+"."+phA testHash[ cS+"."+phA+"."+phB ] = cS+"."+phA+"."+phB } /* Try and see if the test case has been picked before If you get duplications, you must be getting enough coverage. sort list and when you get a large number of duplications, You have enough. */