In the area of software testing, “use case” and “test case” are the most critical and closely interrelated terms, but they are quite different.
- A use case tells us how a system will behave or perform a given task under given conditions.
- A test case contains the actual test data, the instruction set of the system, and the expected results of the interaction with the system.
The test case design includes prerequisites, case name, input conditions and expected results. In other words, test cases can be derived from use case scenarios based on a set of different test activities, such as test inputs, execution conditions and expected results, and additionally lead to the evolution of specific test objectives.
Test Case Example – ATM
After developed a use case scenario with the flow of events, a test case can also be developed. Here there will be a success scenario and the steps that the user should complete. Examples of these steps could be.
- Insert the card.
- Validate the card and ask for a PIN.
- Enter a PIN.
- Verify the PIN, and then
- Allow access to the account.
After this, there is an extended list within the form. It may happen, for example, that when verifying the card, the system determines that something is incorrect. The extended list can be listed below.
2a) Card is invalid (a message is displayed and the card is rejected).
3a) Invalid password (a message is displayed and a retry is requested-twice), and
4a) Invalid password 3 times (eats the card and exits).
Develop Test Cases In Visual Paradigm
As mentioned in the example above, you can define the steps needed to complete a use case. Furthermore, you can create test cases around the steps, to make sure the use case will be completed correctly in any situations. In this tutorial, we will create test case for a use case named Login.
- Download Webmail System.vpp. You can also find this file at the bottom of this tutorial.
- Open the downloaded .vpp file in Visual Paradigm. To open a project, select Project > Open from the application toolbar.
- Open use case diagram Webmail System Use Case Model. You should see this:
- We need to edit the test case of a use case. To do so, open the Use Case Details on use case Login by right clicking on it and selecting Use Case Details from the popup menu.
- Open the page of Flow of Events. The use case Login is formed by a number of simple steps – enter username and passowrd, and click Submit. What we need to do is write test case to make sure this three steps will work as expected in the final product.
- Move the mouse pointer to the right hand side of the flow of events, click on the drop down menu (Menu) and select Main. This drop down menu is for selection of test case. Main is the default one.
Now, the flow of events page is divided into three columns – Steps, Procedures and Expected Results. By walking through the steps, the use case is said to be completed. Procedures and expected results are made for testing purposes. Procedures are the steps needed to test a step, while expected results are the outcome expected by performing the testing procedures.
- We want to start by writing a valid test case. In step one, we shall test the entering of username by entering peter, assuming that peter is a valid and existing user, and expect to have name peter show on the username field. Enter Fill in peter as username in Procedures cell of step 1. There is no doubt that entering text in a field will have the text appear on the field, so we simply omit expected results here. If you like you can still enter Text “peter” show in username field, but just look a bit cumbersome.
- For step two Enter password, specify Fill in mypwd as password in Procedures cell. In order to make sure a proper password field is used, we need to specify the expected results by entering Five asterisk (i.e. *) characters are shown in Expected Results cell.
- For step three, specify Click [Submit] in Procedures cell. Enter Peter’s Inbox is shown in expected results.
- The naming of test case Main is not descriptive enough. Let’s change it. Click on the … button next to the drop down menu Main.
- In the Testing Procedures dialog box, right click Main and select Rename from the popup menu. Enter Login with valid username and password as name.
- Let’s add another test case for testing invalid usage. In the Testing Procedures dialog box, click on the + button, enter Login without username and password as name. Confirm the changes and go back to the page of flow of events.
- The test case is now Login without username and password. Let’s fill in the procedures and expected results as shown below:
Steps Procedures Expected Results Enter username Do not enter anything Enter password Do not enter anything Click [Submit] to open the Inbox page Click [Submit] Warning : “Please specify username and password” appear. Login aborted.
- Save the project. This ends the tutorial.