- Implement your own basic unit testing framework from scratch, mimicking some functionality of
unittest
orpytest
. Then, use it to test your CRUD application. - This will demonstrate your deep understanding of testing concepts and building tools from the ground up.
Basic idea
- have a general
TestSuite
that holds a list of method-objects of a child-class ofTestCase
-class to be tested TestCase
does aninitialize
andfinalize
at beginning and end to setup and release eventually relevant database configurations etc for each test individually (to thoroughly test whole setup)TestTravelCrud
class holdstest_
prefixed versions of the original functions fromTravelCrud
class to test the behaviour
Tricky points
- How to access the used queries after the cursor is deleted and memory reallocated given the use of the context manager for consistent transactioning?
- implemented a history mode into the context wrapper
@BasicCRUD.db_operation
- implemented a history mode into the context wrapper
Note
- Only implemented the test for 1 of the 7
travelCRUD
classes to demonstrate the approach.
Files