Authors:
Name | Student number |
---|---|
679586 |
Teachers:
Name | Function |
---|---|
Skills begeleider | |
Procesbegeleider |
Klas | ITA-OOSE-A |
---|---|
Groepsnaam | Smalltalk |
Course | OOSE |
Datum |
|
Versie | 1.7 |
In this document we will take a look at the safety of the application. This is mainly focused on unit tests and what they do.
One of the requirements from Regterschot Racing was that the application needs to be safe, so that no-one is allowed on the appplication, except for those with the permission to be in the application.
The code also needs to work and be well documented. This document will show which code works and what all the tests are. If there is a failed test, it will be explained on why this happens.
GraphDAOTest class
Name | Expected result | Parameters | Actual result | Success | Comments | |
---|---|---|---|---|---|---|
1 | getGraphs() | All graphs with tabID are shown. | tabID = 1 | All graphs with the given tabID, are returned to the user. | Yes | |
2 | getUserTabsSqlException() | A databaseException will be thrown after a SQLException. | tabID = 1 | A SQLException is thrown. | Yes | Wrong exception is thrown. |
Table 1: Tests in GraphDAOTest
TabDAOTest class
Name | Expected result | Parameters | Actual result | Success | Comments | |
---|---|---|---|---|---|---|
1 | getUserTabsCorrectly() | All tabs from the user. | username = 'Erik' | All graphs are returned to the user. | Yes | |
2 | getUserTabsSqlException() | A databaseException will be thrown after a SQLException. | username = 'Erik' | A SQLException is thrown. | Yes | Wrong exception is thrown. |
Table 2: Tests in TabDAOTest
LoginServiceTest
Name | Expected result | Parameters | Actual result | Success | Comments | |
---|---|---|---|---|---|---|
1 | checkCorrectUsernameResponse() | Gives the same username back as the user has given to the system. | LoginRequestDTO{ username = 'Erik' } | The class returns 'Erik', and thus gives the same username back. | Yes | The response from the database is set manually, because a connection to the real database is not safe in tests. |
2 | checkCorrectTokenResponse() | Gives a new token dedicated to a specific name. | LoginRequestDTO{ username = 'Erik' } | The class returns the same token as expected for the user given. | Yes | The response from the database is set manually, because a connection to the real database is not safe in tests. |
3 | checkThrownExceptionWrongPassword() | Throws a LoginCredentialsIncorrectException after wrong input of the password. | LoginRequestDTO{ username = 'Erik' } | A LoginCredentialsIncorrectException is thrown. | Yes | The response from the database is set manually, because a connection to the real database is not safe in tests. In this case it's set to 0, to simulate the database returning nothing. |
4 | checkThrownExceptionWrongUser() | Throws a LoginCredentialsIncorrectException after wrong input of the name. | LoginRequestDTO{ username = 'WrongUser' } | A LoginCredentialsIncorrectException is thrown. | Yes | The response from the database is set manually, because a connection to the real database is not safe in tests. In this case it's set to 0, to simulate the database returning nothing. |
5 | checkThrownExceptionNoUserAndPassword() | Throws a LoginCredentialsIncorrectException after no input. | LoginRequestDTO{ username = '' } | A LoginCredentialsIncorrectException is thrown. | Yes | The response from the database is set manually, because a connection to the real database is not safe in tests. In this case it's set to 0, to simulate the database returning nothing. |
6 | testCreationToken() | Creates a token based on the name that it has received | username = 'Erik' | Creates the token from username 'Erik' | Yes |