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.
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.
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()
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | Test runner initialized, test class loaded | - | PASS |
| 2 | Runs test_expert_judgment method | Calls estimate_test_cases with 4 cases and 'expert_judgment' technique | Check that estimated hours > 0 | PASS |
| 3 | Runs test_historical_data method | Calls estimate_test_cases with 4 cases and 'historical_data' technique | Check that estimated hours > 0 | PASS |
| 4 | Runs test_three_point method | Calls estimate_test_cases with 4 cases and 'three_point' technique | Check that estimated hours > 0 | PASS |
| 5 | Runs test_invalid_technique method | Calls estimate_test_cases with 4 cases and 'invalid_technique' technique | Expect ValueError exception | PASS |
| 6 | Test ends | All tests executed successfully | - | PASS |