从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环境)中可用。
此包提供了一个连接器,它将执行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环境)中可用。