Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to mark a test with the 'smoke' marker.
Selenium Python
@pytest.mark.[1] def test_example(): assert True
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a marker name that does not exist or is misspelled.
Forgetting the '@pytest.mark.' prefix.
✗ Incorrect
The 'smoke' marker is used to categorize tests that check basic functionality quickly.
2fill in blank
mediumComplete the code to skip a test using the 'skip' marker.
Selenium Python
@pytest.mark.[1](reason="Not ready") def test_feature(): assert False
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'skipif' instead of 'skip' without condition.
Not providing a reason for skipping.
✗ Incorrect
The 'skip' marker tells pytest to skip the test with a given reason.
3fill in blank
hardFix the error in the marker usage to mark a test as 'regression'.
Selenium Python
@pytest.mark[1] def test_bug_fix(): assert True
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using parentheses which cause syntax errors.
Using string arguments instead of attribute access.
✗ Incorrect
Markers are used as attributes, so the correct syntax is @pytest.mark.regression without parentheses.
4fill in blank
hardFill both blanks to mark a test as 'slow' and skip it with a reason.
Selenium Python
@pytest.mark.[1] @pytest.mark.[2](reason="Too slow") def test_heavy(): assert True
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up marker names or using wrong syntax.
Forgetting the reason argument in skip.
✗ Incorrect
The test is marked as 'slow' and also skipped with a reason using the 'skip' marker.
5fill in blank
hardFill all three blanks to mark a test as 'regression', skip it with a reason, and add a custom marker 'api'.
Selenium Python
@pytest.mark.[1] @pytest.mark.[2](reason="Flaky test") @pytest.mark.[3] def test_api_call(): assert True
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using parentheses for markers that don't require them.
Forgetting to add the reason for skip.
✗ Incorrect
The test is marked as 'regression', skipped with a reason, and also marked with a custom 'api' marker.