Carbon0-Games/carbon0-web-app

Speed Up Tests

UPstartDeveloper opened this issue · 0 comments

Hey team, I initially used subclasses to provide initial data for the test database, to avoid having to instantiate models that were needed for the test suites repeatedly.

However, we have now added fixtures, which can accomplish the same goal and cut down on the time it takes for the tests to run.

Would someone please go about editing the tests so that underneath every TestCase class, it uses the following as a class attribute?

class ExampleTestSuite(TestCase):
       # add initial data to the db
       fixtures = [
           'question_data.json',
           'mission_link_data.json',
       ]

This is a really good way to get acquainted with how the tests work, as making this change will also require modifying how some of the tests were implemented (in order for it all to make syntactic sense).

This page of the Django documentation on adding fixtures to tests will help provide more reference here, as will this page on Django testing in general.