Page History
...
- Integration Tests must be written for any methods/classes which require database access to test. We feel integration tests are more important than unit tests (and you'll see this in our test
- Unit Tests must be written for any (public or private) methods/classes which don't require database-level access to test. (e.g. a utility method that parses a string should have a unit test that proves the string parsing works as expected)
- Include tests for different user types to prove access permissions are working. This includes testing as (1) an Anonymous user, (2) an Authenticated User (non-Admin), (3) an Administrator or Community/Collection Admin.
- Include tests for known error scenarios & error codes. If the code throws an error or returns an 4xx response, then a test should prove that is working.
- Bug fix PRs should include a test that reproduces the bug to prove it is fixed. For clarity, it may be useful to provide the test in a separate commit from the bug fix.
- Every test method must cleanup any test data created. See guidelines below for "cleaning Cleaning up test data".
- Use "
context.turnOffAuthorisationSystem()
" sparingly, and always follow-up with a "context.restoreAuthSystemState()
". As turning off the authorization system can affect the behavior of tests, only use these methods when you need to create/delete test data.
...
Overview
Content Tools