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
4a124a52
Commit
4a124a52
authored
May 02, 2021
by
taoke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加读取excle方法
parent
c8dda65a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
4 deletions
+32
-4
common/db.py
+0
-2
common/utils/encryption.py
+2
-2
common/utils/getExcelData.py
+30
-0
No files found.
common/db.py
View file @
4a124a52
...
@@ -82,5 +82,4 @@ if __name__ == '__main__':
...
@@ -82,5 +82,4 @@ if __name__ == '__main__':
# r = RedisString(0).get('edl:sms_value:17822000010:MOBILE_REGISTER')
# r = RedisString(0).get('edl:sms_value:17822000010:MOBILE_REGISTER')
# print(r)
# print(r)
# print(str(r)[-7:-1])
# print(str(r)[-7:-1])
pass
pass
\ No newline at end of file
common/utils/encryption.py
View file @
4a124a52
import
hashlib
import
hashlib
#
from Crypto.Cipher import AES
from
Crypto.Cipher
import
AES
#
from Crypto.Util.Padding import pad
from
Crypto.Util.Padding
import
pad
from
base64
import
encodebytes
from
base64
import
encodebytes
...
...
common/utils/getExcelData.py
0 → 100644
View file @
4a124a52
import
xlrd
,
re
,
json
workBook
=
xlrd
.
open_workbook
(
'../data/营运车接口测试用例V1.0.xls'
)
# 可以自动识别用例数
def
get_excelData
(
sheetName
,
caseName
):
"""
:param sheetName: sheet表名
:param caseName: 从excle中第一列编号 选择 要执行的编号(字母)
:return: # [({参数},{期望}),({},{}),({},{})]
"""
workSheet
=
workBook
.
sheet_by_name
(
sheetName
)
lis
=
[]
idx
=
0
try
:
for
one
in
workSheet
.
col_values
(
0
):
result
=
''
.
join
(
re
.
findall
(
r'[A-Za-z]'
,
one
))
# 抽取字母字符串
if
caseName
==
result
:
colData
=
workSheet
.
cell_value
(
idx
,
9
)
colexpect
=
workSheet
.
cell_value
(
idx
,
11
)
lis
.
append
((
json
.
loads
(
colData
),
json
.
loads
(
colexpect
)))
# 如果读取excle想获取字典,表中就必须是json字符串
idx
+=
1
return
lis
except
:
print
(
"excle中参数和期望不是 json字符串"
)
\ No newline at end of file
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