TestBench导出XML完整报告的CLI工具
项目描述
testbench-cli-reporter
testbench-cli-reporter是一个cli工具,可以从TestBench实例导出XML报告并将测试结果导入其中。
这可以用于与RobotFramework等工具的自动化测试执行,由CI/CD管道触发。
支持的操作
- 从TestBench项目导出XML报告
- 将测试执行结果导入TestBench项目
- 导出操作:创建一个JSON文件,可以用于自动模式以自动重复之前的操作
- 更改连接:更改TestBench服务器和/或用户
安装
需要Python 3.6!
pip安装testbench-cli-reporter
手动模式
只需在命令行中执行testbench-cli-reporter
或TestBenchCliReporter
连接到TestBench实例
- 输入TestBench服务器
PS C:\Users\falka> testbench-cli-reporter
No config file given
Starting manual mode
? Enter the TestBench server address and port <host:port>:
在这里输入您想要交互的testbench服务器。如果您不输入端口号,则使用默认的TestBench端口号9443。
如果您不知道您的testbench实例的服务器地址,您可以在iTBClient安装文件夹中找到它:bin/application.conf
- 输入凭证
下一步是提供testbench-cli-reporter连接到TestBench所使用的登录数据。
确保用户有权访问您想要与之工作的测试项目。
? Enter your login name: testbench-user
? Enter your password: ****************
选择操作
? What do you want to do? (Use arrow keys)
» Export XML Report
Import execution results
Write history to config file
Change connection
Quit
您可以使用箭头键选择您想要进行的操作。
导出XML报告
从TestBench导出测试执行的XML报告。
- 选择您想要的测试项目、测试对象版本和测试周期。
? What do you want to do? Export XML Report
? Select a project. TestBench Demo Agil
? Select a test object version. Version 3.0
? Select a test cycle. 3.0.1
Selection:
TestBench Demo Agil projectKey: 7917307
Version 3.0 tovKey: 8678256
3.0.1 cycleKey: 8684351
提示:您可以在 config.json 文件中使用 projectKey、tovKey 和 cycleKey 来访问数据,无需知道相应元素的名字。元素的名字可以在 TestBench 中更改,键名将保持不变。这种方法可以减少维护工作量并提高鲁棒性。
- 选择要作为报告根目录使用的测试主题..如果您不小心选择了错误的测试主题,也可以返回
? Please select an element to be used as the root of the report. TT: 1 TestBench
? Please select an element to be used as the root of the report. (Use arrow keys)
» <SELECT> 1 TestBench [iTB-TT-299]
TT: 1.1 Beispiele
TT: 1.2 Regression
TT: 1.3 Sprints V1.0
TT: 1.4 Sprints V2.0
<BACK>
- 激活过滤器
? Activate Filters: (Use arrow keys)
No
» Yes
? Provide a set of filters. (Use arrow keys to move, <space> to select, <a> to toggle, <i> to invert)
» ○ automatisiert bdf
○ automatisiert keyword
○ Mir zugewiesen
- 选择报告配置
? Select Report Configuration: (Use arrow keys)
» Itep Export
iTorx Export (execution)
iTorx Export (continue|view)
<CUSTOM>
itet Export、itorx Export(执行)和 itorx Export(继续|查看)是预配置的导出。使用自定义可以自行配置报告。
在每种情况下,您都必须提供导出文件应保存的路径。
待办事项:添加每个选项的解释
自定义配置选项
-
exportAttachments (True | False) : 定义
-
exportDesignData (True | False) : 定义
-
characterEncoding (UTF-16 | UTF-8) : 定义
-
suppressFilteredData (True | False) : 定义
-
exportExpandedData (True | False) : 定义
-
exportDescriptionFields (True | False) : 定义
-
exportExecutionProtocols (True | False) : 定义
导入执行结果
将测试结果导入 TestBench。
? Provide the input path [report.zip]:
将历史记录写入配置文件
使用 testbench-cli-reporter 将当前会话中给出的输入写入一个包含 config.json 文件的配置文件。
此配置文件以后可以用于以自动模式执行 testbench-cli-reporter。
如果您在当前会话中尚未导出或导入任何内容,至少会写入连接属性。
{
"configuration": [
{
"server_url": "https://localhost:9443/api/1/",
"verify": false,
"basicAuth": "XXXXXXXXXXXX=",
"actions": []
},
]
}
更改连接
连接到不同的 TestBench 实例,这样您无需完全退出 testbench-cli-reporter。
? What do you want to do? Change connection
? Enter the TestBench server address and port <host:port>:
? Enter your login name: testbench-user
? Enter your password: ****************
退出
退出 testbench-cli-reporter
自动模式
以自动模式运行:testbench-cli-reporter --config /path/to/config/file.json
配置文件结构
projectPath
属性不是必需的。仅使用 projectKey、tovKey、cycleKey 也会更容易出错,因为它们在 TestBench 中不会改变。
{
"configuration": [
{
"server_url": "https://localhost:9443/api/1/",
"verify": false,
"basicAuth": "XXXXXXXXXXXXX=",
"actions": [
{
"type": "ExportXMLReport",
"parameters": {
"tovKey": "8689447",
"projectPath": [
"TestBench Demo Agil",
"Version 3.0",
"3.0.1"
],
"cycleKey": "8689450",
"reportRootUID": "itb-TT-8161",
"filters": [],
"report_config": {
"exportAttachments": true,
"exportDesignData": true,
"characterEncoding": "utf-16",
"suppressFilteredData": true,
"exportExpandedData": true,
"exportDescriptionFields": true,
"outputFormattedText": false,
"exportExecutionProtocols": false,
"reportRootUID": "itb-TT-8161"
},
"outputPath": "report.zip"
}
},
{
"type": "ImportExecutionResults",
"parameters": {
"inputPath": "report.zip",
"cycleKey": "8689450",
"reportRootUID": "ROOT",
"defaultTester": false,
"filters": [],
"importConfig": {
"ignoreNonExecutedTestCases": true,
"checkPaths": true,
"discardTesterInformation": true,
"useExistingDefect": true,
"filters": []
}
}
}
]
}
]
}
可选参数
待办事项
您可以使用 testbench-cli-reporter --help
命令访问可选参数列表。
usage: testbench-cli-reporter [-h] [-c CONFIG] [-s SERVER] [--login LOGIN] [--password PASSWORD] [-p PROJECT]
[-v VERSION] [-y CYCLE] [-u UID] [-t {e,i}]
[path]
positional arguments:
path Input- and Output-Path for xml reports <OPTIONAL, Default = report.zip>.
optional arguments:
-h, --help show this help message and exit
-c CONFIG, --config CONFIG
Path to a config json file to execute pre-set actions based on the given configuration.
-s SERVER, --server SERVER
TestBench Server address (hostname:port).
--login LOGIN Users Login.
--password PASSWORD Users Password.
-p PROJECT, --project PROJECT
Project name to be exported <OPTIONAL if --type is 'i'>.
-v VERSION, --version VERSION
Test Object Version name to be exported <OPTIONAL if --type is 'i'>.
-y CYCLE, --cycle CYCLE
Test Cycle name to be exported <OPTIONAL>
-u UID, --uid UID Root UID to be exported <OPTIONAL, Default = ROOT>
-t {e,i}, --type {e,i}
'e' for Export <default>, 'i' for Import
项目详情
下载文件
下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。
源代码分布
构建版本
testbench-cli-reporter-1.2.4.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 8c6db54f4b5a7b909e7598574fc9dadee84caf303f8f2b04c6dd5d3c38ad3243 |
|
MD5 | 0962ae676c98ad179ee879093fc657e8 |
|
BLAKE2b-256 | 4a6cee53ca5a2c13cbf7ae682d171612e4fba0dd9b03a396e75266caebb27cb0 |
testbench_cli_reporter-1.2.4-py3-none-any.whl的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 91399cacd6f219a45927f38cead1d3e0754a59e14b509d5ecf790f969d12fea5 |
|
MD5 | 36635ca2e8ad5f584aa83da6a2bdbdd4 |
|
BLAKE2b-256 | 6b6cc2f18129b62f396894f579ee3a2b4da726183d63c9d8a3e44ac9c5036c1e |