Setting up your testing, and writing some tests
Hand in your work via your team's chosen GitHub repository. Document names and locations as specified below.
It's time (past time, honestly, but that's life) for each project team to choose unit testing frameworks and to write some automated tests.
What to do
- Identify components of your project for which automated testing is possible.
- Choose testing frameworks suitable for the tools you are using to implement your project. For example, node.js projects could use node's built-in unit testing framework. Python-based servers could use python's unittest or pyunit modules. You might also consider choosing a front-end/user-interface testing framework to automate simple interactions with your application.
- For each component of your project (e.g., client-side code, REST API, database code, other back-end code), set up at least two specific tests.
- Make sure all your tests are runnable with simple actions on your part (e.g., a command-line command, or "open a development tool and select a menu item", etc.). If possible, make your tests runnable from the command line. That would enable you to run your tests automatically--e.g., when you push to github or initiate a pull request.
- Make a list of additional specific tests you would like
to add to your test suite. You may express this list either
in text (in the
doc/testing.mdfile) or by going ahead and implementing the tests and putting them into your runnable test suite. - If you thing you also need manual tests, write a script telling the person doing the manual testing exactly what actions they should perform.
Document all of the above in
doc/testing.md. Specifically, make sure this document contains:- A brief description of the testing tools you are using.
- A pointer to the source code containing your tests.
- A concise, step-by-step guide to running the tests.
- Your list of un-implemented tests that you think you should eventually implement.
- The manual testing script, if any.
Keep things short and simple and put suitable headings between sections to make everything easy to read.
If you use markdown instead of straight text (and really, I think you should), put specific commands in a code-display font. For inline commands, you can surround them with single backquotes, like `python3 unit-tests.py`. For displayed blocks of commands, surround them with triple backquotes ``` on either end.
Take this seriously, and have some fun!
I have found that every time I set up a testing infrastructure for a project or even when I just add a couple little unit tests to a test suite, I feel better about myself and the potential success of my project. Testing is really good for you, and getting it set up will make your future work on the project easier.