Skip to content

Testing

James Menzies edited this page Mar 9, 2021 · 2 revisions

Automated Tests

Django has extensive tools for being able to test a full-stack application across the following layers:

  • Models
  • Templates
  • Views
  • Contexts

This application makes use of all of these mechanisms to ensure that the application functions as it should. A requirement of being able to push code into the master branch is that all of these tests pass, and this is enforced through Github's branch protection rules.

Manual Testing

Whilst automated testing is great for its repeatability, manual verification of the application's functionality is still important. For local development, the process is made easy via Docker Compose and the steps are as follows:

  1. Make sure that Docker, Docker Compose and Git are installed on the system.
  2. Clone the repository from the dev branch.
  3. Rename the .env.example file to .env (which is sufficient for local use).
  4. Run docker-compose up.

For production, testing is simply a matter of visiting the website at

The Steps

General rules for all pages include the following:

  • Ensure that text can be read
  • Ensure that protected pages (anything other than the login and register page) cannot be accessed unless logged in.

For the more specific tests:

Login

  • Make sure that the user must type a valid password to login.
  • Ensure that the user is taken to the landing page once authenticated.
  • Verify that My Profile renders correctly, that the user's profile picture appears if one was uploaded otherwise the placholder is shown.
  • Verify that Edit Profile allows users to update their display name and profile picture correctly.
  • When creating an event, users should be made to put in a name and duration, but the other fields are optional. Regardless, make sure that all inputted information is updated, save for invalid emails.
  • Ensure that a user cannot activate an event unless there are 3 or more participants, that message should be conveyed to the user.
  • Ensure that non-owners cannot view an event unless it has been activated.
  • Verify the correct flow of screens for an activated event;
  • A user should be prompted to give a gift if they haven't already; then
  • Told to wait until the reveal occurs; then
  • Once it is time to reveal the gifts they will have a one-shot opportunity to open their present; then
  • View all the results for everyone's presents.
  • There shouldn't be any reappearance of a screen once the user has interacted with it, or the phase of the event has changed.
  • Users should not be able to manually view via the URL any event for which they do not belong to.
  • When viewing events, the events should be sorted by conclusion time of the event in descending order.