lua UT测试工具
luaunit
Luaunit is a unit-testing framework for Lua, in the spirit of many others unit-testing framework. Luaunit let's you write test functions, test classes with test methods and setup/teardown functionality.
https://github.com/bluebird75/luaunit
LuaUnit supports several output formats, like JUnit or TAP, for easier integration into Continuous Integration platforms (Jenkins, Maven, ...). The integrated command-line options provide a flexible interface to select tests by name or patterns, control output format, set verbosity, ...
LuaUnit works with Lua 5.1, LuaJIT 2.0, LuaJIT 2.1 beta, Lua 5.2 and Lua 5.3 . It is tested on Windows Seven, Windows Server 2012 R2 (x64), MacOs X 10.9.5 and Ubuntu 14.04 (see continuous build results on Travis-CI and AppVeyor ) and should work on all platforms supported by Lua. It has no other dependency than Lua itself.
LuaUnit is packed into a single-file. To make start using it, just add the file to your project.
使用文档:
http://luaunit.readthedocs.io/en/latest/#developing-luaunit
例子
local lu = require('luaunit')
TestFailuresWithXml = {} --class
TestFailuresWithXml.__class__ = 'TestFailuresWithXml'
function TestFailuresWithXml:test_failure_with_simple_xml()
lu.assertEquals( '<toto>ti"ti</toto>', 'got it' )
end
function TestFailuresWithXml:test_failure_with_cdata_xml()
lu.assertEquals( 'cdata does not like ]]>', 'got it' )
end
function TestThatLastsALongTime()
local start = os.clock()
while os.clock() - start < 1.1 do
end
end
lu.LuaUnit.verbosity =
os.exit( lu.LuaUnit.run() )
本工具一更新, 其它工具很早就不再更新了:
http://lua-users.org/wiki/UnitTesting
例如
https://www.mroth.net/lunit/
----
2009
最后一版
https://github.com/Phrogz/Lunity
2012
luacoverage
LuaCov is a simple coverage analyzer for Lua scripts. When a Lua script is run with the luacov module loaded, it generates a stats file with the number of executions of each line of the script and its loaded modules. The luacov command-line script then processes this file generating a report file which allows one to visualize which code paths were not traversed, which is useful for verifying the effectiveness of a test suite.
http://keplerproject.github.io/luacov/
Instructions
Using LuaCov consists of two steps: running your script to collect coverage data, and then running luacov on the collected data to generate a report.
To collect coverage data, your script needs to load the luacov Lua module. This can be done from the command-line, without modifying your script, like this:
or
(Alternatively, you can add require("luacov") to the first line of your script.)
Once the script is run, a file called luacov.stats.out is generated. If the file already exists, statistics are added to it. This is useful, for example, for making a series of runs with different input parameters in a test suite. To start the accounting from scratch, just delete the stats file.
To generate a report, just run the luacov command-line script. It expects to find a file named luacov.stats.out in the current directory, and outputs a file named luacov.report.out.
This is an example output of the report file:
==============================================================================
test.lua
==============================================================================
1 if 10 > 100 then
*0 print("I don't think this line will execute.")
else
1 print("Hello, LuaCov!")
end
Note that to generate this report, luacov reads the source files. Therefore, it expects to find them in the same location they were when the luacov module ran (the stats file stores the filenames, but not the sources themselves).
https://github.com/keplerproject/luacov
Using development version
After cloning this repo, these commands may be useful:
luarocks maketo install LuaCov from local sources;make testto run tests (does not require installing beforehand);ldoc .to regenerate documentation using LDoc. --------------------------- yummy, good toolsluacheck .to lint using Luacheck.--------------------------- yummy, good tools
lua UT测试工具的更多相关文章
- 使用 WRK 压力测试工具对 ASP.NET Core 的接口进行压力测试
0. 简要介绍 WRK 是一款轻量且易用的 HTTP 压力测试工具,通过该工具我们可以方便地对我们所开发的 WebAPI 项目进行压力测试,并且针对测试的情况返回结果. PS:Wrk 并不能针对测试的 ...
- (转)MySQL自带的性能压力测试工具mysqlslap详解
mysqlslap 是 Mysql 自带的压力测试工具,可以模拟出大量客户端同时操作数据库的情况,通过结果信息来了解数据库的性能状况 mysqlslap 的一个主要工作场景就是对数据库服务器做基准测试 ...
- sysbench(mysql测试工具 )
目录 一.基准测试简介 1.什么是基准测试 2.基准测试的作用 3.基准测试的指标 4.基准测试的分类 二.sysbench 1.sysbench简介 2.sysbench安装 3.sysbench语 ...
- MySQL压力测试工具
一.MySQL自带的压力测试工具--Mysqlslap mysqlslap是mysql自带的基准测试工具,该工具查询数据,语法简单,灵活容易使用.该工具可以模拟多个客户端同时并发的向服务器发出查询更新 ...
- 渗透测试工具BurpSuite做网站的安全测试(基础版)
渗透测试工具BurpSuite做网站的安全测试(基础版) 版权声明:本文为博主原创文章,未经博主允许不得转载. 学习网址: https://t0data.gitbooks.io/burpsuite/c ...
- linux压力测试工具stress
最近给PASS平台添加autoscaling的功能,根据服务器的负载情况autoscaling,为了测试这项功能用到了stress这个压力测试工具,这个工具相当好用了.具体安装方式就不说了.记录下这个 ...
- [.NET] WebApi 生成帮助文档及顺便自动创建简单的测试工具
==========最终的效果图========== ==========下面开始干活:生成帮助文档========== 一.创建 WebApi 项目 二.找到 HelpPageConfig.cs 并 ...
- RabbitMQ调试与测试工具-v1.0.1 -提供下载测试与使用
最近几天在看RabbitMQ,所以发了两天时间写了一个调试和测试工具.方便使用. 下载地址:RabbitMQTool-V1.0.1.zip
- HTTP压力测试工具
HttpTest4Net是一款基于C#实现的和HTTP压力测试工具,通过工具可以简单地对HTTP服务进行一个压力测试.虽然VS.NET也集成了压力测试项目,但由于VS自身占用的资源导致了在配置不高的P ...
随机推荐
- Vue#表单控件绑定
使用v-model 在表单控件上实现数据双向绑定. 单选:https://jsfiddle.net/miloer/bs49p0fx/ <input type="checkbox&quo ...
- hdu2196 树形dp
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=2196 Problem Description A school bought the fi ...
- HTML5 标签audio添加网页背景音乐代码
<head> <meta http-equiv="Content-Type" name="viewport" content="wi ...
- sql ce4 的问题
前面用sql ce4来做数据库,发现一个问题.在localhos:xxx下面速度很快,但是一放到iis上面,速度变慢了.每个查询要13秒.分析了好久,最后,查找了半天的资料,去掉了数据库的密码.速度快 ...
- postcss-px2rem
1.安装 npm install gulp-postcss --save-dev 2.gulp var gulp = require('gulp'); var postcss = require('g ...
- 第一章-第四题(ACM 比赛的程序是软件么? “写程序” 和 ”做软件“ 有区别么?软件工程是不是教那些不怎么会写程序的人开发软件? 你怎么看?这个游戏团队, 有很好的软件,但是商业模式和其他软件之外的因素呢?有没有考虑到)--By梁旭晖
引用 http://baike.baidu.com/link?url=z_phkcEO4_HjFG_Lt163dGFAubdb68IbfcfzWscTOrrZ55WbJEQKzyMQ5eMQKyatD ...
- Join函数 及Split函数精解示例
'************************************************************************* '**模 块 名:Join函数 及Split函数精 ...
- EntityFramework Reverse POCO Code First 生成器
功能强大的(免费)实体框架工具 Julie Lerman 实体框架是开源的,因此开发社区可以在 entityframework.codeplex.com 上共享代码. 但是不要将自己局限在那里寻找工具 ...
- 国家以及国家语言的json数据格式,提供给网友参考。
目前接触到一个需求,需要全球主要国家的选择以及语言的选择,如下图: 这是国家选项 这是语言的选项: 很简单有木有? 本来打算直接给文件,但是好像没有文件上传,所以就提供一个思路和代码,你们照着弄吧. ...
- 总结-Hibernate
JPA 全称 Java Persistence API @Entity @Table(name = "user") public class User { @Id @Generat ...