0
0
Testing Fundamentalstesting~10 mins

Smoke testing and sanity testing 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 smoke test function that checks if the main page loads.

Testing Fundamentals
def test_main_page_loads():
    response = client.get('/')
    assert response.status_code == [1]
Drag options to blanks, or click blank then click option'
A200
B404
C500
D302
Attempts:
3 left
💡 Hint
Common Mistakes
Using 404 which means page not found.
Using 500 which means server error.
2fill in blank
medium

Complete the code to perform a sanity test that verifies a feature flag is enabled.

Testing Fundamentals
def test_feature_flag_enabled():
    feature_flag = get_feature_flag('new_ui')
    assert feature_flag is [1]
Drag options to blanks, or click blank then click option'
ATrue
BFalse
CNone
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using False which means the feature is disabled.
Using None which means no value.
3fill in blank
hard

Fix the error in the test that checks if the login page contains the text 'Welcome'.

Testing Fundamentals
def test_login_page_text():
    response = client.get('/login')
    assert 'Welcome' [1] response.text
Drag options to blanks, or click blank then click option'
A!=
B==
Cin
Dnot in
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' which checks for exact match.
Using 'not in' which checks the opposite.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps test names to their pass status only if they passed.

Testing Fundamentals
results = {test[1]: status for test, status in test_results.items() if status [2] True}
Drag options to blanks, or click blank then click option'
A.upper()
B==
Cis
D.lower()
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' instead of 'is' for boolean comparison.
Using '.lower()' instead of '.upper()' for test names.
5fill in blank
hard

Fill both blanks to create a test report dictionary with test names in lowercase, their results, and only include failed tests.

Testing Fundamentals
failed_tests = {test[1]: result for test, result in all_tests.items() if result[2] False}
Drag options to blanks, or click blank then click option'
A.lower()
Cis
D.upper()
Attempts:
3 left
💡 Hint
Common Mistakes
Adding parentheses after result in the dictionary comprehension.
Using '==' instead of 'is' for boolean comparison.
Using '.upper()' instead of '.lower()' for test names.