Using jupyter notebooks as testing environment
Jupyter notebooks are a great way to tinker with code, explore and do testing. On the other hand it can be used to document and learn how code and API's are designed.
The idea here is a bit similar to doctest. You run your notebook on your code after changes. If the output has changed, the code has changed.
Preparing code for testing can be done in two simple steps
- Start the first line of the code cell you want to include in you testing with
#test-case:
name - run the command
notebooktester init mynotebook.ipynb
Now - assuming you have made changes in your code base and want to test if the changes have any side effects you can run
the command notebooktester test mynotebook.ipynb
. This will load the notebook and