diff options
-rw-r--r-- | conf.d/controller/lua.d/aft.lua | 23 | ||||
-rw-r--r-- | docs/Reference/0_BindingTestFunctions.md | 12 | ||||
-rw-r--r-- | docs/Reference/1_BindingAssertFunctions.md | 6 |
3 files changed, 38 insertions, 3 deletions
diff --git a/conf.d/controller/lua.d/aft.lua b/conf.d/controller/lua.d/aft.lua index da51a18..7955ed5 100644 --- a/conf.d/controller/lua.d/aft.lua +++ b/conf.d/controller/lua.d/aft.lua @@ -358,6 +358,14 @@ function _AFT.assertVerb(api, verb, args, cb) end end +function _AFT.assertVerbSkipped(api, verb, args, cb, msg) + if(msg) then + lu.skipIf(not _AFT.assertVerb(api, verb, args, cb), "Test is skipped because "..msg) + else + lu.skipIf(not _AFT.assertVerb(api, verb, args, cb), "Test is skipped") + end +end + function _AFT.assertVerbError(api, verb, args, cb) assertVerbCallParameters(_AFT.context, api, verb, args) local err,responseJ = AFB:servsync(_AFT.context, api, verb, args) @@ -394,6 +402,12 @@ function _AFT.testVerb(testName, api, verb, args, setUp, tearDown) end, setUp, tearDown) end +function _AFT.testVerbSkipped(testName, api, verb, args, setUp, tearDown, msg) + _AFT.describe(testName, function() + _AFT.assertVerbSkipped(api, verb, args, nil, msg) + end, setUp, tearDown) +end + function _AFT.testVerbError(testName, api, verb, args, setUp, tearDown) _AFT.describe(testName, function() _AFT.assertVerbError(api, verb, args) @@ -524,6 +538,7 @@ local luaunit_list_of_assert = { 'assertErrorMsgEquals', 'assertErrorMsgContains', 'assertErrorMsgMatches', + 'assertErrorMsgContentEquals', 'assertIs', 'assertNotIs', @@ -575,12 +590,14 @@ local _AFT_list_of_funcs = { { 'assertVerb', 'assertVerbResponseEquals' }, { 'assertVerb', 'assertVerbCb' }, { 'assertVerbError', 'assertVerbStatusError' }, + { 'assertVerbSkipped', 'assertVerbStatusSkipped' }, { 'assertVerbError', 'assertVerbResponseEqualsError' }, { 'assertVerbError', 'assertVerbCbError' }, { 'testVerb', 'testVerbStatusSuccess' }, { 'testVerb', 'testVerbResponseEquals' }, { 'testVerbError', 'testVerbStatusError' }, { 'testVerbError', 'testVerbResponseEqualsError' }, + { 'testVerbSkipped', 'testVerbStatusSkipped' }, } -- Import all luaunit assertion function to _AFT object @@ -605,8 +622,9 @@ local function call_tests() AFB:success(_AFT.context, { info = "Launching tests"}) lu.LuaUnit:runSuiteByInstances(_AFT.tests_list) - local success ="Success : "..tostring(lu.LuaUnit.result.passedCount) - local failures="Failures : "..tostring(lu.LuaUnit.result.testCount-lu.LuaUnit.result.passedCount) + local success ="Success : "..tostring(lu.LuaUnit.result.successCount) + local skipped ="Skipped : "..tostring(lu.LuaUnit.result.skippedCount) + local failures="Failures : "..tostring(lu.LuaUnit.result.failureCount) local evtHandle = AFB:evtmake(_AFT.context, 'results') --if type(evtHandle) == "userdata" then @@ -687,6 +705,5 @@ function _launch_test(context, confArgs, queryArgs) readOneFile(confArgs.files) process_tests() end - if _AFT.exit[1] == 1 then os.exit(_AFT.exit[2]) end end diff --git a/docs/Reference/0_BindingTestFunctions.md b/docs/Reference/0_BindingTestFunctions.md index 8da86da..03905fa 100644 --- a/docs/Reference/0_BindingTestFunctions.md +++ b/docs/Reference/0_BindingTestFunctions.md @@ -20,6 +20,18 @@ (if set) functions, *tearDown* will be ran after your *testFunction* and **_AFT.afterEach()** (if set) functions. +* **_AFT.testVerbStatusSkipped(testName, api, verb, args, setUp, tearDown, msg)** + + Skip a test. + + *msg* is a message to indicate the reason why the test is skip, + it must contain your test name if you want to parse the output. + *setUp* and *tearDown* are functions that can be added to your context, + it works just like **_AFT.beforeEach()** and **_AFT.afterEach()**, + *setUp* will be ran before your *testFunction* and **_AFT.beforeEach()** + (if set) functions, *tearDown* will be ran after your *testFunction* and + **_AFT.afterEach()** (if set) functions. + * **_AFT.testVerbResponseEquals(testName, api, verb, args, expectedResponse, setUp, tearDown)** Test that the call of a verb successfully returns and that verb's response diff --git a/docs/Reference/1_BindingAssertFunctions.md b/docs/Reference/1_BindingAssertFunctions.md index 918bd04..a007875 100644 --- a/docs/Reference/1_BindingAssertFunctions.md +++ b/docs/Reference/1_BindingAssertFunctions.md @@ -8,6 +8,12 @@ The inverse than above. +* **_AFT.assertVerbStatusSkipped(api, verb, args, msg)** + + Skip a test. + + *msg* must contain your test name if you want to parse the output. + * **_AFT.assertVerbResponseEquals(api, verb, args, expectedResponse)** Test that the call of a verb successfully returns and that verb's response |