DB section has been updated to add some SQL code.
Describe and exemplify testing:
SQL operations work correctly at this level
Evaluate solution at this level in terms of:
fitness for purpose
accuracy of output
When testing your database there are still certain tests that you have to carry out to ensure that you are meeting the requirements of the system. These can be broadly categorised as testing the following features:
Are the correct fields displayed?
Is any validation working correctly?
Are the SQL operations working as intended and providing the correct output?
Have you displayed all of the relevant fields - are there any that have been missed out or un-necessary ones?
Not every field will have validation but for those that do it is important to ensure that this validation is working correctly.
If there are range checks you should check if the lower and upper limits are working.
This error message is due to a piece of test data being outside the accepted range
When there is a restricted choice field it must be tested to ensure that it has the correct choices and that a user cannot enter any new data (unless this is a desired function).
If there are any presence checks you should check what happens if no input is entered.
It is not enough to just use the field length as this will only set a maximum number of characters. If a phone number has to be 11 characters then you must test what happens if an invalid length of characters is entered - such as 10.
Just because an SQL statement executes successfully such as the one below you cannot assume that it is working correctly.
This screenshot from phpMyAdmin demonstrates that a query has executed successfully and returned 86 results
If we were testing the following SQL query:
The screenshot above demonstrates that the query is not functioning correctly as there are female puppies in the results.
If there has been any sorting applied to the results then you should look at your results to ensure that this has been applied.
So if we ran the following query:
The number 1 beside the cursor also shows the field on which MySQL has sorted the data.
The image shows that the sort order is being correctly applied.
When you run particular queries you may expect a particular range of results such as a cost between 200 and 300.
So if we ran the following query:
We would expect all of the prices to be between 200 and 300.
The Browse tab allows us to see the amount of records and all of the source data in the table. Based on the data above if we searched for the amount of different Hard Drives we stock we would expect 3 results.
It is possible for you to apply a temporary filter to a database table in phpMyAdmin to only view records relevant to ones you are concerned with. The screenshots below show the results before and after a filter is applied.
You can always test your database by:
Attempting to enter duplicate data for primary keys as entity integrity should ensure that each primary key is unique.
Entering data for foreign keys that don't exist, which would break referential integrity, as every foreign key value has to exist in the other table.
Testing validation using a wide range of test data.
As already discussed in the Software Development topic, a product is fit for purpose if it meets all the requirements from the client.
We establish if it is fit for purpose if we can prove that every requirement has been met. Some of these will be by testing.
We have already discussed that you have to test and evaluate your output from the database to ensure that is correct.
If there is different output from what you expect then there can be a few different reasons.
Your SQL queries were incorrect (logic error)
The data in the table(s) is different from what you were expecting