0
0
Testing Fundamentalstesting~10 mins

Integration testing in Testing Fundamentals - Test Execution Trace

Choose your learning style9 modes available
Test Overview

This test checks if two parts of a simple calculator app work well together. It verifies that adding two numbers through the combined modules returns the correct result.

Test Code - unittest
Testing Fundamentals
import unittest

# Module A: simple adder function
def add(a, b):
    return a + b

# Module B: calculator uses add function
def calculate_sum(x, y):
    return add(x, y)

class TestIntegrationCalculator(unittest.TestCase):
    def test_addition_integration(self):
        result = calculate_sum(3, 4)
        self.assertEqual(result, 7, "Sum should be 7")

if __name__ == '__main__':
    unittest.main()
Execution Trace - 7 Steps
StepActionSystem StateAssertionResult
1Test startsTest runner initialized, test class loaded-PASS
2Calls calculate_sum(3, 4)Calculator module ready to use add function-PASS
3calculate_sum calls add(3, 4)Adder module receives inputs 3 and 4-PASS
4add returns 7Adder module returns result 7-PASS
5calculate_sum returns 7 to testCalculator module returns final result-PASS
6Test asserts result == 7Test compares actual result with expected 7assertEqual(7, 7)PASS
7Test ends successfullyTest runner reports test passed-PASS
Failure Scenario
Failing Condition: Adder function returns wrong sum or calculate_sum does not call add correctly
Execution Trace Quiz - 3 Questions
Test your understanding
What does the integration test verify?
AThat the add function alone returns correct sums
BThat two modules work together to add numbers correctly
CThat the test framework runs without errors
DThat the calculator UI displays results
Key Result
Integration testing ensures that separate parts of a system work together correctly, catching issues that unit tests alone might miss.