Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
InterfaceAutoTest
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
TestAuto
InterfaceAutoTest
Commits
73d41119
Commit
73d41119
authored
3 years ago
by
xujianxue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
应用管理测试用例和应用管理测试数据
parent
4583beb4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
101 additions
and
5 deletions
+101
-5
test_case/bmy/test_ApplicationManagement.py
+101
-5
test_case_data/bmy/bmy_oms_ApplicationManagement_20210806.xlsx
+0
-0
No files found.
test_case/bmy/test_ApplicationManagement.py
View file @
73d41119
...
...
@@ -2,10 +2,43 @@ import pytest,allure,xlrd,requests,os
from
common.utils.getExcelData
import
get_excelData
from
service.login
import
BMY
from
common.tools
import
request_main
from
common.db
import
RedisString
,
MYSQL
from
config
import
BmyomsConfig
from
service.login
import
BMY
@pytest.fixture
(
scope
=
'function'
)
def
application_del
():
# 删除应用
# mysql=BaseConfig.test_mysql_215
# mysql = MYSQL(*mysql)
mysql
=
MYSQL
(
host
=
"10.197.236.190"
,
port
=
3306
,
user
=
"root"
,
pwd
=
"123456"
,
db
=
"hzcp"
)
# mysql = MYSQL("10.197.236.215", 3306, "root", "DataCenter@!hik", "edl_public")
mysql
.
ExecuNonQuery
(
"DELETE FROM hzcp.application_info WHERE name ='卖保险的文子';"
)
# 删除应用
# RedisString(0).delete_key("bmc:c1:dl_img:uid") # 清除 Redis缓存
yield
@pytest.fixture
(
scope
=
'function'
)
def
applicationa_del
():
# 删除应用
# mysql=BaseConfig.test_mysql_215
# mysql = MYSQL(*mysql)
mysql
=
MYSQL
(
host
=
"10.197.236.190"
,
port
=
3306
,
user
=
"root"
,
pwd
=
"123456"
,
db
=
"hzcp"
)
# mysql = MYSQL("10.197.236.215", 3306, "root", "DataCenter@!hik", "edl_public")
mysql
.
ExecuNonQuery
(
"DELETE FROM hzcp.application_info WHERE name ='网约车app';"
)
# 删除应用
# RedisString(0).delete_key("bmc:c1:dl_img:uid") # 清除 Redis缓存
yield
@pytest.fixture
(
scope
=
'function'
)
def
applicationcopy_del
():
# 删除应用
# mysql=BaseConfig.test_mysql_215
# mysql = MYSQL(*mysql)
mysql
=
MYSQL
(
host
=
"10.197.236.190"
,
port
=
3306
,
user
=
"root"
,
pwd
=
"123456"
,
db
=
"hzcp"
)
# mysql = MYSQL("10.197.236.215", 3306, "root", "DataCenter@!hik", "edl_public")
mysql
.
ExecuNonQuery
(
"DELETE FROM hzcp.application_info WHERE name='复制 卖保险的文子';"
)
# 删除复制的应用
yield
#@allure.epic("斑马企业云oms")
@allure.feature
(
"应用管理"
)
class
TestApplicationManagement
():
...
...
@@ -13,10 +46,10 @@ class TestApplicationManagement():
@allure.story
(
"查询应用"
)
@allure.title
(
"{inData[testPoint]}"
)
@allure.testcase
(
"http://yapi.hikcreate.com/project/364/interface/api/
cat_1599
0"
)
@allure.testcase
(
"http://yapi.hikcreate.com/project/364/interface/api/
8340
0"
)
@allure.description
(
"查询应用信息"
)
@pytest.mark.parametrize
(
"inData"
,
get_excelData
(
workBook
,
'应用管理'
,
'ApplicationSearch'
))
def
test_
logrecord
(
self
,
inData
):
def
test_
ApplicationSearch
(
self
,
inData
):
url
=
f
"{BmyomsConfig().test_host}{inData['url']}"
headers
=
inData
[
'headers'
]
method
=
inData
[
'method'
]
...
...
@@ -26,23 +59,85 @@ class TestApplicationManagement():
allure
.
attach
(
f
"{res}"
,
"响应结果"
,
allure
.
attachment_type
.
TEXT
)
assert
res
[
'code'
]
==
expectData
[
'code'
]
@pytest.mark.usefixtures
(
"application_del"
)
@allure.story
(
"新增应用"
)
@allure.title
(
"{inData[testPoint]}"
)
@allure.testcase
(
"http://yapi.hikcreate.com/project/364/interface/api/
cat_1599
0"
)
@allure.description
(
"新增一个应用"
)
@allure.testcase
(
"http://yapi.hikcreate.com/project/364/interface/api/
8234
0"
)
@allure.description
(
"新增一个
政务
应用"
)
@pytest.mark.parametrize
(
"inData"
,
get_excelData
(
workBook
,
'应用管理'
,
'ApplicationNew'
))
def
test_logrecord
(
self
,
inData
):
def
test_ApplicationNew
(
self
,
inData
):
url
=
f
"{BmyomsConfig().test_host}{inData['url']}"
headers
=
inData
[
'headers'
]
method
=
inData
[
'method'
]
data
=
inData
[
'reqData'
]
expectData
=
inData
[
'expectData'
]
res
=
request_main
(
url
,
headers
,
method
,
data
)
allure
.
attach
(
f
"{res}"
,
"响应结果"
,
allure
.
attachment_type
.
TEXT
)
assert
res
[
'code'
]
==
expectData
[
'code'
]
@pytest.mark.usefixtures
(
"applicationa_del"
)
@allure.story
(
"新增应用"
)
@allure.title
(
"{inData[testPoint]}"
)
@allure.testcase
(
"http://yapi.hikcreate.com/project/364/interface/api/82340"
)
@allure.description
(
"新增一个app付费应用"
)
@pytest.mark.parametrize
(
"inData"
,
get_excelData
(
workBook
,
'应用管理'
,
'ApplicationNewa'
))
def
test_ApplicationNewa
(
self
,
inData
):
url
=
f
"{BmyomsConfig().test_host}{inData['url']}"
headers
=
inData
[
'headers'
]
method
=
inData
[
'method'
]
data
=
inData
[
'reqData'
]
expectData
=
inData
[
'expectData'
]
res
=
request_main
(
url
,
headers
,
method
,
data
)
allure
.
attach
(
f
"{res}"
,
"响应结果"
,
allure
.
attachment_type
.
TEXT
)
assert
res
[
'code'
]
==
expectData
[
'code'
]
@allure.story
(
"操作应用"
)
@allure.title
(
"{inData[testPoint]}"
)
@allure.testcase
(
"http://yapi.hikcreate.com/project/364/interface/api/82336"
)
@allure.description
(
"操作一个应用"
)
@pytest.mark.parametrize
(
"inData"
,
get_excelData
(
workBook
,
'应用管理'
,
'ApplicationOperation'
))
def
test_ApplicationOperation
(
self
,
inData
):
url
=
f
"{BmyomsConfig().test_host}{inData['url']}"
headers
=
inData
[
'headers'
]
method
=
inData
[
'method'
]
data
=
inData
[
'reqData'
]
if
data
[
'id'
]
==
'123'
:
idlist
=
[]
mysql
=
MYSQL
(
host
=
"10.197.236.190"
,
port
=
3306
,
user
=
"root"
,
pwd
=
"123456"
,
db
=
"hzcp"
)
# mysql = MYSQL("10.197.236.215", 3306, "root", "DataCenter@!hik", "edl_public")
idlist
=
mysql
.
ExecuQuery
(
"SELECT id FROM hzcp.application_info where name='卖保险的文子';"
)
data
=
idlist
[
0
]
expectData
=
inData
[
'expectData'
]
res
=
request_main
(
url
,
headers
,
method
,
data
)
allure
.
attach
(
f
"{res}"
,
"响应结果"
,
allure
.
attachment_type
.
TEXT
)
assert
res
[
'code'
]
==
expectData
[
'code'
]
@pytest.mark.usefixtures
(
"applicationcopy_del"
)
@allure.story
(
"复制应用"
)
@allure.title
(
"{inData[testPoint]}"
)
@allure.testcase
(
"http://yapi.hikcreate.com/project/364/interface/api/82332"
)
@allure.description
(
"复制一个应用"
)
@pytest.mark.parametrize
(
"inData"
,
get_excelData
(
workBook
,
'应用管理'
,
'ApplicationCopy'
))
def
test_ApplicationCopy
(
self
,
inData
):
url
=
f
"{BmyomsConfig().test_host}{inData['url']}"
headers
=
inData
[
'headers'
]
method
=
inData
[
'method'
]
data
=
inData
[
'reqData'
]
if
data
[
'id'
]
==
'123'
:
idlist
=
[]
mysql
=
MYSQL
(
host
=
"10.197.236.190"
,
port
=
3306
,
user
=
"root"
,
pwd
=
"123456"
,
db
=
"hzcp"
)
# mysql = MYSQL("10.197.236.215", 3306, "root", "DataCenter@!hik", "edl_public")
idlist
=
mysql
.
ExecuQuery
(
"SELECT id FROM hzcp.application_info where name='卖保险的文子';"
)
data
=
idlist
[
0
]
expectData
=
inData
[
'expectData'
]
res
=
request_main
(
url
,
headers
,
method
,
data
)
allure
.
attach
(
f
"{res}"
,
"响应结果"
,
allure
.
attachment_type
.
TEXT
)
assert
res
[
'code'
]
==
expectData
[
'code'
]
if
__name__
==
'__main__'
:
for
one
in
os
.
listdir
(
'../../report/tmp'
):
# 列出对应文件夹的数据
if
'json'
in
one
:
os
.
remove
(
f
'../../report/tmp/{one}'
)
...
...
@@ -50,3 +145,4 @@ if __name__ == '__main__':
# # 启动默认浏览器打开报告
os
.
system
(
'allure serve ../../report/tmp'
)
# print(1)
This diff is collapsed.
Click to expand it.
test_case_data/bmy/bmy_oms_ApplicationManagement_20210806.xlsx
View file @
73d41119
No preview for this file type
This diff is collapsed.
Click to expand it.
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