The preferred Lisp package for writing simple unit tests is lisp-unit.
Running existing tests
Just do
,r-l-s ROS_SYSTEM_TO_TEST asdf-system-to-test-tests
The asdf system for tests usually has either the -tests
suffix, or -test
suffix.
And then:
,!p asdf-system-to-test-tests (run-tests)
or
... (run-tests my-define-tests-function-name)
That's all.
Writing unit tests for your functions
Here is a tutorial on writing tests. It does assume that you have gone through all the beginner tutorials and have the corresponding code for the tutorials locally available. So, if you haven't done the beginner tutorials yet or very long ago, now is a good time to quickly refresh.
FiveAM
If lisp-unit isn't expressive enough for you, consider using FiveAM.
To run tests written with FiveAM (1) load the tests asdf package, (2) change to the corresponding Lisp package in the REPL and (3) execute (run!)
. If (run!)
doesn't do anything automatically, try specifying the test suite name: (run! 'MY_TEST_SUITE_NAME)
. You can find the name by rgrep
-ing (def-suite
in your ASDF package.