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
1903985e
Commit
1903985e
authored
May 24, 2021
by
huangchengcheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成我的模块所有用例开发调试
parent
38b7de62
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
166 additions
and
32 deletions
+166
-32
test_case/bmc/test_my.py
+166
-32
test_case_data/bmc/bmc_my_2021513.xlsx
+0
-0
No files found.
test_case/bmc/test_my.py
View file @
1903985e
...
...
@@ -22,6 +22,8 @@ class TestMy:
config
.
BMCConfig
.
headers
[
"Pvt-Token"
]
=
getattr
(
config
.
BMCConfig
,
"bmc_pvt_token"
)
config
.
BMCConfig
.
headers
[
"Token"
]
=
getattr
(
config
.
BMCConfig
,
"bmc_token"
)
self
.
headers
=
config
.
BMCConfig
.
headers
mysql
=
MYSQL
(
"10.197.236.190"
,
3306
,
"root"
,
"123456"
,
db
=
"edl_public"
)
mysql
.
ExecuNonQuery
(
"insert into edl_public.feedback_type values ('10008611','自动化类型','0','1','0','2021-05-01 16:51:12','2021-05-01 16:51:12','520100,330100,500100');"
)
@allure.story
(
"个人信息获取"
)
...
...
@@ -192,14 +194,13 @@ class TestMy:
@pytest.mark.usefixtures
(
"test_addaddressId"
)
@allure.story
(
"用户收货地址
新增
"
)
@allure.story
(
"用户收货地址"
)
@allure.description
(
"creator:李倩,autoCreator:huangchengcheng"
)
@allure.title
(
"{indata[testPoint]}"
)
@pytest.mark.parametrize
(
"indata"
,
getExcelData
.
get_excelData
(
workbook
,
"我的"
,
"Myinfoaddressdelete"
))
def
test_myinfoaddressdelete
(
self
,
indata
):
url
=
f
'{config.BMCConfig.host}/{indata["url"]}'
method
=
indata
[
"method"
]
expectdata
=
indata
[
"expectData"
]
mysql
=
MYSQL
(
"10.197.236.190"
,
3306
,
"root"
,
"123456"
,
db
=
"edl_public"
)
addressId
=
mysql
.
ExecuQuery
(
"SELECT id FROM user_address WHERE address='接口自动化详细地址';"
)[
-
1
][
"id"
]
...
...
@@ -313,21 +314,34 @@ class TestMy:
raise
e
# @pytest.mark.skip("预期值错误,待修改,,替换msgid")
# @allure.story("读消息")
# @allure.description("creator:李倩,autoCreator:huangchengcheng")
# @allure.title("{indata[testPoint]}")
# @pytest.mark.parametrize("indata", getExcelData.get_excelData(workbook, "我的", "Messagecenterread"))
# def test_messagecenterread(self, indata):
# url = f'{config.BMCConfig.host}/{indata["url"]}'
# method = indata["method"]
# data = indata["reqData"]
# expectdata = indata["expectData"]
# res = request_main(url, self.headers, method, data)
# try:
# assert res["code"] == expectdata["code"]
# except Exception as e:
# raise e
@pytest.fixture
(
scope
=
"function"
)
def
messagecenterlist
(
self
):
url
=
f
'{config.BMCConfig.host}/msg/list'
method
=
'get'
data
=
{
"timestamp"
:
0
,
"size"
:
20
,
"bizType"
:
"msg"
,
"groupId"
:
1
}
res
=
request_main
(
url
,
self
.
headers
,
method
,
data
)
return
res
[
"data"
][
"list"
]
@allure.story
(
"读消息"
)
@allure.description
(
"creator:李倩,autoCreator:huangchengcheng"
)
@allure.title
(
"{indata[testPoint]}"
)
@pytest.mark.parametrize
(
"indata"
,
getExcelData
.
get_excelData
(
workbook
,
"我的"
,
"Messagecenterread"
))
def
test_messagecenterread
(
self
,
indata
,
messagecenterlist
):
url
=
f
'{config.BMCConfig.host}/{indata["url"]}'
method
=
indata
[
"method"
]
if
messagecenterlist
==
[]:
pytest
.
skip
(
"无消息可读取"
)
else
:
indata
[
"reqData"
][
'msgId'
]
=
messagecenterlist
[
0
][
"msgId"
]
data
=
indata
[
"reqData"
]
expectdata
=
indata
[
"expectData"
]
res
=
request_main
(
url
,
self
.
headers
,
method
,
data
)
try
:
assert
res
[
"code"
]
==
expectdata
[
"code"
]
except
Exception
as
e
:
raise
e
@allure.story
(
"全部已读"
)
...
...
@@ -463,22 +477,141 @@ class TestMy:
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, "我的", "Messagecenterlist"))
# def test_Messagecenterlist(self, indata):
# url = f'{config.BMCConfig.host}/{indata["url"]}'
# method = indata["method"]
# data = indata["reqData"]
# expectdata = indata["expectData"]
# 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
,
"我的"
,
"FeedbackfeedbackType"
))
def
test_feedbackfeedbackType
(
self
,
indata
):
url
=
f
'{config.BMCConfig.host}/{indata["url"]}'
method
=
indata
[
"method"
]
data
=
indata
[
"reqData"
]
expectdata
=
indata
[
"expectData"
]
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
,
"我的"
,
"Feedbackadd"
))
def
test_feedbackadd
(
self
,
indata
):
url
=
f
'{config.BMCConfig.host}/{indata["url"]}'
method
=
indata
[
"method"
]
if
indata
[
"reqData"
][
'content'
]
==
"不传类型id自动化测试"
:
data
=
indata
[
"reqData"
]
else
:
indata
[
"reqData"
][
"feedbackTypeId"
]
=
10008611
data
=
indata
[
"reqData"
]
expectdata
=
indata
[
"expectData"
]
res
=
request_main
(
url
,
self
.
headers
,
method
,
data
)
try
:
assert
res
[
"code"
]
==
expectdata
[
"code"
]
except
Exception
as
e
:
raise
e
@pytest.fixture
(
scope
=
"function"
)
def
feedbackadd
(
self
):
url
=
f
'{config.BMCConfig.host}/v1/feedback/add'
feedbackTypeId
=
10008611
print
(
feedbackTypeId
)
data
=
{
"content"
:
"自动化新用户意见数据"
,
"feedbackTypeId"
:
feedbackTypeId
}
method
=
"post"
res
=
request_main
(
url
,
self
.
headers
,
method
,
data
)
mysql
=
MYSQL
(
"10.197.236.190"
,
3306
,
"root"
,
"123456"
,
db
=
"edl_public"
)
feedbackId
=
mysql
.
ExecuQuery
(
"select feedback_id from edl_public.feedback_chat_record where user_id='598137' and content='自动化新用户意见数据';"
)[
-
1
][
"feedback_id"
]
return
feedbackId
@pytest.mark.usefixtures
(
"feedbackadd"
)
@allure.story
(
"意见反馈列表"
)
@allure.description
(
"creator:李倩,autoCreator:huangchengcheng"
)
@allure.title
(
"{indata[testPoint]}"
)
@pytest.mark.parametrize
(
"indata"
,
getExcelData
.
get_excelData
(
workbook
,
"我的"
,
"Feedbacklist"
))
def
test_feedbacklist
(
self
,
indata
):
url
=
f
'{config.BMCConfig.host}/{indata["url"]}'
method
=
indata
[
"method"
]
data
=
indata
[
"reqData"
]
expectdata
=
indata
[
"expectData"
]
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
,
"我的"
,
"Feedbackdetails"
))
def
test_feedbackdetails
(
self
,
indata
,
feedbackadd
):
url
=
f
'{config.BMCConfig.host}/{indata["url"]}'
method
=
indata
[
"method"
]
indata
[
"reqData"
][
"feedbackId"
]
=
feedbackadd
data
=
indata
[
"reqData"
]
expectdata
=
indata
[
"expectData"
]
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
,
"我的"
,
"FeedbackcheckFeedbackSee"
))
def
test_feedbackcheckFeedbackSee
(
self
,
indata
,
feedbackadd
):
url
=
f
'{config.BMCConfig.host}/{indata["url"]}'
method
=
indata
[
"method"
]
data
=
indata
[
"reqData"
]
expectdata
=
indata
[
"expectData"
]
otherexpectData
=
indata
[
"otherExpectData"
]
if
indata
[
'testPoint'
]
==
"有未读信息"
:
mysql
=
MYSQL
(
"10.197.236.190"
,
3306
,
"root"
,
"123456"
,
db
=
"edl_public"
)
mysql
.
ExecuNonQuery
(
"update edl_public.feedback_main set read_flag='0'where user_id='598137'and feedback_type_id='10008611';"
)
mysql
.
ExecuNonQuery
(
"update edl_public.feedback_main set status='1'where user_id='598137'and feedback_type_id='10008611';"
)
else
:
mysql
=
MYSQL
(
"10.197.236.190"
,
3306
,
"root"
,
"123456"
,
db
=
"edl_public"
)
mysql
.
ExecuNonQuery
(
"update edl_public.feedback_main set read_flag='1'where user_id='598137'and feedback_type_id='10008611';"
)
res
=
request_main
(
url
,
self
.
headers
,
method
,
data
)
try
:
assert
res
[
"code"
]
==
expectdata
[
"code"
]
assert
res
[
"data"
][
"flag"
]
==
otherexpectData
[
"data"
][
"flag"
]
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
,
"我的"
,
"Feedbacksolve"
))
def
test_feedbacksolve
(
self
,
indata
,
feedbackadd
):
url
=
f
'{config.BMCConfig.host}/{indata["url"]}'
method
=
indata
[
"method"
]
indata
[
"reqData"
][
"feedbackId"
]
=
feedbackadd
data
=
indata
[
"reqData"
]
expectdata
=
indata
[
"expectData"
]
res
=
request_main
(
url
,
self
.
headers
,
method
,
data
)
try
:
assert
res
[
"code"
]
==
expectdata
[
"code"
]
except
Exception
as
e
:
raise
e
def
teardown
(
self
):
mysql
=
MYSQL
(
"10.197.236.190"
,
3306
,
"root"
,
"123456"
,
db
=
"edl_public"
)
mysql
.
ExecuNonQuery
(
"delete from feedback_type where id='10008611';"
)
mysql
.
ExecuNonQuery
(
"delete from feedback_chat_record where user_id='598137'"
)
mysql
.
ExecuNonQuery
(
"delete from feedback_main where user_id='598137'"
)
if
__name__
==
'__main__'
:
pytest
.
main
([
"-s"
,
"-v"
,
"test_my.py"
,
'--alluredir'
,
'./bmc/report'
,
"--clean-alluredir"
])
# pytest.main(['-v', '-s', "test_my.py::TestMy::test_
basiccancel
", '--alluredir', './bmc/report', "--clean-alluredir"])
# pytest.main(['-v', '-s', "test_my.py::TestMy::test_
feedbacksolve
", '--alluredir', './bmc/report', "--clean-alluredir"])
os
.
system
(
'allure serve ./bmc/report'
)
\ No newline at end of file
test_case_data/bmc/bmc_my_2021513.xlsx
View file @
1903985e
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