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
57bf1f3f
Commit
57bf1f3f
authored
Jul 28, 2021
by
taoke
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
aa3d0a55
f66b6c94
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
1 deletions
+56
-1
config.py
+2
-1
test_case/bmy/test_console.py
+53
-0
test_case/bmy/test_riskMonitar.py
+1
-0
test_case_data/bmy/bmy_case.xlsx
+0
-0
No files found.
config.py
View file @
57bf1f3f
...
...
@@ -6,7 +6,7 @@ class BaseConfig():
# 请求头
headers
=
{
'Content-Type'
:
'application/json'
}
# 当前运行的产品名 #auto
current_name
=
"bm
c
"
current_name
=
"bm
y
"
test_case_dir
=
"test_case/"
secs
=
0.1
# 测试用例间隔运行时间
...
...
@@ -116,6 +116,7 @@ class BmyConfig(BaseConfig):
test_name_password
=
{
"username"
:
"15151500000"
,
"password"
:
"bmy123456"
,
"Register-Origin"
:
"yun"
}
# 企业云接口的Authorization
bmy_token
=
''
headers
=
{
"Content-Type"
:
"application/json"
}
...
...
test_case/bmy/test_console.py
0 → 100644
View file @
57bf1f3f
import
pytest
,
allure
,
xlrd
,
requests
,
os
from
config
import
BmyConfig
from
common.utils.getExcelData
import
get_excelData
from
common.tools
import
request_main
# @allure.epic("控制台111")
@allure.feature
(
"控制台"
)
class
Test_console
:
#引用测试用例表单
workBook
=
xlrd
.
open_workbook
(
f
'{BmyConfig.root_path}/test_case_data/bmy/bmy_case.xlsx'
)
"""接口1"""
@allure.story
(
"我的应用"
)
# 接口
@allure.title
(
"{inData[testPoint]}"
)
# 测试点
@pytest.mark.parametrize
(
"inData"
,
get_excelData
(
workBook
,
'控制台'
,
'UserApplication'
))
#[{},{},{}]
def
test_application
(
self
,
inData
):
url
=
f
"{BmyConfig().test_host}{inData['url']}"
headers
=
inData
[
'headers'
]
method
=
inData
[
'method'
]
data
=
inData
[
'reqData'
]
expectData
=
inData
[
'expectData'
]
res
=
request_main
(
url
,
headers
,
method
,
data
)
# print("-------------------",res)
assert
res
[
'code'
]
==
expectData
[
'code'
]
"""接口2"""
@allure.story
(
"应用中心"
)
# 接口
@allure.title
(
"查看应用中心"
)
@pytest.mark.parametrize
(
"inData"
,
get_excelData
(
workBook
,
'控制台'
,
'ApplicationCenter'
))
# [{},{},{}]
def
test_applicationcenter
(
self
,
inData
):
url
=
f
"{BmyConfig().test_host}{inData['url']}"
headers
=
inData
[
'headers'
]
method
=
inData
[
'method'
]
data
=
inData
[
'reqData'
]
expectData
=
inData
[
'expectData'
]
res
=
request_main
(
url
,
headers
,
method
,
data
)
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}'
)
pytest
.
main
([
'test_console.py'
,
'-s'
,
'--alluredir'
,
'../../report/tmp'
])
# # 启动默认浏览器打开报告
os
.
system
(
'allure serve ../../report/tmp'
)
test_case/bmy/test_riskMonitar.py
View file @
57bf1f3f
...
...
@@ -32,6 +32,7 @@ class TestMonitor():
"""请求"""
res
=
request_main
(
url
,
headers
,
method
,
req_data
)
allure
.
attach
(
f
"{res}"
,
"响应结果"
,
allure
.
attachment_type
.
TEXT
)
"""断言"""
assert
res
[
'code'
]
==
expectData
[
'code'
]
...
...
test_case_data/bmy/bmy_case.xlsx
View file @
57bf1f3f
No preview for this file type
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