Update Testing Guide authored by Nico Langhorst's avatar Nico Langhorst
...@@ -11,7 +11,9 @@ Means to keep the test duration as short as possible. ...@@ -11,7 +11,9 @@ Means to keep the test duration as short as possible.
- Remove unused code - Remove unused code
- Get paths form service instead of from domains. This reduces the domain instantiation time. - Get paths form service instead of from domains. This reduces the domain instantiation time.
- Short-circuit domain reference chains by mocking or null. This reduces the total domain instantiation time. - Short-circuit domain reference chains by mocking or null. This reduces the total domain instantiation time.
- Don't write test-objects into the database (avoid using the domain factory?) - Don't write test-objects into the database, try to mock the domain objects first (avoid using the domain factory)
- Speed up filesystem access by using Java in-memory filesystem (requires use of the Path class instead of the File class) or -- at the OS level -- shared-memory filesystem (/dev/shm). - Speed up filesystem access by using Java in-memory filesystem (requires use of the Path class instead of the File class) or -- at the OS level -- shared-memory filesystem (/dev/shm).
- Profile tests and identify slow tests, packages, components and operations. - Profile tests and identify slow tests, packages, components and operations.
- There is a gradle scan tool to create a report of the test performance.
- Sort tests by test duration and try to reduce it (disadvantage: total test time depends on intrinsic complexity) - Sort tests by test duration and try to reduce it (disadvantage: total test time depends on intrinsic complexity)
- Methods that are used by normal users shouldn't only tested as admin or operator