0
0
Testing Fundamentalstesting~10 mins

Testing career progression in Testing Fundamentals - Test Execution Trace

Choose your learning style9 modes available
Test Overview

This test simulates a simple career progression tracker for a software tester. It verifies that when a tester completes a set number of projects, their career level updates correctly from Junior to Mid-level, and then to Senior.

Test Code - unittest
Testing Fundamentals
class TesterCareer:
    def __init__(self):
        self.projects_completed = 0
        self.level = 'Junior'

    def complete_project(self):
        self.projects_completed += 1
        self.update_level()

    def update_level(self):
        if self.projects_completed >= 5 and self.projects_completed < 10:
            self.level = 'Mid-level'
        elif self.projects_completed >= 10:
            self.level = 'Senior'
        else:
            self.level = 'Junior'

import unittest

class TestCareerProgression(unittest.TestCase):
    def test_level_progression(self):
        tester = TesterCareer()
        # Initially Junior
        self.assertEqual(tester.level, 'Junior')

        # Complete 5 projects -> Mid-level
        for _ in range(5):
            tester.complete_project()
        self.assertEqual(tester.level, 'Mid-level')

        # Complete 5 more projects -> Senior
        for _ in range(5):
            tester.complete_project()
        self.assertEqual(tester.level, 'Senior')

if __name__ == '__main__':
    unittest.main()
Execution Trace - 5 Steps
StepActionSystem StateAssertionResult
1Test startsTest framework initialized, no tests run yet-PASS
2Create TesterCareer instanceTesterCareer object created with projects_completed=0 and level='Junior'Assert level is 'Junior'PASS
3Complete 5 projects by calling complete_project 5 timesprojects_completed incremented to 5, level updated to 'Mid-level'Assert level is 'Mid-level'PASS
4Complete 5 more projects by calling complete_project 5 timesprojects_completed incremented to 10, level updated to 'Senior'Assert level is 'Senior'PASS
5Test endsAll assertions passed, test suite completed-PASS
Failure Scenario
Failing Condition: Level does not update correctly after completing required projects
Execution Trace Quiz - 3 Questions
Test your understanding
What is the tester's level after completing 3 projects?
AJunior
BMid-level
CSenior
DLead
Key Result
Always verify that state changes trigger expected updates by asserting after each key action, ensuring your logic for progression or transitions works as intended.