0
0
Software Engineeringknowledge~30 mins

Regression testing in Software Engineering - Mini Project: Build & Apply

Choose your learning style9 modes available
Understanding Regression Testing
📖 Scenario: You are a QA engineer managing a regression test suite for a web application. After a code change, you need to identify affected modules, select the right tests, run them, and analyze the results to decide if the code is safe to deploy.
🎯 Goal: Build a Python model that simulates regression testing: define modules and their tests, identify affected modules from a code change, run the selected tests, and determine deployment readiness.
📋 What You'll Learn
Create a dictionary mapping modules to their test cases
Identify affected modules based on a code change
Select and run regression tests for affected modules
Determine deployment readiness based on test results
💡 Why This Matters
🌍 Real World
Regression testing is fundamental to CI/CD pipelines. Every major software company runs regression suites automatically on every commit to catch regressions before they reach production.
💼 Career
QA engineers, SDETs, and developers are expected to understand regression testing strategies, test selection, and how to analyze failures in technical interviews.
Progress0 / 4 steps
1
Define modules and their test cases
Create a dictionary called module_tests with three entries: 'auth' mapped to ['test_login', 'test_logout', 'test_token'], 'cart' mapped to ['test_add_item', 'test_remove_item'], and 'payment' mapped to ['test_checkout', 'test_refund', 'test_receipt'].
Software Engineering
Hint

Each module key maps to a list of test function names that verify that module's behavior.

2
Identify affected modules
Create a list called changed_modules containing 'auth'. Create a dictionary called dependencies with 'auth' mapped to ['cart'], 'cart' mapped to ['payment'], and 'payment' mapped to an empty list []. Create an empty list called affected_modules. Use a for loop with variable module over changed_modules to append each module and its dependencies from dependencies[module] to affected_modules.
Software Engineering
Hint

When auth changes, both auth and its dependent module cart need regression testing.

3
Select and run regression tests
Create an empty list called selected_tests. Use a for loop with variable module over affected_modules to extend selected_tests with module_tests[module]. Create a dictionary called test_results. Use a for loop with variable test over selected_tests to set each test's result to 'pass' in test_results. Then override test_results['test_token'] to 'fail' to simulate a regression.
Software Engineering
Hint

Collect all tests for affected modules, run them all as pass, then override one to simulate a failure.

4
Determine deployment readiness
Create a list called failures using a list comprehension that collects each test from test_results where test_results[test] equals 'fail'. Create a variable deploy_ready set to len(failures) == 0.
Software Engineering
Hint

If any test failed, the code is not ready to deploy. deploy_ready should be False when failures exist.