从unittest生成事件的canopsis连接器

unittest2canopsis的Python项目详细描述


单元测试到CANopsis连接器图片::https://travis-ci.org/linkdd/unittest2canopsis.svg?branch=master



此包提供了一个连接器,它将执行python unittest以生成用于canopsis的


----


在本例中,我们将使用以下测试(作为“mytest.py`):

。密码块:python


编码:utf-8-*-







>类mytestcase(unittest.testcase):
>定义测试成功(self):
>self.asserttrue(true)












':
unittest.main()


在:

上运行unittest。代码块:

$unittest2canopsis-t mytest.py-n mytest0-a“amqp://guest:guest@localhost:5672/”
unittest.mytest0.check.resource.mytestcase.test失败…失败
unittest.mytest0.check.resource.mytestcase.test_success…好的

您还可以使用json配置文件:

…代码块::javascript

{“tcp2canopsis”:{
“test”:“mytest.py”、
“testname”:“mytest0”、
“amqp”:“amqp://guest:guest@localhost:5672/”
}

并使用:

加载文件。代码块:

$unittest2canopsis-c path/to/config.json


生成的事件示例:

…代码块::javascript

{
“时间戳”:1418206046,
“连接器”:“单元测试”,
“连接器名称”:“mytest0”,
“事件类型”:“检查”,
“源类型”:“资源”,“组件”:“mytestcase”,“资源”:“测试失败”,“状态”:2,
“状态类型”:1,
“output”:“回溯(最后一次调用):\n文件\“mytest.py\”,第11行,在test_fail中\n self.assertfalse(true)\n序列错误:true不是false\n”
}
{
“timestamp”:1418206046,
“connector”:“unittest”,
“connector_name”:“mytest0”,
“event_type”:“check”,
“源代码类型”:“资源”
“组件”:“mytestcase”
“资源”:“测试成功”
“状态”:0,
“状态类型”:1,
“输出”:“确定”
}


代码块:

$pip install unittest2canopsis

,或者在本地安装:

…代码块:

$./makefile

这将在当前文件夹中创建一个虚拟的python环境,并安装由“requirements.txt”列出的依赖项。
最后,它将执行“python setup.py install”。

执行此脚本后,连接器将在当前文件夹(现在是虚拟python环境)中可用。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java使用Eclipse Helios for Web项目   java指定行。作为编译器设置的分隔符?   osm映射中带有osmdroid的java标记   java Android ClassNotFoundException在路径:DexPathList上未找到类   java从j2me调用GWT方法   更新到java 8后的aspectj问题   如何仅从根元素java,com提取文本内容。滴虫软件。是的。html   安卓公司。谷歌。火基。数据库DatabaseException:未能转换java类型的值。将字符串改为长字符串   从java中的方法返回arraylist变量   java如果将引用重新分配给同步块内的锁对象,会是什么?   java下载。使用spring mvc的资源文件中的xlsx文件   java Eclipse提供了什么工具来运行Eclipse中未包含的程序?   spring boot Java泛型如何读取传递给泛型方法的类型上的字段或调用方法   Javacard中的javaecdsa签名