0
0
Testing Fundamentalstesting~10 mins

Why systematic techniques improve coverage in Testing Fundamentals - Test Your Understanding

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

Complete the code to show why systematic testing helps cover all cases.

Testing Fundamentals
test_cases = ['input1', 'input2', 'input3']
for case in [1]:
    print(f"Testing {case}")
Drag options to blanks, or click blank then click option'
Arandom.sample(test_cases, 2)
Btest_cases
C[]
DNone
Attempts:
3 left
💡 Hint
Common Mistakes
Using a subset of test cases by mistake.
2fill in blank
medium

Complete the code to check if all inputs are covered by the tests.

Testing Fundamentals
all_inputs = {'a', 'b', 'c', 'd'}
tested_inputs = {'a', 'b', 'c'}
coverage = tested_inputs [1] all_inputs
print(coverage)
Drag options to blanks, or click blank then click option'
A!=
B>=
C==
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using < or > which only check subset or superset.
3fill in blank
hard

Fix the error in the code that tries to generate all combinations for testing.

Testing Fundamentals
from itertools import product
inputs1 = ['x', 'y']
inputs2 = ['1', '2']
all_combinations = list(product(inputs1, [1]))
print(all_combinations)
Drag options to blanks, or click blank then click option'
Ainputs2
Binputs1
CNone
D['3', '4']
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same list twice or a wrong list.
4fill in blank
hard

Fill both blanks to create a test that only includes inputs longer than 3 characters.

Testing Fundamentals
inputs = ['cat', 'lion', 'tiger', 'dog']
filtered_tests = [[1] for word in inputs if len(word) [2] 3]
print(filtered_tests)
Drag options to blanks, or click blank then click option'
Aword.upper()
Bword.lower()
C>
D<=
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong comparison operator or no transformation.
5fill in blank
hard

Fill all three blanks to build a dictionary of test results for inputs with length > 2.

Testing Fundamentals
inputs = ['go', 'run', 'jump', 'sit']
results = { [1]: [2] for word in inputs if len(word) [3] 2 }
print(results)
Drag options to blanks, or click blank then click option'
Aword
Blen(word)
C>
D{
Attempts:
3 left
💡 Hint
Common Mistakes
Missing dictionary braces or wrong filter condition.