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
c643af63
Commit
c643af63
authored
May 28, 2021
by
fanxun
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
1415c1d3
62d46d13
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
10 deletions
+16
-10
common/tools.py
+7
-1
test_case/bmc/test_ ElectronicLicense.py
+8
-8
test_case/bmc/test_vehicle_steward.py
+1
-1
test_case_data/bmc/bmc_ele_License_2021513.xlsx
+0
-0
No files found.
common/tools.py
View file @
c643af63
...
...
@@ -2,7 +2,7 @@
import
json
import
logging
import
requests
import
requests
,
allure
from
config
import
*
...
...
@@ -19,11 +19,17 @@ def request_main(url, headers, method, data, has_token=False):
try
:
if
method
.
upper
()
==
"GET"
:
allure
.
attach
(
f
"{headers}"
,
"请求头"
,
allure
.
attachment_type
.
TEXT
)
allure
.
attach
(
f
"{data}"
,
"请求参数"
,
allure
.
attachment_type
.
TEXT
)
inner_res
=
requests
.
get
(
url
=
url
,
headers
=
headers
,
params
=
data
)
elif
method
.
upper
()
==
"POST"
:
if
header_content_type
==
"application/json"
:
allure
.
attach
(
f
"{headers}"
,
"请求头"
,
allure
.
attachment_type
.
TEXT
)
allure
.
attach
(
f
"{data}"
,
"请求参数"
,
allure
.
attachment_type
.
TEXT
)
inner_res
=
requests
.
post
(
url
=
url
,
headers
=
headers
,
json
=
data
)
elif
header_content_type
in
[
"application/x-www-form-urlencoded"
]:
allure
.
attach
(
f
"{headers}"
,
"请求头"
,
allure
.
attachment_type
.
TEXT
)
allure
.
attach
(
f
"{data}"
,
"请求参数"
,
allure
.
attachment_type
.
TEXT
)
inner_res
=
requests
.
post
(
url
=
url
,
headers
=
headers
,
data
=
data
)
return
inner_res
except
Exception
as
e
:
...
...
test_case/bmc/test_ ElectronicLicense.py
View file @
c643af63
...
...
@@ -70,7 +70,7 @@ class TestDrivingLicense():
headers
=
inData
[
'headers'
]
"""请求"""
res
=
request_main
(
url
,
headers
,
method
,
req_data
)
allure
.
attach
(
"{0}"
.
format
(
res
),
"用例结果"
)
allure
.
attach
(
f
"{res}"
,
"响应结果"
,
allure
.
attachment_type
.
TEXT
)
assert
res
[
'code'
]
==
expectData
[
'code'
]
@allure.story
(
"获取驾驶证图片状态"
)
...
...
@@ -86,7 +86,7 @@ class TestDrivingLicense():
headers
=
inData
[
'headers'
]
"""请求"""
res
=
request_main
(
url
,
headers
,
method
,
req_data
)
allure
.
attach
(
"{0}"
.
format
(
res
),
"用例结果"
)
allure
.
attach
(
f
"{res}"
,
"响应结果"
,
allure
.
attachment_type
.
TEXT
)
assert
res
[
'code'
]
==
expectData
[
'code'
]
@pytest.mark.usefixtures
(
"imaAuditStatus"
)
...
...
@@ -103,7 +103,7 @@ class TestDrivingLicense():
headers
=
inData
[
'headers'
]
"""请求"""
res
=
request_main
(
url
,
headers
,
method
,
req_data
)
allure
.
attach
(
"{0}"
.
format
(
res
),
"用例结果"
)
allure
.
attach
(
f
"{res}"
,
"响应结果"
,
allure
.
attachment_type
.
TEXT
)
assert
res
[
'code'
]
==
expectData
[
'code'
]
@allure.story
(
"图像上传页文案"
)
...
...
@@ -119,7 +119,7 @@ class TestDrivingLicense():
headers
=
inData
[
'headers'
]
"""请求"""
res
=
request_main
(
url
,
headers
,
method
,
req_data
)
allure
.
attach
(
"{0}"
.
format
(
res
),
"用例结果"
)
allure
.
attach
(
f
"{res}"
,
"响应结果"
,
allure
.
attachment_type
.
TEXT
)
assert
res
[
'code'
]
==
expectData
[
'code'
]
...
...
@@ -137,7 +137,7 @@ class TestDrivingLicense():
headers
=
inData
[
'headers'
]
"""请求"""
res
=
request_main
(
url
,
headers
,
method
,
req_data
)
allure
.
attach
(
"{0}"
.
format
(
res
),
"用例结果"
)
allure
.
attach
(
f
"{res}"
,
"响应结果"
,
allure
.
attachment_type
.
TEXT
)
assert
res
[
'code'
]
==
expectData
[
'code'
]
...
...
@@ -154,7 +154,7 @@ class TestDrivingLicense():
headers
=
inData
[
'headers'
]
"""请求"""
res
=
request_main
(
url
,
headers
,
method
,
req_data
)
allure
.
attach
(
"{0}"
.
format
(
res
),
"用例结果"
)
allure
.
attach
(
f
"{res}"
,
"响应结果"
,
allure
.
attachment_type
.
TEXT
)
assert
res
[
'code'
]
==
expectData
[
'code'
]
@allure.story
(
"驾驶证图片接口"
)
...
...
@@ -188,7 +188,7 @@ class TestDrivingLicense():
headers
=
inData
[
'headers'
]
"""请求"""
res
=
request_main
(
url
,
headers
,
method
,
req_data
)
allure
.
attach
(
"{0}"
.
format
(
res
),
"用例结果"
)
allure
.
attach
(
f
"{res}"
,
"响应结果"
,
allure
.
attachment_type
.
TEXT
)
assert
res
[
'code'
]
==
expectData
[
'code'
]
...
...
@@ -215,7 +215,7 @@ class TestDrivingLicense():
"""请求"""
res
=
request_main
(
url
,
headers
,
method
,
req_data
,
has_token
=
True
)
allure
.
attach
(
"{0}"
.
format
(
res
),
"用例结果"
)
allure
.
attach
(
f
"{res}"
,
"响应结果"
,
allure
.
attachment_type
.
TEXT
)
assert
res
[
'code'
]
==
expectData
[
'code'
]
"""把其他某个用例做为初始化,这种方式还需讨论,暂时不行"""
...
...
test_case/bmc/test_vehicle_steward.py
View file @
c643af63
...
...
@@ -517,7 +517,7 @@ class TestViolationWarn():
allure
.
attach
(
"{0}"
.
format
(
res
),
"用例结果"
)
assert
res
[
'code'
]
==
expectData
[
'code'
]
@allure.story
(
"油耗记录列表"
)
@allure.link
(
"http://yapi.hikcreate.com/project/31/interface/api/78646"
)
@allure.description
(
"/vehicle/steward/petrol/consumption/list"
)
...
...
test_case_data/bmc/bmc_ele_License_2021513.xlsx
View file @
c643af63
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