Which statement correctly describes the main difference between smoke testing and sanity testing?
Think about the scope and purpose of each test type.
Smoke testing quickly checks if the main parts of the system work after a build. Sanity testing checks specific parts after small changes.
Given this test result summary code, what will be the printed output?
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))
Count how many tests have status 'pass' and compare with total.
Two tests passed, one failed. So the output shows failure with 1 test failed.
Which assertion correctly verifies that a sanity test confirms a bug fix by checking the fixed feature returns expected output?
def fixed_feature(x): # Returns square of x return x * x result = fixed_feature(4)
Calculate the expected output of fixed_feature(4).
The function returns 4 * 4 = 16, so the assertion must check for 16.
What error will this smoke test automation code raise when executed?
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'}]))
Check the if statement syntax carefully.
The if condition uses '=' instead of '==', causing a SyntaxError.
Which option best describes how to integrate smoke and sanity tests in a continuous integration (CI) pipeline for efficient testing?
Think about quick feedback and focused testing after changes.
Smoke tests quickly check build stability. Sanity tests verify specific changes. Running smoke tests first saves time by stopping early if build is unstable.