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
b7306d2e
Commit
b7306d2e
authored
May 22, 2021
by
huangchengcheng
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master' into master
parents
d6e5342b
8597e165
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
157 additions
and
2 deletions
+157
-2
test_case/bmc/conftest.py
+3
-0
test_case/bmc/test_vehicle_steward.py
+154
-2
test_case_data/bmc/bmc_vehicle_steward_40-58_20210513.xlsx
+0
-0
No files found.
test_case/bmc/conftest.py
View file @
b7306d2e
...
@@ -24,6 +24,9 @@ def bmc_login_fixture():
...
@@ -24,6 +24,9 @@ def bmc_login_fixture():
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
bmc_login_fixture
()
bmc_login_fixture
()
...
...
test_case/bmc/test_vehicle_steward.py
View file @
b7306d2e
...
@@ -2,10 +2,11 @@ __author__ = 'fanxun'
...
@@ -2,10 +2,11 @@ __author__ = 'fanxun'
__data__
=
"2021-05-18 14:41"
__data__
=
"2021-05-18 14:41"
import
allure
,
xlrd
,
pytest
,
os
import
allure
,
xlrd
,
pytest
,
os
from
config
import
BMCConfig
from
config
import
BMCConfig
,
BaseConfig
from
common.utils.getExcelData
import
get_excelData
from
common.utils.getExcelData
import
get_excelData
from
common.tools
import
request_main
from
common.tools
import
request_main
from
common.db
import
MYSQL
from
common.db
import
MYSQL
from
service.login
import
BMC
@allure.feature
(
"出行服务"
)
@allure.feature
(
"出行服务"
)
...
@@ -197,10 +198,160 @@ class TestVehicleSteward():
...
@@ -197,10 +198,160 @@ class TestVehicleSteward():
self
.
ms
.
ExecuQuery
(
self
.
ms
.
ExecuQuery
(
f
'delete from edl_public.vehicle_steward_authorization where user_id={self.user_id};'
)
f
'delete from edl_public.vehicle_steward_authorization where user_id={self.user_id};'
)
@allure.feature
(
"出行服务"
)
class
TestViolationWarn
():
workBook
=
xlrd
.
open_workbook
(
f
'{BMCConfig.root_path}/test_case_data/bmc/bmc_vehicle_steward_40-58_20210513.xlsx'
)
def
setup_class
(
self
):
self
.
headers1
=
{
'City-Code'
:
"520100"
,
'Device-Brand'
:
"vivo"
,
'Device-Code'
:
"000000001e167ed7000000001e167ed7"
,
'Device-Model'
:
"vivo vivo X20"
,
'Device-Name'
:
"vivo+X20"
,
'Device-Type'
:
"Android"
,
'Mac'
:
"38:6E:A2:A0:0E:AF"
,
'mimeType'
:
"application/json"
,
'Net'
:
"wifi"
,
'OS-Type'
:
"Android"
,
'OS-Version'
:
"27"
,
'Resolution'
:
"2034x1080"
,
'Version'
:
"2.2.6"
,
'Pvt-Token'
:
""
,
'Token'
:
""
,
}
indata
=
{
"phone"
:
"13688468803"
,
"encodedGesture"
:
"d4a68e08430ac8bd3bd497d95cbfa5de"
}
res
=
BMC
()
.
bmc_login
(
indata
)
self
.
headers1
[
'Pvt-Token'
]
=
res
[
1
]
self
.
headers1
[
'Token'
]
=
res
[
0
]
self
.
headers2
=
{
'City-Code'
:
"520100"
,
'Device-Brand'
:
"vivo"
,
'Device-Code'
:
"000000001e167ed7000000001e167ed7"
,
'Device-Model'
:
"vivo vivo X20"
,
'Device-Name'
:
"vivo+X20"
,
'Device-Type'
:
"Android"
,
'Mac'
:
"38:6E:A2:A0:0E:AF"
,
'mimeType'
:
"application/json"
,
'Net'
:
"wifi"
,
'OS-Type'
:
"Android"
,
'OS-Version'
:
"27"
,
'Resolution'
:
"2034x1080"
,
'Version'
:
"2.2.6"
,
'Pvt-Token'
:
""
,
'Token'
:
""
,
}
indata
=
{
"phone"
:
"15283936302"
,
"encodedGesture"
:
"67e6d10010533eed4bbe9659863bf6ee"
}
#public user
res
=
BMC
()
.
bmc_login
(
indata
)
self
.
headers2
[
'Pvt-Token'
]
=
res
[
1
]
self
.
headers2
[
'Token'
]
=
res
[
0
]
self
.
headers3
=
{
'City-Code'
:
"520100"
,
'Device-Brand'
:
"vivo"
,
'Device-Code'
:
"000000001e167ed7000000001e167ed7"
,
'Device-Model'
:
"vivo vivo X20"
,
'Device-Name'
:
"vivo+X20"
,
'Device-Type'
:
"Android"
,
'Mac'
:
"38:6E:A2:A0:0E:AF"
,
'mimeType'
:
"application/json"
,
'Net'
:
"wifi"
,
'OS-Type'
:
"Android"
,
'OS-Version'
:
"27"
,
'Resolution'
:
"2034x1080"
,
'Version'
:
"2.2.6"
,
'Pvt-Token'
:
""
,
'Token'
:
""
,
}
indata
=
{
"phone"
:
"19900000001"
,
"encodedGesture"
:
"67e6d10010533eed4bbe9659863bf6ee"
}
# public user
res
=
BMC
()
.
bmc_login
(
indata
)
self
.
headers3
[
'Pvt-Token'
]
=
res
[
1
]
self
.
headers3
[
'Token'
]
=
res
[
0
]
@allure.story
(
"违法提醒首页"
)
@allure.link
(
"http://yapi.hikcreate.com/project/32/interface/api/55122"
)
@allure.description
(
"/violationWarn/vioInfo/round"
)
@allure.title
(
"{inData[testPoint]}"
)
@pytest.mark.parametrize
(
"inData"
,
get_excelData
(
workBook
,
'出行服务'
,
'vioInfoRound'
))
def
test_vioInfoRound
(
self
,
inData
):
url
=
f
"{BMCConfig().pvthost}{inData['url']}"
method
=
inData
[
'method'
]
req_data
=
inData
[
'reqData'
]
expectData
=
inData
[
'expectData'
]
"""请求"""
res
=
request_main
(
url
,
self
.
headers1
,
method
,
req_data
,
has_token
=
True
)
allure
.
attach
(
"{0}"
.
format
(
res
),
"用例结果"
)
assert
res
[
'code'
]
==
expectData
[
'code'
]
@allure.story
(
"违法提醒首页"
)
@allure.link
(
"http://yapi.hikcreate.com/project/32/interface/api/55122"
)
@allure.description
(
"/violationWarn/vioInfo/round"
)
@allure.title
(
"{inData[testPoint]}"
)
@pytest.mark.parametrize
(
"inData"
,
get_excelData
(
workBook
,
'出行服务'
,
'BvioInfoRound'
))
def
test_BvioInfoRound
(
self
,
inData
):
url
=
f
"{BMCConfig().pvthost}{inData['url']}"
method
=
inData
[
'method'
]
req_data
=
inData
[
'reqData'
]
expectData
=
inData
[
'expectData'
]
"""请求"""
res
=
request_main
(
url
,
self
.
headers2
,
method
,
req_data
,
has_token
=
True
)
allure
.
attach
(
"{0}"
.
format
(
res
),
"用例结果"
)
assert
res
[
'code'
]
==
expectData
[
'code'
]
@allure.story
(
"违法提醒首页"
)
@allure.link
(
"http://yapi.hikcreate.com/project/32/interface/api/55122"
)
@allure.description
(
"/violationWarn/vioInfo/round"
)
@allure.title
(
"{inData[testPoint]}"
)
@pytest.mark.parametrize
(
"inData"
,
get_excelData
(
workBook
,
'出行服务'
,
'CvioInfoRound'
))
def
test_BvioInfoRound
(
self
,
inData
):
url
=
f
"{BMCConfig().pvthost}{inData['url']}"
method
=
inData
[
'method'
]
req_data
=
inData
[
'reqData'
]
expectData
=
inData
[
'expectData'
]
"""请求"""
res
=
request_main
(
url
,
self
.
headers3
,
method
,
req_data
,
has_token
=
True
)
allure
.
attach
(
"{0}"
.
format
(
res
),
"用例结果"
)
assert
res
[
'code'
]
==
expectData
[
'code'
]
@allure.story
(
"违法类型"
)
@allure.link
(
"http://yapi.hikcreate.com/project/32/interface/api/55104"
,
name
=
'点我看接口文档'
)
@allure.description
(
"/violationWarn/vioType/list"
)
@allure.title
(
"{inData[testPoint]}"
)
@pytest.mark.parametrize
(
"inData"
,
get_excelData
(
workBook
,
'出行服务'
,
'vioTypeList'
))
def
test_vioTypeList
(
self
,
inData
):
url
=
f
"{BMCConfig().pvthost}{inData['url']}"
method
=
inData
[
'method'
]
req_data
=
inData
[
'reqData'
]
expectData
=
inData
[
'expectData'
]
"""请求"""
res
=
request_main
(
url
,
self
.
headers1
,
method
,
req_data
,
has_token
=
True
)
allure
.
attach
(
"{0}"
.
format
(
res
),
"用例结果"
)
assert
res
[
'code'
]
==
expectData
[
'code'
]
@allure.story
(
"违法点详情"
)
@allure.link
(
"http://yapi.hikcreate.com/project/32/interface/api/55266"
,
name
=
'点我看接口文档'
)
@allure.description
(
"/violationWarn/vioPoint/vehicle/list"
)
@allure.title
(
"{inData[testPoint]}"
)
@pytest.mark.parametrize
(
"inData"
,
get_excelData
(
workBook
,
'出行服务'
,
'vioPointVehicleList'
))
def
test_vioPointVehicleList
(
self
,
inData
):
url
=
f
"{BMCConfig().pvthost}{inData['url']}"
method
=
inData
[
'method'
]
req_data
=
inData
[
'reqData'
]
expectData
=
inData
[
'expectData'
]
"""请求"""
res
=
request_main
(
url
,
self
.
headers1
,
method
,
req_data
,
has_token
=
True
)
allure
.
attach
(
"{0}"
.
format
(
res
),
"用例结果"
)
assert
res
[
'code'
]
==
expectData
[
'code'
]
@allure.story
(
"违法通知"
)
@allure.link
(
"http://yapi.hikcreate.com/project/32/interface/api/55338"
,
name
=
'点我看接口文档'
)
@allure.description
(
"/violationWarn/getSwitch"
)
@allure.title
(
"{inData[testPoint]}"
)
@pytest.mark.parametrize
(
"inData"
,
get_excelData
(
workBook
,
'出行服务'
,
'violationWarn'
))
def
test_vioPointVehicleList
(
self
,
inData
):
url
=
f
"{BMCConfig().pvthost}{inData['url']}"
method
=
inData
[
'method'
]
req_data
=
inData
[
'reqData'
]
expectData
=
inData
[
'expectData'
]
"""请求"""
res
=
request_main
(
url
,
self
.
headers1
,
method
,
req_data
,
has_token
=
True
)
allure
.
attach
(
"{0}"
.
format
(
res
),
"用例结果"
)
assert
res
[
'code'
]
==
expectData
[
'code'
]
@pytest.mark.scoreDetail
@allure.story
(
"违法提醒去添加车辆"
)
@allure.link
(
"http://yapi.hikcreate.com/project/32/interface/api/55122"
)
@allure.description
(
"/violationWarn/vioInfo/round"
)
@allure.title
(
"{inData[testPoint]}"
)
@pytest.mark.parametrize
(
"inData"
,
get_excelData
(
workBook
,
'出行服务'
,
'eventData'
))
def
test_BvioInfoRound
(
self
,
inData
):
url
=
f
"{BMCConfig().host}{inData['url']}"
method
=
inData
[
'method'
]
req_data
=
inData
[
'reqData'
]
expectData
=
inData
[
'expectData'
]
"""请求"""
res
=
request_main
(
url
,
self
.
headers3
,
method
,
req_data
,
has_token
=
True
)
allure
.
attach
(
"{0}"
.
format
(
res
),
"用例结果"
)
assert
res
[
'code'
]
==
expectData
[
'code'
]
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
pytest
.
main
([
'-s'
,
'-v'
,
'test_vehicle_steward.py'
,
pytest
.
main
([
'-s'
,
'-v'
,
'test_vehicle_steward.py'
,
r'--alluredir=D:\项目\接口自动化\InterfaceAutoTest\report'
,
'--clean-alluredir'
])
r'--alluredir=D:\项目\接口自动化\InterfaceAutoTest\report'
,
'--clean-alluredir'
])
#
#
os
.
system
(
'allure serve D:
\
项目
\
接口自动化
\
InterfaceAutoTest
\\
report'
)
os
.
system
(
'allure serve D:
\
项目
\
接口自动化
\
InterfaceAutoTest
\\
report'
)
\ No newline at end of file
test_case_data/bmc/bmc_vehicle_steward_40-58_20210513.xlsx
View file @
b7306d2e
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