summaryrefslogtreecommitdiffstats
path: root/conf.d/controller/lua.d
diff options
context:
space:
mode:
authorFrederic Marec <frederic.marec@iot.bzh>2019-05-23 09:23:52 +0200
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2019-05-28 11:26:22 +0000
commit6d9031afa5d5c8d921c53b5b1e752d1a8839f8d3 (patch)
tree0e6b6a7da0e4b84e6049cbd7ca58a489539ecdae /conf.d/controller/lua.d
parent257fef2c54620cc8b0496cbcbdbd51567ced3c07 (diff)
Add skipped functions Add testVerbStatusSkipped Add assertVerbStatusSkipped Add documentation Bug-AGL: SPEC-2447 Change-Id: I84dd96b29e4838d6a1b951dc2aa230b6da3c048a Signed-off-by: Frederic Marec <frederic.marec@iot.bzh>
Diffstat (limited to 'conf.d/controller/lua.d')
-rw-r--r--conf.d/controller/lua.d/aft.lua23
1 files changed, 20 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