How should the tests that manipulate the database behave?

0

In everyday we come across scenarios in which we have snippets of code that run once only throughout the lifetime of the system. As an example:

  • First admin signup screen.
  • Initial System Settings (Installer) Screen.

These actions are usually done through middlewares , which are executed to check if there is no administrator or configuration in the database, thus allowing and redirecting the user to a single-use screen.

Entering the automated testing area, how could we test this kind of unique behavior?

Given that, in theory, tests should test all situations, we should also test this first access to the system, even if the system is already in production. But how should this test be done?

Given that a test must deliver the database in the same state before the test run, the solution would be to run the tests in a database distinct from the actual base actually used in the application? Using this practice would not you be creating 'addicted' tests?

    
asked by anonymous 15.04.2017 / 22:33

0 answers