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
58d6d56b
Commit
58d6d56b
authored
Oct 13, 2021
by
taoke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
安全运输平台---企业端添加用例-基础数据管理
parent
9ca21b1c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
14 deletions
+16
-14
test_case/safe_transportation/qyd/test_baseData.py
+16
-14
test_case_data/safe_transportation/qyd_baseData.xlsx
+0
-0
No files found.
test_case/safe_transportation/qyd/test_baseData.py
View file @
58d6d56b
...
...
@@ -10,6 +10,7 @@ from common.utils.getExcelData import get_excelData
from
common.tools
import
request_main
from
common.db
import
RedisString
,
MYSQL
@allure.feature
(
"企业端-基础数据管理"
)
class
TestEnterpriseArchives
(
):
workBook
=
xlrd
.
open_workbook
(
f
'{BaseConfig.root_path}/test_case_data/safe_transportation/qyd_baseData.xlsx'
)
...
...
@@ -45,11 +46,18 @@ class TestEnterpriseArchives( ):
mysql
.
ExecuNonQuery
(
"DELETE FROM db_tbd.base_transport_driver WHERE license_number='510122202011120001';"
)
@pytest.fixture
()
# 用做编辑驾驶员用例和删除驾驶员环境初始化---先查询某个驾驶员的id
def
get_driverId
(
self
):
mysql
=
MYSQL
(
host
=
"10.197.236.190"
,
port
=
3306
,
user
=
"root"
,
pwd
=
"123456"
,
db
=
"edl_private"
)
dirverId
=
mysql
.
ExecuQuery
(
"select id from db_tbd.base_transport_driver where license_number='510122202011120001';"
)
return
dirverId
[
0
][
"id"
]
@allure.story
(
"驾驶人管理"
)
@allure.title
(
"{inData[testPoint]}"
)
@pytest.mark.parametrize
(
"inData"
,
get_excelData
(
workBook
,
'基础数据管理'
,
'updateDriver'
))
def
test_updateDriver
(
self
,
inData
,
get_driverId
):
@pytest.mark.parametrize
(
"inData"
,
get_excelData
(
workBook
,
'基础数据管理'
,
'updateDelDriver'
))
def
test_updateDriver
(
self
,
inData
,
get_driverId
):
# 这里的执行顺序为:新增、删除(假删除)、编辑
"""编辑用例和删除用例都适用,需要改用例中的id"""
inData
[
'reqData'
][
"id"
]
=
get_driverId
res
=
request_main
(
url
=
f
"{SafeTransportationConfig().test_bmy_host}{inData['url']}"
,
headers
=
inData
[
'headers'
],
...
...
@@ -58,19 +66,13 @@ class TestEnterpriseArchives( ):
allure
.
attach
(
f
"{res}"
,
"响应结果"
,
allure
.
attachment_type
.
TEXT
)
assert
res
[
'code'
]
==
inData
[
'expectData'
][
'code'
]
@pytest.fixture
()
# 用做编辑驾驶员用例的环境初始化---先查询某个驾驶员的id
def
get_driverId
(
self
):
"""环境恢复"""
@pytest.fixture
(
scope
=
"class"
,
autouse
=
True
)
def
del_Data
(
self
):
yield
mysql
=
MYSQL
(
host
=
"10.197.236.190"
,
port
=
3306
,
user
=
"root"
,
pwd
=
"123456"
,
db
=
"edl_private"
)
dirverId
=
mysql
.
ExecuQuery
(
"select id from db_tbd.base_transport_driver where license_number='510122202011120001';"
)
return
dirverId
[
0
][
"id"
]
mysql
.
ExecuNonQuery
(
"DELETE FROM db_tbd.base_transport_driver WHERE license_number='510122202011120001';"
)
# 删除驾驶员自动化测试数据
if
__name__
==
'__main__'
:
...
...
test_case_data/safe_transportation/qyd_baseData.xlsx
View file @
58d6d56b
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