lua-users home
lua-l archive

Re: Are there any guide or best practice article for unit test with lua ?

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


FWIW, I wound up making a miniscule unit test harness for a project I am working on:
The harness:
	http://svn.i-want-a-pony.com/repos/wombat/trunk/test/moonunit.lua
Example Usage:
	http://svn.i-want-a-pony.com/repos/wombat/trunk/test/test.lua
Running the Example (with some configs changed to generate failures):
brianm@golem:~/src/wombat/test$ ./test.lua
[basic_post_alt] pass
[map_regex2] pass
[server_says_hi] pass
[post_with_table] pass
[basic_post] pass
[request_attributes] pass
[simple] pass
[map_regex] pass
[translate_name_hook2] FAIL ./test.lua:97: expected 200 got 404 [fixups_hook] FAIL ./test.lua:109: incorrect status code returned, expected 201 got 200
[server_version] pass
[basic_get] pass
[super_basic_config] pass
[simple_mapped] pass
[quietly] pass
[translate_name_hook] FAIL ./test.lua:91: expected 200 got 404
[simple_filter] pass
brianm@golem:~/src/wombat/test$
brianm@golem:~/src/wombat/test$ ./test.lua simple_filter translate_name_hook
[simple_filter] pass
[translate_name_hook] FAIL ./test.lua:91: expected 200 got 404
brianm@golem:~/src/wombat/test$
It doesn't have anything very fancy, but it works darned well. Lua's assert(..) does pretty much all the heavy lifting.
-Brian
On Nov 19, 2006, at 4:08 PM, Doug Currie wrote:
According to your link lunit has no been updated since August 2004 and the latest version is 0.3 (alpha). Does it mean that the project is in
a dormant phase?
Yes, you are right, but it can be use as a base.
I noticed "lunit 0.4pre (alpha)" in
http://luaforge.net/frs/download.php/1611/lua-sqlite3-0.4.1.tar.bz2
from
http://luaforge.net/projects/lua-sqlite3/
e
--
Doug Currie
Londonderry, NH

AltStyle によって変換されたページ (->オリジナル) /