我正在尝试用lua编写测试用例。我想在执行测试用例之前执行一些setUp,并在执行测试用例后执行tearDown。我怎样才能在LUA中实现。卢阿支持这个吗?
myFirstLuaTesting.lua
function setUp() #Should be executed first
--setup the testcase
function testSample1() #Should be executed after setup
--execute assertions in test case
function testSample1() #Should be executed after setup
--execute assertions in test case
function tearDown() #Should be executed last after testcases executed
--tearDown the testcase
我正在使用最小的框架来运行测试用例
lunatest.suite("myFirstLuaTesting")
lunatest.run()
答案 0 :(得分:1)
是的功能称为“setup”,“teardown”,“suite_setup”和“suite_teardown”。测试驱动程序将找不到您拥有的那些(setUp和tearDown)。