I have been needing to do some more testing of my coronaSDK apps. Things tend to break, and I have to go dig and find them…
…not any more. I decided to build myself a nice little utility to handle testing in my projects. jubilo.lua was born.
I built jubilo in lua to be compatible with all lua applications and not specific to corona. It would be cool to be featured on this page someday too.
jubilo.lua is small, exactly 150 lines of code as of today. It has everything needed to test lua applications. It has only one type of test, assertion. The print formatting is very slick (and adjustable).
Here is the full feature list:
- assert function (this only tests if a condition is true of false. It’s all a test framework really needs)
- nested contexts
- adjustable print formatting
- result summary (via the run() function)
- optional “no conflict mode” (forces the library to run in a namespace)
jubilo.lua was inspired by telescope. I even borrowed some documentation as a sort of tribute. My design was to make jubilo look like and function similar to telescope, but stripped of all unnecessary features. These features are all good, but I left out everything that didn’t take away from testing at its core. For example, jubilo.lua only has one type of assertion.
There is one addition I made to jubilo.lua in formatting. telescope only prints results for tests:
-- taken from telescope's documentation
------------------------------------------------------------------------
A context:
A nested context:
A test [P]
Another nested context:
Another test [P]
A test in the top-level context [F]
------------------------------------------------------------------------
jubilo.lua fails all contexts that have failing tests:
-- taken from jubilo.lua's documentation
----------------------------------------------------------------------
A context: [f]
A nested context: [p]
A test [p]
Another nested context: [p]
Another test [p]
A test in the top-level context [f]
----------------------------------------------------------------------
Why the name “jubilo”? “lua” is Portuguese for “moon”. “júbilo” is Portuguese for “joy”. There you go, a joyful testing library.
Please check out the code on github here. I will be adding updates there. Hopefully I will get around to testing jubilo.lua against itself. I am also going to try to write a comprehensive tutorial on jubilo. For now, please read the documentation.
Enjoy!



