Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
InterfaceAutoTest_test57
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
billchuan
InterfaceAutoTest_test57
Commits
55845ed0
Commit
55845ed0
authored
Nov 08, 2023
by
billchuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增一个用户的测试用例、测试数据
parent
7998a9e0
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
217 additions
and
0 deletions
+217
-0
InterfaceAutoTest_v3/data_config/wbl/InterfaceAutoTest.xlsx
+0
-0
InterfaceAutoTest_v3/data_config/wbl/case_data.json
+70
-0
InterfaceAutoTest_v3/data_config/wbl/expect_data.json
+54
-0
InterfaceAutoTest_v3/data_config/wbl/sql.json
+20
-0
InterfaceAutoTest_v3/test_case/test_wbl/__init__.py
+8
-0
InterfaceAutoTest_v3/test_case/test_wbl/conftest.py
+24
-0
InterfaceAutoTest_v3/test_case/test_wbl/test_bpm.py
+41
-0
No files found.
InterfaceAutoTest_v3/data_config/wbl/InterfaceAutoTest.xlsx
0 → 100644
View file @
55845ed0
File added
InterfaceAutoTest_v3/data_config/wbl/case_data.json
0 → 100644
View file @
55845ed0
{
"认证接口"
:
{
"登录系统"
:
{
"LoginSuccess"
:
{
"username"
:
"admin"
,
"password"
:
"MTIzNDU2"
},
"LoginErrorUsernameIsNone"
:
{
"username"
:
""
,
"password"
:
"MTIzNDU2"
},
"LoginErrorPasswordIsNone"
:
{
"username"
:
"admin"
,
"password"
:
""
},
"LoginErrorPasswordError"
:
{
"username"
:
"admin"
,
"password"
:
"MTIzNDU222"
}
}
},
"维度管理"
:
{
"添加维度"
:
{
"AddDemSuccess"
:
{
"code"
:
"wbl_test_dem"
,
"description"
:
"我的发测试维度"
,
"isDefault"
:
0
,
"name"
:
"我的发测试维度"
},
"AddDemErrorCodeIsNone"
:
{
"code"
:
""
,
"description"
:
"我的发测试维度"
,
"isDefault"
:
0
,
"name"
:
"我的发测试维度"
}
},
"根据维度编码获取维度信息"
:
{
"GetDemMessageSuccess"
:
{
"code"
:
"wbl_test_dem"
}
}
},
"组织管理"
:
{
"添加组织"
:
{
"AddOrgSuccess"
:
{
"code"
:
"wdf_test_org"
,
"demId"
:
"不知道"
,
"exceedLimitNum"
:
0
,
"grade"
:
""
,
"limitNum"
:
0
,
"name"
:
"我的发测试组织"
,
"nowNum"
:
0
,
"orderNo"
:
0
,
"parentId"
:
"0"
},
"AddOrgErrorCodeIsNone"
:
{
"code"
:
""
,
"demId"
:
"不知道"
,
"exceedLimitNum"
:
0
,
"grade"
:
""
,
"limitNum"
:
0
,
"name"
:
"我的发测试组织"
,
"nowNum"
:
0
,
"orderNo"
:
0
,
"parentId"
:
"0"
}
}
}
}
\ No newline at end of file
InterfaceAutoTest_v3/data_config/wbl/expect_data.json
0 → 100644
View file @
55845ed0
{
"认证接口"
:
{
"登录系统"
:
{
"LoginSuccess"
:
{
"username"
:
"超级管理"
,
"account"
:
"admin"
,
"loginStatus"
:
true
},
"LoginErrorUsernameIsNone"
:
{
"state"
:
false
,
"message"
:
"账号或密码错误"
},
"LoginErrorPasswordIsNone"
:
{
"state"
:
false
,
"message"
:
"账号或密码错误"
},
"LoginErrorPasswordError"
:
{
"state"
:
false
,
"message"
:
"账号或密码错误"
}
}
},
"维度管理"
:
{
"添加维度"
:
{
"AddDemSuccess"
:
{
"state"
:
true
,
"message"
:
"添加维度成功!"
},
"AddDemErrorCodeIsNone"
:
{
"state"
:
false
,
"message"
:
"添加维度信息失败,维度编码【code】必填!"
}
},
"根据维度编码获取维度信息"
:
{
"GetDemMessageSuccess"
:
{
"demCode"
:
"wbl_test_dem"
,
"name"
:
"我的发测试维度"
}
}
},
"组织管理"
:
{
"添加组织"
:
{
"AddOrgSuccess"
:
{
"state"
:
true
,
"message"
:
"添加组织成功!"
},
"AddOrgErrorCodeIsNone"
:
{
"state"
:
false
,
"message"
:
"添加组织失败,组织编码【code】不能为空!"
}
}
}
}
\ No newline at end of file
InterfaceAutoTest_v3/data_config/wbl/sql.json
0 → 100644
View file @
55845ed0
{
"维度管理"
:
{
"添加维度"
:
{
"AddDemSuccess"
:
"DELETE FROM uc_demension WHERE `CODE_`=
\"
wbl_test_dem
\"
;"
}
},
"组织管理"
:
{
"添加组织"
:
{
"AddOrgSuccess"
:
{
"select"
:
"SELECT ID_ from uc_demension WHERE `CODE_`=
\"
wbl_test_dem
\"
;"
,
"delete"
:
"DELETE FROM uc_org WHERE `CODE_`=
\"
wbl_test_org
\"
;"
},
"AddOrgErrorCodeIsNone"
:
{
"select"
:
"SELECT ID_ from uc_demension WHERE `CODE_`=
\"
wbl_test_dem
\"
;"
,
"delete"
:
"DELETE FROM uc_org WHERE `CODE_`=
\"
wdf_test_org1
\"
;"
}
}
}
}
\ No newline at end of file
InterfaceAutoTest_v3/test_case/test_wbl/__init__.py
0 → 100644
View file @
55845ed0
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: pythonProject
# FileName: __init__.py
# Author: xxxxxxx
# Datetime: 2023/11/4 15:37
# Description:
# ---------------------------------------------------------------------------
InterfaceAutoTest_v3/test_case/test_wbl/conftest.py
0 → 100644
View file @
55845ed0
import
pytest
from
InterfaceAutoTest_V1.common.db
import
DB
from
InterfaceAutoTest_V1.requests_method.requests_all
import
RequestsAll
@pytest.fixture
(
scope
=
'session'
)
def
req_fix
():
req
=
RequestsAll
()
yield
req
@pytest.fixture
(
scope
=
'session'
)
def
db_fix
():
db
=
DB
()
yield
db
db
.
close
()
# def pytest_collection_modifyitems(items):
# # item表示每个测试用例,解决用例名称中文显示问题
# for item in items:
# item.name = item.name.encode("utf-8").decode("unicode-escape")
# item._nodeid = item._nodeid.encode("utf-8").decode("unicode-escape")
InterfaceAutoTest_v3/test_case/test_wbl/test_bpm.py
0 → 100644
View file @
55845ed0
import
allure
import
pytest
from
InterfaceAutoTest_v3.common
import
log
from
InterfaceAutoTest_v3.common.read_excel
import
ReadExcel
class
TestBpm
:
@allure.epic
(
'BPM系统测试-王菠萝'
)
@pytest.mark.parametrize
(
'module_name,api_name,case_title,case_level,case_url, case_method, case_mime, case_data, expect_data,'
' sql_type,sql_data, update_key'
,
ReadExcel
(
"BPM-wbl"
,
"wbl/InterfaceAutoTest.xlsx"
,
"wbl/case_data.json"
,
"wbl/expect_data.json"
,
"wbl/sql_data.json"
)
.
get_data
())
def
test_bpm
(
self
,
db_fix
,
req_fix
,
module_name
,
api_name
,
case_title
,
case_level
,
case_url
,
case_method
,
case_mime
,
case_data
,
expect_data
,
sql_type
,
sql_data
,
update_key
):
allure
.
dynamic
.
feature
(
module_name
)
allure
.
dynamic
.
story
(
api_name
)
allure
.
dynamic
.
title
(
case_title
)
allure
.
dynamic
.
severity
(
case_level
)
if
sql_type
==
'delete'
:
db_fix
.
delete
(
sql_data
)
elif
sql_type
==
'select'
:
case_data
[
update_key
]
=
db_fix
.
query
(
sql_data
)
elif
sql_type
==
'select|delete'
or
sql_type
==
'delete|select'
:
db_fix
.
delete
(
sql_data
[
'delete'
])
case_data
[
update_key
]
=
db_fix
.
query
(
sql_data
[
'select'
])
res
=
req_fix
.
requests_all
(
req_method
=
case_method
,
req_url
=
case_url
,
req_mime
=
case_mime
,
case_data
=
case_data
)
try
:
for
key
in
expect_data
:
assert
expect_data
[
key
]
==
res
.
json
()[
key
]
print
(
'断言成功!!!'
)
except
:
log
.
error
(
"断言失败"
+
",用例数据为:"
+
str
(
case_data
)
+
",期望数据为:"
+
str
(
expect_data
)
+
",服务器返回的数据为:"
+
res
.
text
)
raise
AssertionError
(
'断言失败!!!'
)
if
__name__
==
'__main__'
:
pytest
.
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment