TDL(Tests Description Language )
基于JSON的测试描述语言, 用于描述测试用例、测试套件、测试报告等相关实体及属性
测试用例描述
- name: 用例名称(string类型)- 必填
- description: 用例描述(string类型)
- priority: 优先级(integer类型)
- tags: 用例标签列表(array类型)
- timeout: 超时时间,单位秒(interger / float类型)
- setup:测试准备操作(array类型)
- teardown: 测试清理操作(array类型)
- steps: 测试步骤(array类型)
示例1-接口自动化测试
{
"name": "test_api_demo",
"description": "test description",
"priority": 1,
"tags": ["http", "api-test"],
"timeout": 100,
"setup": [
{"method": "Http.Get", "args": {"url": "/get","params": {"a": 1, "b": 2, "c": 3}}}
],
"teardown": [
{"method": "Http.Get", "args": {"url": "/get","params": {"a": 1, "b": 2, "c": 3}}}
],
"steps": [
{"method": "Http.Get", "args": {"url": "/get","params": {"a": 1, "b": 2, "c": 3}}},
{"method": "Http.Post", "args": {"url": "/post", "json": {"name": "Kevin"}}},
{"method": "Http.Get", "args": {"url": "/get", "params": {"a": 1, "b": 2, "c": 3}},
"store": {"url": "$.url"}, "excepted": {"eq": ["$url", "/get"]}}
]
}
示例2-UI自动化测试
{
"name": "test_web_ui_demo",
"description": "test description",
"steps": [
{"method": "Page.Open", "args": ["https://www.baidu.com/"]},
{"method": "Page.InputTo", "args": ["id","kw", "helloworld"], "register": {"value1": "//[@id=\"kw\"]/@value"}},
{"method": "Page.Click", "args": ["id","su"]}
]
}
示例3-SSH操作
{
"name": "test_ssh_demo",
"description": "test description",
"steps": [
{"method": "SSH.Execute", "args": "echo hello"},
{"method": "SSH.GET", "args": ["/path/a.txt", "/local_path/a.txt"]}
]
}
示例4-MySQL操作
{
"name": "test_mysql_demo",
"description": "test description",
"steps": [
{"method": "MySQL.Query", "args": "SELECT * FROM `users`"},
{"method": "MySQL.Execute", "args": "INSERT INTO `users` (\"name\") VALUES(\"KEVIN\")"}
]
}
测试套件描述
测试环境描述
配置描述
测试报告描述
- title: 测试报告标题(string类型)- 必填
- description: 测试报告描述(string类型)
- summary:报告该要信息(object类型)
- details: 用例详细执行信息(array类型)
{
"title": "test_report",
"summary": {
"start_at": "2015-02-03 12:00:00.000",
"end_at": "2015-02-03 12:01:00.00",
"total": 12
},
"details": [
{}
]
}