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
d7c45529
Commit
d7c45529
authored
May 21, 2021
by
huangchengcheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ƿռ
parent
e3d102c8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
117 additions
and
9 deletions
+117
-9
test_case/bmc/test_roadreview.py
+117
-9
test_case_data/bmc/bmc_road_review_2021513.xlsx
+0
-0
No files found.
test_case/bmc/test_roadreview.py
View file @
d7c45529
...
@@ -8,6 +8,7 @@ import allure
...
@@ -8,6 +8,7 @@ import allure
import
config
import
config
import
pytest
import
pytest
import
xlrd
import
xlrd
from
common.db
import
MYSQL
from
common.tools
import
request_main
from
common.tools
import
request_main
from
common.utils
import
getExcelData
from
common.utils
import
getExcelData
from
service.login
import
BMC
from
service.login
import
BMC
...
@@ -24,6 +25,10 @@ class TestRoadreview:
...
@@ -24,6 +25,10 @@ class TestRoadreview:
config
.
BMCConfig
.
headers
[
"bmc_token"
]
=
res
[
0
]
config
.
BMCConfig
.
headers
[
"bmc_token"
]
=
res
[
0
]
config
.
BMCConfig
.
headers
[
"bmc_pvt_token"
]
=
res
[
1
]
config
.
BMCConfig
.
headers
[
"bmc_pvt_token"
]
=
res
[
1
]
self
.
headers
=
config
.
BMCConfig
.
headers
self
.
headers
=
config
.
BMCConfig
.
headers
mysql
=
MYSQL
(
"10.197.236.190"
,
3306
,
"root"
,
"123456"
,
db
=
"edl_private"
)
self
.
pvt_user_id
=
mysql
.
ExecuQuery
(
"SELECT id FROM user WHERE phone='17822000000';"
)[
0
][
"id"
]
#不同账号登录,将sql中的user_id修改为获取到的用户专网id:self.pvt_user_id
@allure.story
(
"首页"
)
@allure.story
(
"首页"
)
@allure.description
(
"creator:林静文,autoCreator:huangchengcheng"
)
@allure.description
(
"creator:林静文,autoCreator:huangchengcheng"
)
...
@@ -77,7 +82,7 @@ class TestRoadreview:
...
@@ -77,7 +82,7 @@ class TestRoadreview:
@allure.description
(
"creator:林静文,autoCreator:huangchengcheng"
)
@allure.description
(
"creator:林静文,autoCreator:huangchengcheng"
)
@allure.title
(
"{indata[testPoint]}"
)
@allure.title
(
"{indata[testPoint]}"
)
@pytest.mark.parametrize
(
"indata"
,
getExcelData
.
get_excelData
(
workbook
,
"非交通占用道路审查"
,
"roadaddBasicInfo"
))
@pytest.mark.parametrize
(
"indata"
,
getExcelData
.
get_excelData
(
workbook
,
"非交通占用道路审查"
,
"roadaddBasicInfo"
))
def
test_
roadaddBasicI
nfo
(
self
,
indata
):
def
test_
aroadaddbasici
nfo
(
self
,
indata
):
url
=
f
'{config.BMCConfig.host}/{indata["url"]}'
url
=
f
'{config.BMCConfig.host}/{indata["url"]}'
data
=
indata
[
"reqData"
]
data
=
indata
[
"reqData"
]
expectdata
=
indata
[
"expectData"
]
expectdata
=
indata
[
"expectData"
]
...
@@ -93,7 +98,7 @@ class TestRoadreview:
...
@@ -93,7 +98,7 @@ class TestRoadreview:
@allure.description
(
"creator:林静文,autoCreator:huangchengcheng"
)
@allure.description
(
"creator:林静文,autoCreator:huangchengcheng"
)
@allure.title
(
"{indata[testPoint]}"
)
@allure.title
(
"{indata[testPoint]}"
)
@pytest.mark.parametrize
(
"indata"
,
getExcelData
.
get_excelData
(
workbook
,
"非交通占用道路审查"
,
"roadaddOccupyRoadInfo"
))
@pytest.mark.parametrize
(
"indata"
,
getExcelData
.
get_excelData
(
workbook
,
"非交通占用道路审查"
,
"roadaddOccupyRoadInfo"
))
def
test_
roadaddOccupyRoadI
nfo
(
self
,
indata
):
def
test_
broadaddoccupyroadi
nfo
(
self
,
indata
):
url
=
f
'{config.BMCConfig.host}/{indata["url"]}'
url
=
f
'{config.BMCConfig.host}/{indata["url"]}'
today
=
datetime
.
datetime
.
now
()
today
=
datetime
.
datetime
.
now
()
offset
=
datetime
.
timedelta
(
days
=
1
)
offset
=
datetime
.
timedelta
(
days
=
1
)
...
@@ -104,17 +109,120 @@ class TestRoadreview:
...
@@ -104,17 +109,120 @@ class TestRoadreview:
indata
[
"reqData"
][
"beginDate"
]
=
beginDate
indata
[
"reqData"
][
"beginDate"
]
=
beginDate
indata
[
"reqData"
][
"endDate"
]
=
endDate
indata
[
"reqData"
][
"endDate"
]
=
endDate
#处理开始结束时间不能小于当前日期问题
#处理开始结束时间不能小于当前日期问题
mysql
=
MYSQL
(
"10.197.236.190"
,
3306
,
"root"
,
"123456"
,
db
=
"db_gy_dmsmp"
)
basic_info_id
=
mysql
.
ExecuQuery
(
"select id from db_gy_dmsmp.occupy_road_apply where user_id=393038 and people_phone='18800000044'order by id;"
)[
-
1
][
"id"
]
indata
[
"reqData"
][
"id"
]
=
basic_info_id
#处理关联任务的请求id
data
=
indata
[
"reqData"
]
res
=
request_main
(
url
,
self
.
headers
,
method
,
data
)
try
:
assert
res
[
"code"
]
==
expectdata
[
"code"
]
except
Exception
as
e
:
raise
e
"""系统异常"""
# @pytest.mark.skip(reason="不执行该用例,报系统异常")
@allure.story
(
"业务申请"
)
@allure.description
(
"creator:林静文,autoCreator:huangchengcheng"
)
@allure.title
(
"{indata[testPoint]}"
)
@pytest.mark.parametrize
(
"indata"
,
getExcelData
.
get_excelData
(
workbook
,
"非交通占用道路审查"
,
"roadaddpFile"
))
def
test_croadaddFile
(
self
,
indata
):
url
=
f
'{config.BMCConfig.host}/{indata["url"]}'
expectdata
=
indata
[
"expectData"
]
method
=
indata
[
"method"
]
mysql
=
MYSQL
(
"10.197.236.190"
,
3306
,
"root"
,
"123456"
,
db
=
"db_gy_dmsmp"
)
basic_info_id
=
mysql
.
ExecuQuery
(
"select id from db_gy_dmsmp.occupy_road_apply where user_id=393038 and people_phone='18800000044'order by id;"
)[
-
1
][
"id"
]
indata
[
"reqData"
][
"id"
]
=
basic_info_id
data
=
indata
[
"reqData"
]
res
=
request_main
(
url
,
self
.
headers
,
method
,
data
)
try
:
assert
res
[
"code"
]
==
expectdata
[
"code"
]
except
Exception
as
e
:
raise
e
@allure.story
(
"申请详情"
)
@allure.description
(
"creator:林静文,autoCreator:huangchengcheng"
)
@allure.title
(
"{indata[testPoint]}"
)
@pytest.mark.parametrize
(
"indata"
,
getExcelData
.
get_excelData
(
workbook
,
"非交通占用道路审查"
,
"roaddetailt"
))
def
test_roaddetail
(
self
,
indata
):
url
=
f
'{config.BMCConfig.host}/{indata["url"]}'
data
=
indata
[
"reqData"
]
data
=
indata
[
"reqData"
]
expectdata
=
indata
[
"expectData"
]
method
=
indata
[
"method"
]
res
=
request_main
(
url
,
self
.
headers
,
method
,
data
)
res
=
request_main
(
url
,
self
.
headers
,
method
,
data
)
try
:
try
:
assert
res
[
"code"
]
==
expectdata
[
"code"
]
assert
res
[
"code"
]
==
expectdata
[
"code"
]
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
raise
e
if
__name__
==
'__main__'
:
# 生成报告数据
@allure.story
(
"重新提交"
)
# pytest.main(['-v', '-s', "test_roadreview.py", '--alluredir', './bmc/report',"--clean-alluredir"])
@allure.description
(
"creator:林静文,autoCreator:huangchengcheng"
)
pytest
.
main
([
'-v'
,
'-s'
,
"test_roadreview.py::TestRoadreview::test_roadaddOccupyRoadInfo"
,
'--alluredir'
,
'./bmc/report'
,
"--clean-alluredir"
])
@allure.title
(
"{indata[testPoint]}"
)
# 打开报告
@pytest.mark.parametrize
(
"indata"
,
getExcelData
.
get_excelData
(
workbook
,
"非交通占用道路审查"
,
"roadreSubmit"
))
os
.
system
(
'allure serve ./bmc/report'
)
def
test_roadresubmit
(
self
,
indata
):
\ No newline at end of file
url
=
f
'{config.BMCConfig.host}/{indata["url"]}'
data
=
indata
[
"reqData"
]
expectdata
=
indata
[
"expectData"
]
method
=
indata
[
"method"
]
res
=
request_main
(
url
,
self
.
headers
,
method
,
data
)
try
:
assert
res
[
"code"
]
==
expectdata
[
"code"
]
except
Exception
as
e
:
raise
e
@allure.story
(
"查看意见书"
)
@allure.description
(
"creator:林静文,autoCreator:huangchengcheng"
)
@allure.title
(
"{indata[testPoint]}"
)
@pytest.mark.parametrize
(
"indata"
,
getExcelData
.
get_excelData
(
workbook
,
"非交通占用道路审查"
,
"roadnoticeDetail"
))
def
test_roadnoticedetail
(
self
,
indata
):
url
=
f
'{config.BMCConfig.host}/{indata["url"]}'
data
=
indata
[
"reqData"
]
expectdata
=
indata
[
"expectData"
]
method
=
indata
[
"method"
]
res
=
request_main
(
url
,
self
.
headers
,
method
,
data
)
try
:
assert
res
[
"code"
]
==
expectdata
[
"code"
]
except
Exception
as
e
:
raise
e
@allure.story
(
"占道施工公示"
)
@allure.description
(
"creator:林静文,autoCreator:huangchengcheng"
)
@allure.title
(
"{indata[testPoint]}"
)
@pytest.mark.parametrize
(
"indata"
,
getExcelData
.
get_excelData
(
workbook
,
"非交通占用道路审查"
,
"roadtemOccupyRoad"
))
def
test_roadtemoccupyroad
(
self
,
indata
):
url
=
f
'{config.BMCConfig.host}/{indata["url"]}'
data
=
indata
[
"reqData"
]
expectdata
=
indata
[
"expectData"
]
method
=
indata
[
"method"
]
res
=
request_main
(
url
,
self
.
headers
,
method
,
data
)
try
:
assert
res
[
"code"
]
==
expectdata
[
"code"
]
except
Exception
as
e
:
raise
e
def
teardown_class
(
self
):
mysql
=
MYSQL
(
"10.197.236.190"
,
3306
,
"root"
,
"123456"
,
db
=
"db_gy_dmsmp"
)
mysql
.
ExecuNonQuery
(
"delete from db_gy_dmsmp.occupy_road_apply where user_id='393038' and people_phone='18800000044' and road_remark='这是接口自动化数据';"
)
# if __name__ == '__main__':
#
# # 生成报告数据
# pytest.main(['-v', '-s', "test_roadreview.py", '--alluredir', './bmc/report',"--clean-alluredir"])
# # pytest.main(['-v', '-s', "test_roadreview.py::TestRoadreview::test_roadaddbasicinfo", '--alluredir', './bmc/report', "--clean-alluredir"])
# # 打开报告
# os.system('allure serve ./bmc/report')
\ No newline at end of file
test_case_data/bmc/bmc_road_review_2021513.xlsx
View file @
d7c45529
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