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
9ca21b1c
Commit
9ca21b1c
authored
Oct 13, 2021
by
taoke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
安全运输平台---企业端添加用例-基础数据管理
parent
4ecdccf2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
1 deletions
+48
-1
common/db.py
+2
-1
test_case/safe_transportation/qyd/test_baseData.py
+46
-0
test_case_data/safe_transportation/qyd_baseData.xlsx
+0
-0
No files found.
common/db.py
View file @
9ca21b1c
...
...
@@ -97,8 +97,9 @@ if __name__ == '__main__':
# mysql = MYSQL(host="10.197.236.190", port=3306, user="root", pwd="123456", db="edl_private")
mysql
=
MYSQL
(
*
mysql_config
)
# info = mysql.ExecuQuery("SELECT * FROM db_tbd_base1.project;")
info
=
mysql
.
ExecuQuery
(
"select id from db_tbd
_base1.risk_info where risk_name='自动化新增
';"
)
info
=
mysql
.
ExecuQuery
(
"select id from db_tbd
.base_transport_driver where license_number='510122202011120001
';"
)
print
(
info
)
print
(
info
[
0
][
"id"
])
# r = RedisString(0).get('bmc:captcha:1ad7d0e9-1e01-454c-8500-d7b5b15c90ff')
test_case/safe_transportation/qyd/test_baseData.py
View file @
9ca21b1c
...
...
@@ -8,6 +8,7 @@ import allure,xlrd,pytest
from
config
import
*
from
common.utils.getExcelData
import
get_excelData
from
common.tools
import
request_main
from
common.db
import
RedisString
,
MYSQL
@allure.feature
(
"企业端-基础数据管理"
)
class
TestEnterpriseArchives
(
):
...
...
@@ -26,6 +27,51 @@ class TestEnterpriseArchives( ):
# 断言
assert
res
[
'code'
]
==
inData
[
'expectData'
][
'code'
]
@pytest.mark.usefixtures
(
"del_driverData"
)
@allure.story
(
"驾驶人管理"
)
@allure.title
(
"{inData[testPoint]}"
)
@pytest.mark.parametrize
(
"inData"
,
get_excelData
(
workBook
,
'基础数据管理'
,
'addDriver'
))
def
test_addDriver
(
self
,
inData
):
res
=
request_main
(
url
=
f
"{SafeTransportationConfig().test_bmy_host}{inData['url']}"
,
headers
=
inData
[
'headers'
],
method
=
inData
[
'method'
],
data
=
inData
[
'reqData'
])
allure
.
attach
(
f
"{res}"
,
"响应结果"
,
allure
.
attachment_type
.
TEXT
)
assert
res
[
'code'
]
==
inData
[
'expectData'
][
'code'
]
@pytest.fixture
()
# 用做新增驾驶员用例的环境初始化---先把数据删掉
def
del_driverData
(
self
):
mysql
=
MYSQL
(
host
=
"10.197.236.190"
,
port
=
3306
,
user
=
"root"
,
pwd
=
"123456"
,
db
=
"edl_private"
)
mysql
.
ExecuNonQuery
(
"DELETE FROM db_tbd.base_transport_driver WHERE license_number='510122202011120001';"
)
@allure.story
(
"驾驶人管理"
)
@allure.title
(
"{inData[testPoint]}"
)
@pytest.mark.parametrize
(
"inData"
,
get_excelData
(
workBook
,
'基础数据管理'
,
'updateDriver'
))
def
test_updateDriver
(
self
,
inData
,
get_driverId
):
inData
[
'reqData'
][
"id"
]
=
get_driverId
res
=
request_main
(
url
=
f
"{SafeTransportationConfig().test_bmy_host}{inData['url']}"
,
headers
=
inData
[
'headers'
],
method
=
inData
[
'method'
],
data
=
inData
[
'reqData'
])
allure
.
attach
(
f
"{res}"
,
"响应结果"
,
allure
.
attachment_type
.
TEXT
)
assert
res
[
'code'
]
==
inData
[
'expectData'
][
'code'
]
@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"
]
if
__name__
==
'__main__'
:
for
one
in
os
.
listdir
(
'../../../report/tmp'
):
...
...
test_case_data/safe_transportation/qyd_baseData.xlsx
View file @
9ca21b1c
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