1 Answer
1

Suppose you have a form where users can make an account. Would you prefer to manually fill in 20 text boxes, tens of times with all kinds of input that may give wrong results? Or would you rather have an automatic test do that for you in a matter of seconds?

A use case by all means is some action or procedure that your application should support, for example "register". A use case is something that one or more "actors" can do, people who would be users of your application for example "site visitor".

An automated test for the use case "register" that a "site visitor" can do, would be to create various inputs for the different data, preferrably a mixture of valid and invalid ones, then create a test class that tries to use your program with these inputs, test whether the invalid ones are correctly detected and the valid ones are accepted by using assert statements, then view the test results.

Writing the test can take a lot of time, but the big advantage is that it should still work after you made changes to your application. If it doesn't, that means you have introduced a bug into your application.

The most interesting datatypes to test for are things like numbers and dates, where you should test for interval edges, if any apply.