Section outline

  • Discussion Topics:

    • How does cyclomatic complexity guide the design of test cases?
    • Compare statement coverage, branch coverage, and condition coverage in terms of effectiveness.
    • Discuss the trade-offs between achieving full coverage and testing efficiency.
    • How can coverage metrics be used to assess testing thoroughness?

    Lesson Summary: Students explore cyclomatic complexity, statement coverage, branch coverage, and condition coverage. Practical work involves C compilers, with assessments through lab performance, viva, and lab final, targeting CLO1 (understanding testing techniques), CLO2 (applying testing knowledge), and CLO3 (problem-solving through testing).

     

    Instructions for Lab Report 8:

     

    Lab Report 8: Cyclomatic Complexity and Coverage Metrics

    Objective: Calculate Cyclomatic Complexity and achieve Statement, Branch, and Condition Coverage.

    Learning Outcome: Students will be able to compute Cyclomatic Complexity and design test cases to achieve comprehensive code coverage, analyzing their effectiveness (CLO1, CLO2, CLO3, PLO1, PLO3, PLO5, Cognitive Domain: Evaluate - C5).

    Tools Required: Any C Compiler.

    Instructions:

    1. Choose a program with complex logic (e.g., a sorting algorithm).
    2. Calculate Cyclomatic Complexity using V(G) = E - N + 2P.
    3. Design test cases to achieve 100% Statement, Branch, and Condition Coverage.
    4. Execute the test cases and measure coverage manually or with a tool (if available).
    5. Analyze the effectiveness of the test cases in a report.

    Deliverables:

    • A lab report with Cyclomatic Complexity calculations, test cases, coverage results, and analysis.
    • Include code and coverage tables.

    Assessment: Lab Performance, Viva, Lab Final (CLO1, CLO2, CLO3, PLO1, PLO3, PLO5).