Search code examples
performanceunit-testingtestingintegration-testing

What type of testing am I performing?


I am performing a unit test which basically tests the time performance of a call to the database, and retrieving data. Now I have made test as a UnitTest, but I am fairly sure it is not a unit test, since in short it just tracks the time from the function call, until it returns data. What type of test would this be, when not unit test?


Solution

  • It is not a performance test if it only does the call once to record the latency. Real performance tests do such a call multiple times and report statistics like the mean latency and/or various percentiles.

    It is also not a unit test by the common definition since it touches a database.

    Integration tests excercise certain use cases with some dependencies that you would usually mock in unit tests, like the database. But integration test check for functional behavior, not timing.

    Therefore I would call your test a "one-off timing test" 😄

    ...I have made test as a UnitTest...

    What you mean with this is probably that you used a common "unit testing" framework to implement the test. This does not make it a unit test. You can totally implement integration and acceptance tests with a unit testing framework and unit tests with an acceptance test framework.