autotest08/demo_test_new_project.yaml

145 lines
3.8 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 公共参数
case_common:
allure_epic: GitLink接口自动生成用例 # 敏捷里面的概念定义史诗相当于module级的标签, 往下是 feature
allure_feature: 开源项目模块 # 功能点的描述相当于class级的标签, 理解成模块往下是 story
allure_story: 新建项目接口 # 故事可以理解为场景相当于method级的标签, 往下是 title
case_markers:
- gitlink
- new_project
- usefixtures: login_init
# 用例数据
case_info:
-
id: case_new_project_01
title: 正确输入各项必填参数,新建项目成功(不校验数据库, header里面传cookies
severity: critical
run: True
url: /api/projects.json
method: POST
headers:
Content-Type: application/json; charset=utf-8;
cookies: ${login_cookie}
cookies:
request_type: json
payload:
"user_id": ${user_id}
"name": ${generate_name(len='zh')}
"repository_name": ${generate_identifier()}
files:
extract:
project_id: $.id
project_name: $.name
project_identifier: $.identifier
assert_response:
eq:
http_code: 200
$.login: ${login}
assert_sql:
-
id: case_new_project_02
title: 正确输入各项必填参数新建项目成功不校验数据库单独传cookies
run: True
url: /api/projects.json
method: POST
headers:
Content-Type: application/json; charset=utf-8;
cookies: ${login_cookie}
request_type: json
payload:
"user_id": ${user_id}
"name": ${generate_name(generate_name(len="zh"))}
"repository_name": ${generate_identifier()}
files:
extract:
project_id: $.id
project_name: $.name
project_identifier: $.identifier
assert_response:
eq:
http_code: 200
$.login: ${login}
assert_sql:
-
id: case_new_project_03
title: 正确输入各项必填参数,新建项目成功(校验数据库)
severity: normal
run: False
url: /api/projects.json
method: POST
headers: {"Content-Type": "application/json; charset=utf-8;"}
cookies:
request_type: json
payload:
"user_id": ${user_id}
"name": ${generate_name()}
"repository_name": ${generate_identifier()}
files:
extract:
project_id: $.id
project_name: $.name
project_identifier: $.identifier
assert_response:
eq:
http_code: 200
$.login: ${login}
assert_sql:
eq:
sql: select id,`name`, identifier from projects where user_id=${user_id} ORDER BY created_on DESC;
$.id: ${project_id}
$.name: ${project_name}
$.identifier: ${project_identifier}
-
id: case_new_project_04
title: 正确输入各项必填参数新建项目成功04
severity: normal
run: False
url: /api/projects.json
method: POST
headers:
Content-Type: application/json; charset=utf-8;
cookies: ${login_cookie}
request_type: json
payload:
"user_id": ${user_id}
"name": ${faker.name()}
"repository_name": ${generate_identifier()}
files:
extract:
project_id: $.id
project_name: $.name
project_identifier: $.identifier
assert_response:
eq:
http_code: 200
$.login: ${login}
assert_sql:
-
id: case_new_project_05
title: 正确输入各项必填参数新建项目成功05
severity: normal
run: False
url: /api/projects.json
method: POST
headers:
Content-Type: application/json; charset=utf-8;
cookies: ${login_cookie}
request_type: json
payload:
"user_id": ${user_id}
"name": ${fk_zh.name()}
"repository_name": ${generate_identifier()}
files:
extract:
project_id: $.id
project_name: $.name
project_identifier: $.identifier
assert_response:
eq:
http_code: 200
$.login: ${login}
assert_sql: