function AddRunStatistic(sAssertResult)
--统计测试执行情况
tRunStatistic[tRunStatisticIndex].iRunCaseNum = tRunStatistic[tRunStatisticIndex].iRunCaseNum + 1
if sAssertResult == "OK" then
tRunStatistic[tRunStatisticIndex].iOKCaseNum = tRunStatistic[tRunStatisticIndex].iOKCaseNum + 1
else
tRunStatistic[tRunStatisticIndex].iNGCaseNum = tRunStatistic[tRunStatisticIndex].iNGCaseNum + 1
--将失败的插入tRunNG
if (tRunNG[CurrNGModuleIndex]~= nil)and(tRunNG[CurrNGModuleIndex][1] == CurrModule) then --存在Module记录
if (tRunNG[CurrNGModuleIndex] [2][CurrNGCaseIndex][1]~= nil)and(tRunNG[CurrNGModuleIndex][2] [CurrNGCaseIndex][1] == CurrCase) then --存在Case记录
--添加Step项
table.insert(tRunNG[CurrNGModuleIndex][2][CurrNGCaseIndex][2],CurrStep)
else
--增加Case项
table.insert(tRunNG[CurrNGModuleIndex][2],{CurrCase,{CurrStep}})
CurrNGCaseIndex = CurrNGCaseIndex + 1
end
else --增加Module项
table.insert(tRunNG,{CurrModule,{{CurrCase,{CurrStep}}}})
CurrNGModuleIndex = CurrNGModuleIndex + 1
CurrNGCaseIndex = 1 --复位1
end
end
end
--统计测试用例执行情况
function GetStatistic()
WriteMsg("\nTestcase run statistic:")
WriteMsg("**********************************************************************")
WriteMsg("【ModuleName】".." 【Run】".." 【OK】".." 【NG】")
WriteMsg("----------------------------------------------------------------------")
for i = 1,table.getn(tRunStatistic) do
--打印格式
s1 = ""
for j = 1,24 - string.len(tRunStatistic[i].Module) do
s1 = s1 .." "
end
s2 = ""
for j = 1,17 - string.len(tRunStatistic[i].iRunCaseNum) do
s2 = s2 .. " "
end
s3 = ""
for j = 1,16 - string.len(tRunStatistic[i].iOKCaseNum) do
s3 = s3 .. " "
end
WriteMsg(i..":"..tRunStatistic[i].Module..s1..tRunStatistic[i].iRunCaseNum..s2..tRunStatistic[i].iOKCaseNum..s3..tRunStatistic[i].iNGCaseNum)
end
WriteMsg("**********************************************************************")
--记录执行失败用例
GetRunNGCase()
end
--记录执行失败用例
function GetRunNGCase()
WriteMsg("NG case info:")
if table.getn(tRunNG)==0 then
WriteMsg("No NG case,are you sure your case is perfect?")
end
for i = 1,table.getn(tRunNG) do
WriteMsg(tRunNG[i][1]) --Module Name
for j = 1,table.getn(tRunNG[i][2]) do
WriteMsg(" |--"..tRunNG[i][2][j][1]) --Case Name
for k = 1,table.getn(tRunNG[i][2][j][2]) do
WriteMsg(" |--"..tRunNG[i][2][j][2][k]) -- Step Name
end
end
end
end