0
0
Testing Fundamentalstesting~10 mins

Test estimation techniques in Testing Fundamentals - Test Execution Trace

Choose your learning style9 modes available
Test Overview

This test simulates estimating the time needed to complete a set of test cases using different estimation techniques. It verifies that the estimation method returns a valid positive number representing hours.

Test Code - unittest
Testing Fundamentals
import unittest

class TestEstimationTechniques(unittest.TestCase):
    def estimate_test_cases(self, num_cases, technique):
        # Simple mock estimation logic
        if technique == 'expert_judgment':
            return num_cases * 1.5  # 1.5 hours per case
        elif technique == 'historical_data':
            return num_cases * 1.2  # 1.2 hours per case
        elif technique == 'three_point':
            optimistic = num_cases * 1.0
            most_likely = num_cases * 1.5
            pessimistic = num_cases * 2.0
            return (optimistic + 4 * most_likely + pessimistic) / 6
        else:
            raise ValueError('Unknown estimation technique')

    def test_expert_judgment(self):
        hours = self.estimate_test_cases(4, 'expert_judgment')
        self.assertTrue(hours > 0, 'Estimated hours should be positive')

    def test_historical_data(self):
        hours = self.estimate_test_cases(4, 'historical_data')
        self.assertTrue(hours > 0, 'Estimated hours should be positive')

    def test_three_point(self):
        hours = self.estimate_test_cases(4, 'three_point')
        self.assertTrue(hours > 0, 'Estimated hours should be positive')

    def test_invalid_technique(self):
        with self.assertRaises(ValueError):
            self.estimate_test_cases(4, 'invalid_technique')

if __name__ == '__main__':
    unittest.main()
Execution Trace - 6 Steps
StepActionSystem StateAssertionResult
1Test startsTest runner initialized, test class loaded-PASS
2Runs test_expert_judgment methodCalls estimate_test_cases with 4 cases and 'expert_judgment' techniqueCheck that estimated hours > 0PASS
3Runs test_historical_data methodCalls estimate_test_cases with 4 cases and 'historical_data' techniqueCheck that estimated hours > 0PASS
4Runs test_three_point methodCalls estimate_test_cases with 4 cases and 'three_point' techniqueCheck that estimated hours > 0PASS
5Runs test_invalid_technique methodCalls estimate_test_cases with 4 cases and 'invalid_technique' techniqueExpect ValueError exceptionPASS
6Test endsAll tests executed successfully-PASS
Failure Scenario
Failing Condition: If estimate_test_cases returns zero or negative hours or does not raise error for invalid technique
Execution Trace Quiz - 3 Questions
Test your understanding
What does the test_expert_judgment method verify?
AThat the estimated hours for expert judgment are positive
BThat the estimated hours are exactly 6
CThat the test cases run without exceptions
DThat the estimation technique is unknown
Key Result
Always verify that estimation functions return valid positive values and handle unknown inputs gracefully by raising exceptions.