Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
API-Automation
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
文鑫
API-Automation
Commits
8935151d
Commit
8935151d
authored
Jul 01, 2020
by
文鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改data,增加删除数据源
parent
40ea7e1a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
12 deletions
+9
-12
data/data.xlsx
+0
-0
test_DataA.py
+9
-12
No files found.
data/data.xlsx
View file @
8935151d
No preview for this file type
test_
System
.py
→
test_
DataA
.py
View file @
8935151d
...
@@ -4,34 +4,31 @@ _date_ = '2020/6/11 11:03'
...
@@ -4,34 +4,31 @@ _date_ = '2020/6/11 11:03'
import
requests
import
requests
import
allure
import
allure
import
pytest
import
pytest
from
common
import
get
Header
from
common
import
get
SourceId
from
common.getData
import
DoExcelByPandas
from
common.getData
import
DoExcelByPandas
@allure.feature
(
'系统设置'
)
@allure.feature
(
'系统设置'
)
class
TestSystem
():
class
TestSystem
():
parametrize
=
DoExcelByPandas
()
.
get_data_for_pytest
(
'./data/data.xlsx'
,
'Sheet1'
)
parametrize
=
DoExcelByPandas
()
.
get_data_for_pytest
(
'./data/data.xlsx'
,
'Sheet1'
)
# data = DoExcelByPandas.get_data_for_allure('./data/data.xlsx','Sheet1')
# def setup_class(self):
# print("setup_function:在用例执行前执行")
# def teardown_class(self):
# print("teardown_function:在用例执行后执行")
@allure.title
(
'{story}'
)
@allure.title
(
'{story}'
)
@pytest.mark.parametrize
(
'id,url,data,story,method,severity,condition,except_result'
,
parametrize
)
@pytest.mark.parametrize
(
'id,url,data,story,method,severity,condition,except_result'
,
parametrize
)
def
test
(
self
,
id
,
url
,
data
,
story
,
method
,
severity
,
condition
,
except_result
):
# test开头的测试函数
def
test
(
self
,
id
,
url
,
data
,
story
,
method
,
severity
,
condition
,
except_result
):
# test开头的测试函数
# print('正在执行',story)
# headers = getHeader.get_Header()
url
=
url
url
=
url
if
method
==
'post'
:
if
story
==
'删除mysql数据源'
or
story
==
'删除oracle数据源'
:
id
=
getSourceId
.
get_SourceId
(
data
)
url
=
url
+
id
r
=
requests
.
post
(
url
=
url
)
elif
method
==
'post'
:
json
=
eval
(
data
)
json
=
eval
(
data
)
r
=
requests
.
post
(
url
=
url
,
json
=
json
)
r
=
requests
.
post
(
url
=
url
,
json
=
json
)
el
se
:
el
if
method
==
'get'
:
r
=
requests
.
get
(
url
=
url
)
r
=
requests
.
get
(
url
=
url
)
response
=
r
.
json
()
response
=
r
.
json
()
# print (type(response[condition]))
# print (type(response[condition]))
assert
response
[
condition
]
==
str
(
except_result
)
assert
response
[
condition
]
==
str
(
except_result
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
pytest
.
main
([
'-s'
,
'test_
System
.py'
])
#-s参数是为了显示用例的打印信息。 -q参数只显示结果,不显示过程
pytest
.
main
([
'-s'
,
'test_
DataA
.py'
])
#-s参数是为了显示用例的打印信息。 -q参数只显示结果,不显示过程
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