Skip to content

Write unit tests for queries

Developers write unit tests for queries. With these tests, it can be determined if the application behaves in an intended manner.

  • Author: Otto Nordling
  • Date / Version: 30/05/2023

User roles

  1. Developer

Prerequisites / Conditions

  1. A working database connection
  2. A method to query the database through the application

Use Case Diagram

uml diagram

Description of use case

  1. Developer codes the app
  2. Developer writes unit tests
  3. Developer inserts queries
  4. Database receives queries through the application
  5. Query is returned to the developer through the application
  6. Developer confirms whether the result to the query was expected or not

Exceptions

  • No known expectations

Result

  • The developer will know if they need to modify their code to make the application work as intended

Use frequency

  • After the code has been modified

Additional information**

  • Each developer should write unit tests for their own code.

Sources

This wiki-document is based on the The public administration recommendations

Thanks to the original authors.