0
0
Testing Fundamentalstesting~20 mins

Smoke testing and sanity testing in Testing Fundamentals - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Smoke & Sanity Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Difference between smoke testing and sanity testing

Which statement correctly describes the main difference between smoke testing and sanity testing?

ASmoke testing is performed only by developers; sanity testing is performed only by testers.
BSmoke testing is done after sanity testing to confirm detailed features; sanity testing tests the whole system.
CSmoke testing checks basic functionality of the entire system; sanity testing verifies specific functionality after changes.
DSmoke testing focuses on UI elements; sanity testing focuses on backend database.
Attempts:
2 left
💡 Hint

Think about the scope and purpose of each test type.

Predict Output
intermediate
2:00remaining
Output of smoke test result summary

Given this test result summary code, what will be the printed output?

Testing Fundamentals
def smoke_test_results(tests):
    passed = sum(1 for t in tests if t['status'] == 'pass')
    total = len(tests)
    if passed == total:
        return 'Build Passed Smoke Test'
    else:
        return f'Build Failed Smoke Test: {total - passed} tests failed'

results = [
    {'name': 'Login', 'status': 'pass'},
    {'name': 'Signup', 'status': 'pass'},
    {'name': 'Dashboard', 'status': 'fail'}
]
print(smoke_test_results(results))
ABuild Passed Smoke Test
BBuild Failed Smoke Test: 1 tests failed
CBuild Failed Smoke Test: 2 tests failed
DBuild Passed Smoke Test: 3 tests passed
Attempts:
2 left
💡 Hint

Count how many tests have status 'pass' and compare with total.

assertion
advanced
2:00remaining
Correct assertion for sanity test verification

Which assertion correctly verifies that a sanity test confirms a bug fix by checking the fixed feature returns expected output?

Testing Fundamentals
def fixed_feature(x):
    # Returns square of x
    return x * x

result = fixed_feature(4)
Aassert result == 16
Bassert result > 20
Cassert result == 8
Dassert result != 16
Attempts:
2 left
💡 Hint

Calculate the expected output of fixed_feature(4).

🔧 Debug
advanced
2:00remaining
Identify error in smoke test automation script

What error will this smoke test automation code raise when executed?

Testing Fundamentals
def run_smoke_tests(tests):
    for test in tests:
        if test['status'] == 'fail':
            return 'Smoke test failed'
    return 'Smoke test passed'

print(run_smoke_tests([{'name': 'API', 'status': 'pass'}]))
AReturns 'Smoke test failed'
BTypeError because 'status' key is missing
CReturns 'Smoke test passed'
DSyntaxError due to assignment in if condition
Attempts:
2 left
💡 Hint

Check the if statement syntax carefully.

framework
expert
2:00remaining
Best practice for integrating smoke and sanity tests in CI pipeline

Which option best describes how to integrate smoke and sanity tests in a continuous integration (CI) pipeline for efficient testing?

ARun smoke tests immediately after build; if passed, run sanity tests on changed modules only.
BRun sanity tests first on all modules; then run smoke tests on critical features.
CRun smoke and sanity tests in parallel on the entire application after deployment.
DSkip smoke tests and run only sanity tests after every code commit.
Attempts:
2 left
💡 Hint

Think about quick feedback and focused testing after changes.