冰茶-测试框架
icetea的Python项目详细描述
冰茶测试框架
Icetea是一个用于MBED开发的自动化测试框架。 它自动刷新mbed板,运行测试 并将测试结果累积成报告。 开发人员将它用于本地开发以及 持续集成环境中的自动化。
测试^{DUT
)中的命令行接口(CLI
)。
测试框架和DUT
之间的接口可以是
例如uart或stdio。
有关于该工具的更详细的文档 here in rst format 以及here in markdown format。
先决条件
Icetea支持Linux(ubuntu首选)、Windows和OSX。我们的主要目标是Linux。 我们同时支持Python2.7和3.5或更高版本。下面是一些特定于操作系统的先决条件:
Linux
- python开发和python lxml
sudo apt-get install python-dev python-lxml
- 要在没有sudo权限的linux中使用硬件运行测试用例,请执行以下操作:
此命令将用户“username”添加到“dialout”组,然后 授予USB端口所需的权限。sudo usermod -a -G dialout username Log out & log in back to Linux
- python开发和python lxml
操作系统X
- XCode developer tools
- MacPorts
- lxml:
STATIC_DEPS=true sudo pip install lxml
窗口
- python lxml安装在windows上有问题,因为
它通常需要构建工具。但是可以安装
从预先构建的二进制文件。
- 从Internet上为您的系统搜索二进制文件。
- 导航到下载
二进制文件并用
pip install <insert_file_name>
安装
- 你可以按照指示here 相反。
- python lxml安装在windows上有问题,因为
它通常需要构建工具。但是可以安装
从预先构建的二进制文件。
可选
有一些可选的依赖项带来了一些可选的特性,
就像coloredlogs
,它用各种颜色装饰您的控制台输出。
所有可选依赖项都声明为^{extra_requirements.txt
文件。
> pip install -r extra_requirements.txt
Python
嗅探器集成组件需要pyshark, 由于trollius(python 2的需求)的安装问题,Requirements.txt中没有包含 pyshark的版本称为pyshark legacy)。要使用此集成,您需要手动安装pyshark。 对于python 3:
> pip install pyshark
对于python 2:
> pip install pyshark-legacy
安装
> pip install icetea
使用量
打印帮助页:
icetea --help
列出examples子文件夹中的所有本地测试用例:
icetea --list --tcdir examples
要打印冰茶版本:
icetea --version
典型用途
下面描述的所有命令可能还需要其他选项, 取决于测试用例。
使用tc参数运行测试用例
> icetea --tc <test case name> --tcdir <test case search path>
从^ {CD16>}文件夹中运行所有现有测试用例:
> icetea --tc all --tcdir examples
使用硬件运行示例测试用例
在这个例子中,我们假设已经连接了一个兼容的板
对于计算机和一个应用二进制的董事会是可用的。
引用的测试用例在the icetea github repository中可用。 使用元数据筛选器 要在元数据中使用testtype回归运行所有测试用例: 提供以下元数据筛选器: 运行预制套件 Icetea支持描述一组测试用例的套件文件
以 启用调试级别日志记录 使用-v或-vv参数控制日志记录级别。-v提高框架日志级别
调试(默认为info)和登录级别
某些插件和外部组件to info(默认为warning)。
--vv增加了所有要调试的冰茶记录器的登录级别。 更多详细信息 有关任何功能的详细信息,请参阅我们的文档。 Icetea测试用例是作为继承 示例测试用例如下所示: 见license协议。> icetea --tc test_cmdline --tcdir examples --type hardware --bin <path to a binary>
> icetea --testtype regression --tcdir <test case search path>
json
格式。> icetea --suite <suite file name> --tcdir <test case search path> --suitedir <path to suite directory>
创建测试用例
icetea_lib.bench
模块中可用的bench对象的python类实现的。
测试用例需要有一个定义元数据的初始化函数和一个实现测试序列的case函数。
有两个可选功能,设置和拆卸。我们的文档中提供了更多信息。"""
Copyright 2017 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from icetea_lib.bench import Bench
class Testcase(Bench):
def __init__(self):
Bench.__init__(self,
name="example_test",
title="Example test",
status="development",
purpose="Show example of a test",
component=["examples"],
type="smoke",
requirements={
"duts": {
'*': {
"count": 1,
"type": "hardware"
}
}
}
)
def setup(self):
# nothing for now
pass
def case(self):
self.command(1, "echo hello world", timeout=5)
self.command("help")
def teardown(self):
# nothing for now
pass
许可证
推荐PyPI第三方库