0

I know CC is counted at the code level to determine a set of basis paths (i.e. independent paths), the elements of which then can be combined to create any possible execution paths. In software testing, CC therefore determines the minimal number of test cases to exercise those paths and cover all edges and all nodes.

And now I wonder, does it make sense to look at an abstract flowchart of a software program and use CC to prepare high-level use/test cases?

E.g.

Money Inserted? Y ---> Show Screen X  
                N----> Show Screen Y-->RECEIPT REQUIRED? Y----> Show Screen A

So I would know I need at least 3 test cases (predicates +1).

But does it even make sense? To me, I believe it still can yield coverage of high level functionality (but of course cannot guarantee that the underlying code is exercised completely).

  • A flowchart would be the only diagram where this would make sense, but nobody really uses flowcharts anymore (they let the code speak for itself). – Robert Harvey Sep 27 '17 at 19:21
1

Yes I think it could be valuable. But maybe for a different reason than what you describe. I think computing CC of a design can help you compare it to a competing design in an objective way. A lower CC indicates a simpler and easier to test design. It is also a metric you can track over time to understand how the system is growing in complexity, and when it reaches a certain point the design may need to be refactored to be simpler and lower the CC.

Knowing that you need a certain number of test cases to cover a design isn't helpful when preparing those tests because you would really need a coverage analysis to understand if you've written the correct tests to cover the design. Just meeting the correct # of tests doesn't mean you've done your job correctly.

  • True, what I mean is that I can be at least sure that I have covered all decisions in the diagram with tests (e.g. no high level path is untested) and that from use case perspective, those "paths" are covered. – John V Sep 27 '17 at 19:07
  • I still don't understand how CC (a number) can make you sure that you've covered anything. – Samuel Sep 27 '17 at 19:10
  • The same way as with the source code. It tells you whether the number of test cases is sufficient and it is up to you to know that this relates to exercising decision outcomes. – John V Sep 28 '17 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.