lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

For those of you that don't know LuaUnit is a unit testing framework for Lua.

I forked LuaUnit to make some significant updates to it. This is a major update that has some breaking changes to make it much more easy to use and code in many different styles. That is the reason for the version bump to 2.0. I would like some feedback and usage to see how the changes work for people. Also I am not sure who maintains LuaUnit, but I can issue a pull request on the Luaforge/LuaUnit repo if that helps. I am looking to have these changes be merged in so it is part of the official release in LuaRocks and LuaDIst.

Changes between 2.0 and 1.3:
- This is a major update that has some breaking changes to make it much more easy to use and code in many different styles
- Made the module only touch the global table for the asserts. You now use the module much more like Lua 5.2 when you require it.
  You need to store the LuaUnit table after you require it to allow you access to the LuaUnit methods and variables.
  (ex. local LuaUnit = require( "luaunit" ))
- Made changes to the style of which LuaUnit forced users to code there test classes. It now is more layed back and give the ability to code in a few styles.
- Made "testable" classes able to start with 'test' or 'Test' for their name.
- Made "testable" methods able to start with 'test' or 'Test' for their name.
- Made testClass:setUp() methods able to be named with 'setUp' or 'Setup' or 'setup'.
- Made testClass:tearDown() methods able to be named with 'tearDown' or 'TearDown' or 'teardown'.
- Made LuaUnit.wrapFunctions() function able to be called with 'wrapFunctions' or 'WrapFunctions' or 'wrap_functions'.
- Made LuaUnit:run() method able to be called with 'run' or 'Run'.
- Added the ability to tell if tables are equal using assertEquals. This uses a deep compare, not just the equality that they are the same memory address.
- Added LuaUnit.is<Type> and LuaUnit.is_<type> helper functions. (e.g. assert( LuaUnit.isString( getString() ) )
- Added assert<Type> and assert_<type>
- Added assertNot<Type> and assert_not_<type>
- Added _VERSION variable to hold the LuaUnit version
- Added LuaUnit:setVerbosity(lvl) method to the LuaUnit table to allow you to control the verbosity now. If lvl is greater than 1 it will give verbose output.
  This can be called from alias of LuaUnit.SetVerbosity() and LuaUnit:set_verbosity().
- Moved wrapFunctions to the LuaUnit module table (e.g. local LuaUnit = require( "luaunit" ); LuaUnit.wrapFunctions( ... ) )
- Fixed the verbosity to actually format in a way that is closer to other unit testing frameworks I have used.
  NOTE: This is not the only way, I just thought the old output was way to verbose and duplicated the errors.
- Made the errors only show in the "test report" section (at the end of the run)

Thoughts and feedback are greatly appreciated.
--
Regards,
Ryan