0
0
Testing Fundamentalstesting~10 mins

Path coverage in Testing Fundamentals - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a path coverage test function.

Testing Fundamentals
def test_path_coverage():
    paths = [1]
    assert len(paths) > 0
Drag options to blanks, or click blank then click option'
A["path1", "path2"]
BNone
C[]
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using an empty list which means no paths to cover.
Using None which is not iterable.
2fill in blank
medium

Complete the code to check if all paths are covered.

Testing Fundamentals
def all_paths_covered(tested_paths, total_paths):
    return tested_paths [1] total_paths
Drag options to blanks, or click blank then click option'
A>
B==
C<
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' or '<' which do not guarantee full coverage.
Using '!=' which checks inequality.
3fill in blank
hard

Fix the error in the path coverage assertion.

Testing Fundamentals
def test_paths():
    paths = ["p1", "p2", "p3"]
    covered = ["p1", "p3"]
    assert set(covered) [1] set(paths)
Drag options to blanks, or click blank then click option'
A<=
B<
C==
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' which requires exact match.
Using '>' or '<' which are incorrect for subset checks.
4fill in blank
hard

Fill both blanks to create a dictionary of path coverage status.

Testing Fundamentals
coverage_status = {path: (path [1] covered_paths) [2] True for path in all_paths}
Drag options to blanks, or click blank then click option'
Ain
Bnot in
C==
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'not in' which reverses the logic.
Using '==' which does not assign correct boolean.
5fill in blank
hard

Fill all three blanks to filter paths with coverage and count them.

Testing Fundamentals
covered_count = len([path for path in all_paths if path [1] covered_paths and len(path) [2] [3]])
Drag options to blanks, or click blank then click option'
Ain
B>
C0
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'not in' which excludes covered paths.
Using '==' instead of '>' for length check.