更新用例文件,封装的方法,新增dockerfile
This commit is contained in:
@@ -1,70 +0,0 @@
|
||||
# 公共参数
|
||||
case_common:
|
||||
allure_epic: GitLink接口
|
||||
allure_feature: 用户模块
|
||||
allure_story: 登录接口
|
||||
case_markers:
|
||||
- gitlink
|
||||
- login: 登录接口
|
||||
|
||||
# 用例数据
|
||||
case_info:
|
||||
-
|
||||
id: gitlink_login_oauth_token_01
|
||||
title: 用户登录(密码模式)
|
||||
run: True
|
||||
severity: normal
|
||||
url: /oauth/token
|
||||
method: POST
|
||||
headers:
|
||||
Content-Type: application/json; charset=utf-8;
|
||||
cookies:
|
||||
request_type: json
|
||||
payload:
|
||||
grant_type: password
|
||||
username: ${env_login}
|
||||
password: ${env_password}
|
||||
client_id: ${client_id}
|
||||
client_secret: ${client_secret}
|
||||
files:
|
||||
assert_response:
|
||||
status_code: 200
|
||||
access_token_in_response:
|
||||
message: 断言接口返回中存在access_token字段
|
||||
expect_value: access_token
|
||||
assert_type: contains
|
||||
assert_sql:
|
||||
extract:
|
||||
type_jsonpath:
|
||||
access_token: $.access_token
|
||||
token_type: $.token_type
|
||||
token_expires_in: $.expires_in
|
||||
|
||||
-
|
||||
id: gitlink_login_oauth_token_02
|
||||
title: 用户登录(客户端模式) # 这种登录方式,适用于一个application,没有账号密码的情况
|
||||
run: True
|
||||
severity: normal
|
||||
url: /oauth/token
|
||||
method: POST
|
||||
headers:
|
||||
Content-Type: application/json; charset=utf-8;
|
||||
cookies:
|
||||
request_type: json
|
||||
payload:
|
||||
grant_type: client_credentials
|
||||
client_id: ${client_id}
|
||||
client_secret: ${client_secret}
|
||||
files:
|
||||
assert_response:
|
||||
status_code: 200
|
||||
access_token_in_response:
|
||||
message: 断言接口返回中存在access_token字段
|
||||
expect_value: access_token
|
||||
assert_type: contains
|
||||
assert_sql:
|
||||
extract:
|
||||
type_jsonpath:
|
||||
access_token: $.access_token
|
||||
token_type: $.token_type
|
||||
token_expires_in: $.expires_in
|
||||
@@ -1,151 +0,0 @@
|
||||
# 公共参数
|
||||
case_common:
|
||||
allure_epic: GitLink接口 # 敏捷里面的概念,定义史诗,相当于module级的标签, 往下是 feature
|
||||
allure_feature: 用户模块 # 功能点的描述,相当于class级的标签, 理解成模块往下是 story
|
||||
allure_story: 登录接口 # 故事,可以理解为场景,相当于method级的标签, 往下是 title
|
||||
case_markers: # pytest框架的标记 pytest.mark.
|
||||
- gitlink
|
||||
- smoke
|
||||
- login: 登录接口
|
||||
|
||||
# 用例数据
|
||||
case_info:
|
||||
-
|
||||
id: gitlink_login_01
|
||||
title: 用户名密码正确,登录成功(不校验数据库)
|
||||
run: True
|
||||
severity: normal
|
||||
url: /api/accounts/login.json
|
||||
method: POST
|
||||
headers:
|
||||
Content-Type: application/json; charset=utf-8;
|
||||
cookies:
|
||||
request_type: json
|
||||
payload:
|
||||
login: ${env_login}
|
||||
password: ${aes_encrypt_data('${env_password}','${ace_key}')}
|
||||
autologin: 1
|
||||
files:
|
||||
assert_response:
|
||||
status_code: 200
|
||||
assertLogin:
|
||||
message: 断言接口返回的login
|
||||
expect_value: ${env_login}
|
||||
assert_type: ==
|
||||
type_jsonpath: $.login
|
||||
assert_sql:
|
||||
extract:
|
||||
type_re:
|
||||
nickname: \"username":"(.*?)"
|
||||
login: \"login":"(.*?)"
|
||||
user_id: \"user_id":(.*?),
|
||||
type_response:
|
||||
cookies: response.cookies
|
||||
|
||||
-
|
||||
id: gitlink_login_02
|
||||
title: 用户名密码正确,登录成功(校验数据库)
|
||||
run: false
|
||||
severity: minor
|
||||
url: /api/accounts/login.json
|
||||
method: POST
|
||||
headers:
|
||||
Content-Type: application/json; charset=utf-8;
|
||||
cookies:
|
||||
request_type: json
|
||||
payload:
|
||||
login: ${env_login}
|
||||
password: ${aes_encrypt_data('${env_password}','${ace_key}')}
|
||||
autologin: 1
|
||||
files:
|
||||
assert_response:
|
||||
status_code: 200
|
||||
user_id:
|
||||
expect_value: ${user_id}
|
||||
assert_type: ==
|
||||
type_jsonpath: $.user_id
|
||||
login:
|
||||
message: 断言接口返回的login
|
||||
expect_value: ${env_login}
|
||||
assert_type: ==
|
||||
type_jsonpath: $.login
|
||||
assert_sql:
|
||||
contains_user:
|
||||
message: 断言数据库:查询tokens表,表中存在该登录用户记录;预期查询结果的长度为1
|
||||
sql: select * from tokens where user_id=${user_id};
|
||||
expect_value: 1
|
||||
assert_type: len_eq
|
||||
contains_user2:
|
||||
message: 断言数据库:查询tokens表,表中存在该登录用户记录;预期 ${user_id} in 查询结果(jsonpath式匹配后的结果)
|
||||
sql: select * from tokens where user_id=${user_id};
|
||||
type_jsonpath: $..user_id
|
||||
expect_value: ${env_user_id}
|
||||
assert_type: ==
|
||||
contains_user3:
|
||||
message: 断言数据库:查询tokens表,表中存在该登录用户记录;预期 ${user_id} in 查询结果(正则表达式匹配后的结果)
|
||||
sql: select * from tokens;
|
||||
type_re: "'user_id': (.*?),"
|
||||
expect_value: ${user_id}
|
||||
assert_type: contains
|
||||
extract:
|
||||
type_jsonpath:
|
||||
nickname: $.username
|
||||
login: $.login
|
||||
user_id: $.user_id
|
||||
|
||||
-
|
||||
id: gitlink_login_03
|
||||
title: 用户名正确,密码错误,登录失败
|
||||
severity: critical
|
||||
run: true
|
||||
url: /api/accounts/login.json
|
||||
method: POST
|
||||
headers:
|
||||
Content-Type: application/json; charset=utf-8;
|
||||
cookies:
|
||||
request_type: json
|
||||
payload:
|
||||
login: ${env_login}
|
||||
password: 12345678900
|
||||
autologin: 1
|
||||
files:
|
||||
assert_response:
|
||||
status_code: 200
|
||||
user_id:
|
||||
message: 断言接口返回的status
|
||||
expect_value: -1
|
||||
assert_type: ==
|
||||
type_jsonpath: $.status
|
||||
assert_sql:
|
||||
extract:
|
||||
|
||||
-
|
||||
id: gitlink_super_login_04
|
||||
title: 用户名密码正确,登录成功(管理员登录)
|
||||
run: False
|
||||
severity: normal
|
||||
url: /api/accounts/login.json
|
||||
method: POST
|
||||
headers:
|
||||
Content-Type: application/json; charset=utf-8;
|
||||
cookies:
|
||||
request_type: json
|
||||
payload:
|
||||
login: ${env_super_login}
|
||||
password: ${aes_encrypt_data('${env_super_password}','${ace_key}')}
|
||||
autologin: 1
|
||||
files:
|
||||
assert_response:
|
||||
status_code: 200
|
||||
assertLogin:
|
||||
message: 断言接口返回的login
|
||||
expect_value: ${env_super_login}
|
||||
assert_type: ==
|
||||
type_jsonpath: $.login
|
||||
assert_sql:
|
||||
extract:
|
||||
response:
|
||||
type_response:
|
||||
admin_cookies: response.cookies
|
||||
type_jsonpath:
|
||||
user_id: $.user_id
|
||||
Reference in New Issue
Block a user