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
75d32f08
Commit
75d32f08
authored
May 19, 2021
by
taoke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化读取excle,若excle标题错误,则返回一串空列表
parent
bc07b353
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
11 deletions
+13
-11
common/utils/getExcelData.py
+8
-6
run.py
+4
-4
test_case/bmc/test_accountinfo.py
+1
-1
test_case_data/bmc/bmc_testcase_20210513.xlsx
+0
-0
No files found.
common/utils/getExcelData.py
View file @
75d32f08
...
@@ -27,11 +27,9 @@ def get_excelData(workBook,sheetName,caseName):
...
@@ -27,11 +27,9 @@ def get_excelData(workBook,sheetName,caseName):
num_creator
=
list_title
.
index
(
'creator'
)
num_creator
=
list_title
.
index
(
'creator'
)
num_autoCreator
=
list_title
.
index
(
'autoCreator'
)
num_autoCreator
=
list_title
.
index
(
'autoCreator'
)
lis
=
[]
lis
=
[]
idx
=
0
idx
=
0
try
:
for
one
in
workSheet
.
col_values
(
0
):
for
one
in
workSheet
.
col_values
(
0
):
result
=
''
.
join
(
re
.
findall
(
r'[A-Za-z]'
,
one
))
# 抽取字母字符串
result
=
''
.
join
(
re
.
findall
(
r'[A-Za-z]'
,
one
))
# 抽取字母字符串
if
caseName
==
result
:
if
caseName
==
result
:
...
@@ -78,14 +76,17 @@ def get_excelData(workBook,sheetName,caseName):
...
@@ -78,14 +76,17 @@ def get_excelData(workBook,sheetName,caseName):
idx
+=
1
idx
+=
1
return
lis
return
lis
except
:
except
:
print
(
"excle中header值或参数或期望不是json字符串"
)
list0
=
[{
'url'
:
''
,
'headers'
:
None
,
'method'
:
'post'
,
'reqData'
:
None
,
'expectData'
:
None
,
'testPoint'
:
''
,
'caseNum'
:
''
,
'otherExpectData'
:
None
,
'function'
:
''
,
'interface'
:
''
,
'priority'
:
''
,
'yapiAddress'
:
''
,
'creator'
:
''
,
'autoCreator'
:
''
,
'frontInterface'
:
''
,
'frontCondition'
:
''
,
'expectResult'
:
''
}]
except
:
print
(
"检查excle中标题是否正确"
)
print
(
"检查excle中标题是否正确"
)
return
list0
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
workBook
=
xlrd
.
open_workbook
(
'../../test_case_data/bmc/bmc_testcase_20210513.xlsx'
)
workBook
=
xlrd
.
open_workbook
(
'../../test_case_data/bmc/bmc_testcase_20210513.xlsx'
)
li
=
get_excelData
(
workBook
,
"积分商城"
,
"focusSuccessIntegral"
)
li
=
get_excelData
(
workBook
,
"账号信息基本功能"
,
"login"
)
print
(
li
)
for
i
in
li
:
print
(
i
)
# {"Authorization": "","Content-Type":"application/x-www-form-urlencoded"}
# {"Authorization": "","Content-Type":"application/x-www-form-urlencoded"}
\ No newline at end of file
run.py
View file @
75d32f08
...
@@ -26,10 +26,10 @@ if __name__ == "__main__":
...
@@ -26,10 +26,10 @@ if __name__ == "__main__":
# 生成报告数据
# 生成报告数据
pytest
.
main
([
'-v'
,
'-s'
,
test_case_dir
,
'--alluredir'
,
'./report/tmp'
])
pytest
.
main
([
'-v'
,
'-s'
,
test_case_dir
,
'--alluredir'
,
'./report/tmp'
])
# 打开报告
# 打开报告
os
.
system
(
'allure serve ./report/tmp'
)
#
os.system('allure serve ./report/tmp')
# 发送钉钉 ()
# 发送钉钉 ()
#
dingTalk.dingTalk_markdown(secret="SEC465015385218e70a94f107a16f72dd33d8fc118c3b2a631e0433685302f2fbb3",
dingTalk
.
dingTalk_markdown
(
secret
=
"SEC465015385218e70a94f107a16f72dd33d8fc118c3b2a631e0433685302f2fbb3"
,
#
webhook="https://oapi.dingtalk.com/robot/send?access_token=229908a83825ed56abbf728d3382e446a4e8a90e9ad302c37a036bcbccbbf9ee",
webhook
=
"https://oapi.dingtalk.com/robot/send?access_token=229908a83825ed56abbf728d3382e446a4e8a90e9ad302c37a036bcbccbbf9ee"
,
#
message="")
message
=
""
)
test_case/bmc/test_accountinfo.py
View file @
75d32f08
...
@@ -15,7 +15,7 @@ from config import BMCConfig
...
@@ -15,7 +15,7 @@ from config import BMCConfig
@allure.epic
(
"账号信息基本功能"
)
@allure.epic
(
"账号信息基本功能"
)
# @allure.feature("账号信息基本功能")
# @allure.feature("账号信息基本功能")
class
TestLogin
():
class
TestLogin
():
workBook
=
xlrd
.
open_workbook
(
f
'{BMCConfig.root_path}/test_case_data/bmc/bmc_
base_info_2021
513.xlsx'
)
workBook
=
xlrd
.
open_workbook
(
f
'{BMCConfig.root_path}/test_case_data/bmc/bmc_
testcase_20210
513.xlsx'
)
@allure.story
(
"账号信息基本功能"
)
@allure.story
(
"账号信息基本功能"
)
@allure.severity
(
""
)
@allure.severity
(
""
)
@allure.title
(
"{inData[testPoint]}"
)
@allure.title
(
"{inData[testPoint]}"
)
...
...
test_case_data/bmc/bmc_testcase_20210513.xlsx
View file @
75d32f08
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