Test Framework - ResearchComputing/RCAMP GitHub Wiki

Writing Tests

All RCAMP test cases should be subclasses of one of the Safe Test Classes listed below. These safe classes perform host checks prior to execution to ensure tests are not being run against prod resources. Each class has inline documentation, and will only be introduced here.

  • SafeTestCase source - This test case is intended for unit-style tests that have no dependencies outside of the Django test framework.
  • LdapTestCase source - This test case is intended for integration-style tests that are dependent upon a live LDAP server backend.
  • SafeStaticLiveServerTestCase source - Intended for functional tests for unauthenticated pages. This test case assumes a live LDAP server backend.
  • UserAuthenticatedLiveServerTestCase source - Intended for functional tests for authenticated pages. This test case creates two pairs of auth and LDAP users, one suffixed and the other not, and a set of helper methods for logging in and out of RCAMP.

Good Examples demonstrating use of the above safe test cases can be found in accounts.test_models (unit and integration tests) and projects.test_functional (functional tests).