Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to run the test with multiple data inputs.
Selenium Python
for data in [1]: result = process(data) assert result == expected
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a single data item instead of a collection.
Using an undefined variable name.
✗ Incorrect
The variable 'test_data' holds the multiple inputs for the data-driven test loop.
2fill in blank
mediumComplete the code to assert the expected output for each input.
Selenium Python
assert [1] == expected_output Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Asserting the input instead of the output.
Using a variable that is not defined.
✗ Incorrect
The variable 'result' holds the actual output to compare with the expected output.
3fill in blank
hardFix the error in the test function to correctly use data-driven testing.
Selenium Python
def test_function(): for item in [1]: output = process(item) assert output == expected
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a singular variable name that is not iterable.
Using an undefined variable.
✗ Incorrect
The variable 'test_cases' correctly refers to the collection of inputs for the loop.
4fill in blank
hardFill both blanks to create a data-driven test that iterates and asserts correctly.
Selenium Python
for [1] in test_data: result = process([2]) assert result == expected
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names for loop and function input.
Using a variable not defined in the loop.
✗ Incorrect
The loop variable 'item' is used both to iterate and as input to the process function.
5fill in blank
hardFill all three blanks to build a data-driven test with a descriptive assertion message.
Selenium Python
for [1] in test_inputs: output = process([2]) assert output == expected, f"Failed for input: [3]"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names causing confusion.
Leaving the assertion message without the input variable.
✗ Incorrect
Using 'test_input' consistently for the loop variable, function input, and message shows clear data flow.