We have completed our tutorial, but the flash quizzer is far from finished. There are still many things that can be done before it should be considered "complete".
Basic Features That Can Be Added
- export our design docs with
art export html
(you can openindex.html
in a browser). See Exporting Html Doc for more info. - Make sure all items in the design are done by running
art ls -c '<99'
- Try running
art ls -t '<99'
-- this should show you that there are several items that we don't consider to be completely tested - Currently the user exits with
Cntrl+C
, which is fine. Try catching theKeyboardInterrupt
exception and handling it more gracefully. - Speaking of exiting, we record how many answers a user got right and wrong, but we don't print out any kind of report on exiting! Add requirements for doing so (can just go in purpose if you want) and implement that.
- Users should also be able to store their report in a log file -- add a flag for that.
- There are several flags designed in
SPC-cmd
that were not implemented
Integration Tests
There are currently no tests designed or implemented which test the end-to-end functionality of the application itself (as defined in TST-cmd).
Here is one approach to do integration testing this application:
- Rather than using
print
, pass in aStringIO
object intomain
and write to it.flash/bin
then passes insys.stdout
. - Create method
get_input()
inflash/__init__.py
that just makes a call toraw_input()
. Use that method inmain(...)
instead ofraw_input()
- Mock out
get_input()
usingmock.patch(...)
withside_effect
being a closure that answers in an expected way. - You now have complete control over the inputs and outputs to your program and can record the questions asked by modifiying variables inside your closure.
- Keep track of questions asked, make assertions for how often items get asked, answer some questions incorrectly and assert the format is correct, etc.
- Make sure the closure raises an (expected) exception after a certain number of questions have been asked it.
Integration test design is typically something that should go into your design
folder, as they involve multiple pieces of disparate code. Make sure what you
will test gets added.
System Tests
You can can create system tests using a library like expect, but that is probably more complication than you need for this application.