How to make acceptance tests from a DRAKON flowchart
It is useful to have acceptance tests before writing the code. At least, creating acceptance tests helps us understand at an early stage whether the future program is needed at all.
A DRAKON flowchart contains all use cases in a compressed form. Every path through the diagram is a use case. A use case can make a test scenario.
Thus, one can produce several test scenarios from a DRAKON flowchart. To create test scenarios, choose which paths through the diagram require testing, write down those paths, add concrete data and checks.
Here are the steps for developing acceptance tests from a DRAKON flowchart:
- Choose which paths through the DRAKON flowchart are necessary to test.
- Trace with your finger each of the selected paths.
- Write down the sequence of orders and questions.
- Supply concrete data that will get the right answers to the questions.
- Add steps to compare the actual state of the system to the expected state and check the output data.
- Check that the expected events occurred.
- Check that the unexpected events did not happen.
Let's look at an example. This DRAKON flowchart shows a procedure of logging in to a web application with password authentication.
Let's take the path where entering an incorrect password produces an error message.
Here is the sequence of orders and questions:
- Order: get the username and password from the user.
- Order: find the user by username or email.
- Question: was the user found? Answer: yes.
- Order: check the password.
- Question: did the password check succeed? Answer: no.
- Order: show an error message.
- Order: let the user try again after three seconds.
The initial input data:
Create a user user1 with password Foobar123. User status: not logged in.
The test scenario:
- Enter username user1 and password Foobar999, try to log in.
- Check that the error message shows up.
- Check that the personalized start page is not shown.
- Check that immediately after the login attempt it is not possible to try a different username and password.
- Wait for three seconds.
- Check that it is possible to try to log in again.
A DRAKON flowchart shows all possible roads that the process can take. Therefore, there is less possibility that some unobvious combination of circumstances will lead to unexpected behavior of the system. Because of this, the very presence of DRAKON flowcharts in software requirements increases security and reliability of software.