Model-based Testing Example

A person must pay 10% income tax if his annual income is less than 30,000. A person must pay 15% income tax if his annual income is equal to or greater than 30,000. In the model these can be expressed as assertions. From the model we can derive two test cases, which can be hard-coded into the test driver:

Test Case 1:
Input: income = 20000
Expected Output: tax = 2000

Test Case 2: Input: income = 40000 Expected Output: tax = 6000

Instead of hard coding the above test cases into the test driver, the test driver can also input the test cases from a test case database. This is more flexible, because we can now reuse the test case database to conduct regression test.