0
0
Testing Fundamentalstesting~10 mins

Test progress reporting in Testing Fundamentals - Test Execution Trace

Choose your learning style9 modes available
Test Overview

This test simulates a simple test progress reporting scenario. It verifies that the test runner correctly reports the start, progress, and completion of multiple test steps.

Test Code - PyTest
Testing Fundamentals
class TestProgressReporting:
    def __init__(self):
        self.steps = ["Initialize", "Load Data", "Process Data", "Generate Report"]
        self.progress = []

    def run_test(self):
        print("Test starts")
        for step in self.steps:
            print(f"Running step: {step}")
            self.progress.append(step)
            print(f"Progress: {len(self.progress)}/{len(self.steps)} steps completed")
        print("Test completed successfully")

    def verify_progress(self):
        assert len(self.progress) == len(self.steps), "Not all steps completed"

if __name__ == "__main__":
    test = TestProgressReporting()
    test.run_test()
    test.verify_progress()
Execution Trace - 10 Steps
StepActionSystem StateAssertionResult
1Test startsTestProgressReporting instance created, steps list initialized-PASS
2Running step: InitializeStep 'Initialize' is being executedProgress list contains 'Initialize'PASS
3Progress: 1/4 steps completedOne step completed out of four-PASS
4Running step: Load DataStep 'Load Data' is being executedProgress list contains 'Load Data'PASS
5Progress: 2/4 steps completedTwo steps completed out of four-PASS
6Running step: Process DataStep 'Process Data' is being executedProgress list contains 'Process Data'PASS
7Progress: 3/4 steps completedThree steps completed out of four-PASS
8Running step: Generate ReportStep 'Generate Report' is being executedProgress list contains 'Generate Report'PASS
9Progress: 4/4 steps completedAll four steps completed-PASS
10Test completed successfullyTest run finished with all steps doneAssert that progress list length equals steps list lengthPASS
Failure Scenario
Failing Condition: If one or more steps are not added to the progress list during execution
Execution Trace Quiz - 3 Questions
Test your understanding
What does the test print when it starts running?
ATest starts
BTest completed successfully
CRunning step: Initialize
DProgress: 1/4 steps completed
Key Result
Always track and verify each test step's progress to ensure the test completes all intended actions.