-
-
Notifications
You must be signed in to change notification settings - Fork 502
Writing Unit Tests with pytest for Runestone Server
Testing a system like Runestone takes discipline and some hard work to get started. This project did not start out with a "testing first" philosophy, and its a hard philosophy to enforce in the combination of production and research oriented world that Runestone lives in. We benefit greatly from the research work done by professors and their PhD and masters students at many institutions. At the same time, Runestone.academy serves hundreds of schools and many thousands of students every day. We can't have things breaking in the middle of class. We need to be able to add new features and deploy them with confidence. This will come with a solid testing framework in place.
Many tests have common needs. Things such as:
- create a class
- populate many of the database tables related to a book for that class
- create an instructor for the class
- create some students for the class
- create an instructor for the class
- simulating student activities for those students.
For these kinds of common activities we have fixtures that allow you to focus on writing tests that test what you are building rather than reinventing the wheel to set up a class and database with all the data you would need.