NoroffFEU / agency-api.noroff.dev

The Unlicense
2 stars 12 forks source link

Request for Enhanced Testing Environment Strategies for E2E Tests #120

Closed kyrregjerstad closed 10 months ago

kyrregjerstad commented 10 months ago

Summary

We're enhancing our end-to-end (E2E) testing for the frontend, with a focus on user journeys like registration. To effectively test user signup without spamming the database with test accounts, we need to consider various strategies for managing test data.

Proposed Solutions

Each of these methods offers a way to manage test data while ensuring the database remains uncluttered.

Your input and suggestions on these proposed solutions would be greatly appreciated.

Thank you!

Anclagen commented 10 months ago

Recent updates in PR #119 enable the backend to be operated locally via a Docker setup. This allows for testing in an isolated environment, which you should be able to easily set up by following the instructions in the PR. This could help avoid unnecessary cluttering on the actual server.

As it stands the current running API is the testing environment, so the database could be periodically purge. I would suggest your E2E tests incorporate some degree of self cleaning for the moment.

A flag could be added at some point in the future, this will probably also require creating a dedicated endpoint to trigger a cleanup process before re-running tests, to ensure a clean state for each test cycle, similar to our route tests.

kyrregjerstad commented 10 months ago

Hi @Anclagen, thanks for the quick reply! That's super useful info, I will set up Docker for the testing environment 🚀