我正在尝试用lua编写测试用例。我想在执行测试用例之前进行一些设置,并在执行测试用例后进行拆卸。我将如何在 LUA 中实现目标。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 框架来运行测试用例
lunatest.suite("myFirstLuaTesting")
lunatest.run()
是的,具有称为"设置","拆卸","suite_setup"和"suite_teardown"的功能。测试驱动程序不会找到您拥有的那些(设置和拆卸)。