Estimate test effort using three-point estimation
Preconditions (2)
✅ Expected Result: The calculated estimated time matches the formula result and is recorded correctly
import unittest class TestEstimationTechniques(unittest.TestCase): def three_point_estimate(self, optimistic, most_likely, pessimistic): return (optimistic + 4 * most_likely + pessimistic) / 6 def test_three_point_estimate(self): # Example inputs optimistic = 2.0 most_likely = 4.0 pessimistic = 8.0 estimated_time = self.three_point_estimate(optimistic, most_likely, pessimistic) expected = (2.0 + 4 * 4.0 + 8.0) / 6 self.assertIsInstance(estimated_time, float, "Estimated time should be a float") self.assertAlmostEqual(estimated_time, expected, places=5, msg="Estimate calculation is incorrect") if __name__ == '__main__': unittest.main()
This test defines a function three_point_estimate that applies the formula (O + 4*M + P) / 6.
The test test_three_point_estimate uses example values for optimistic, most likely, and pessimistic times.
It calculates the estimate and asserts two things: the result is a float, and the value matches the expected calculation.
This ensures the estimation logic is correct and the output type is valid.
Now add data-driven testing with 3 different sets of optimistic, most likely, and pessimistic inputs
Pass the test and this pattern moves unknown