Test Overview
This test calculates the Return on Investment (ROI) for automation in software testing. It verifies that the ROI formula correctly computes the value based on given inputs for manual and automation costs and savings.
This test calculates the Return on Investment (ROI) for automation in software testing. It verifies that the ROI formula correctly computes the value based on given inputs for manual and automation costs and savings.
import unittest class TestAutomationROICalculation(unittest.TestCase): def calculate_roi(self, manual_cost, automation_cost, savings): # ROI = (Savings - Automation Cost) / Automation Cost return (savings - automation_cost) / automation_cost def test_roi_calculation(self): manual_cost = 10000 # Cost of manual testing automation_cost = 4000 # Cost of automation setup savings = 12000 # Savings from automation roi = self.calculate_roi(manual_cost, automation_cost, savings) # Expected ROI = (12000 - 4000) / 4000 = 2.0 self.assertEqual(roi, 2.0, "ROI calculation should be correct") if __name__ == '__main__': unittest.main()
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | Python unittest framework initialized | - | PASS |
| 2 | Calls calculate_roi with manual_cost=10000, automation_cost=4000, savings=12000 | Function executes calculation | - | PASS |
| 3 | Calculates ROI as (12000 - 4000) / 4000 = 2.0 | ROI value computed | - | PASS |
| 4 | Asserts that ROI equals 2.0 | Assertion compares expected and actual ROI | roi == 2.0 | PASS |
| 5 | Test ends successfully | Test suite completes with no errors | - | PASS |