From 70f800d11f60e26df2e7851107c42b8010f863b5 Mon Sep 17 00:00:00 2001 From: floraachy <1622042529@qq.com> Date: Fri, 22 Mar 2024 15:09:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=20-=20inte?= =?UTF-8?q?rview=5Fjw451UwT/login=5Fdemo.yaml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- interview_jw451UwT/login_demo.yaml | 93 ++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 interview_jw451UwT/login_demo.yaml diff --git a/interview_jw451UwT/login_demo.yaml b/interview_jw451UwT/login_demo.yaml new file mode 100644 index 0000000..418828d --- /dev/null +++ b/interview_jw451UwT/login_demo.yaml @@ -0,0 +1,93 @@ +# 公共参数 +case_common: + allure_epic: GitLink接口(手动编写用例) # 敏捷里面的概念,定义史诗,相当于module级的标签, 往下是 feature + allure_feature: 登录模块 # 功能点的描述,相当于class级的标签, 理解成模块往下是 story + allure_story: 登录接口 # 故事,可以理解为场景,相当于method级的标签, 往下是 title + case_markers: # pytest框架的标记 pytest.mark. + - glcc: glcc相关的接口 + - get_project + - skip: 跳过执行该用例 + +# 用例数据 +case_info: +- + id: case_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": "${login}","password": "${password}","autologin": 1 } + files: + extract: + nickname: $.username + login: $.login + user_id: $.user_id + assert_response: + eq: + http_code: 200 + $.user_id: ${user_id} + in: + $.login: ${login} + gt: + $.user_id: 84955 + lt: + $.user_id: 84953 + not: + $.user_id: 85390 + assert_sql: + +- + id: case_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": "${login}","password": "${password}","autologin": 1 } + files: + extract: + nickname: $.username + login: $.login + user_id: $.user_id + assert_response: + eq: + http_code: 200 + $.user_id: ${user_id} + in: + $.login: ${login} + gt: + $.user_id: 84955 + lt: + $.user_id: 84953 + not: + $.user_id: 85390 + assert_sql: + eq: + sql: select count(*) from tokens where user_id=${user_id}; + len: 1 + +- + id: case_login_03 + title: 用户名正确,密码错误,登录失败 + severity: critical + run: False + url: /api/accounts/login.json + method: POST + headers: {"Content-Type": "application/json; charset=utf-8;"} + cookies: + request_type: json + payload: { "login": "chytest10","password": "password111","autologin": 1 } + files: + extract: + assert_response: + eq: + http_code: 200 + $.status: -2 + assert_sql: