Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
interfaceTest
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李远洪
interfaceTest
Commits
d6986bfa
Commit
d6986bfa
authored
May 25, 2020
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
错误码添加了白名单的功能
parent
70e02810
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
15 deletions
+17
-15
config/config.py
config/config.py
+12
-6
testCase/CarDynamic_interface_cases.py
testCase/CarDynamic_interface_cases.py
+1
-2
testCase/Car_interface_cases.py
testCase/Car_interface_cases.py
+1
-2
testCase/DemoCar_case.py
testCase/DemoCar_case.py
+1
-3
testCase/User_interface_cases.py
testCase/User_interface_cases.py
+2
-2
No files found.
config/config.py
View file @
d6986bfa
...
@@ -4,16 +4,22 @@
...
@@ -4,16 +4,22 @@
SSL_VERIFY
=
True
# 是否开启SSL验证,默认设置为True;需要抓包调试的时候,改为False
SSL_VERIFY
=
True
# 是否开启SSL验证,默认设置为True;需要抓包调试的时候,改为False
TIME_OUT
=
2000
# 设置最大响应超时时间(毫秒)
TIME_OUT
=
2000
# 设置最大响应超时时间(毫秒)
#################### 测试用户参数设置 ##################
#################### 测试用户参数设置 ##################
USER_NAME
=
"13146201116"
# 用户名
# USER_NAME = "13146201116" # 用户名
PASSWORD
=
"Lyh123456"
# 密码
# PASSWORD = "Lyh123456" # 密码
CAR_DIN
=
"M202003060518"
# 车机号
# CAR_DIN = "M202003060518" # 车机号
HOST
=
"api-test.vandyo.com"
# 域名
# HOST = "api-test.vandyo.com" # 域名
USER_NAME
=
"18883284712"
# 用户名
PASSWORD
=
"123456abcdA"
# 密码
CAR_DIN
=
"M502744004592"
# 车机号(可以不用配置)
HOST
=
"api.vandyo.com"
# 域名
# 请求头公共参数
# 请求头公共参数
HEADER
=
{
"Accept-Encoding"
:
"gzip"
,
"Content-Type"
:
"application/json; charset=UTF-8"
}
HEADER
=
{
"Accept-Encoding"
:
"gzip"
,
"Content-Type"
:
"application/json; charset=UTF-8"
}
SID
=
""
SID
=
""
UID
=
""
UID
=
""
CAR_ID
=
""
# 车机id (区别于硬件的车机号)
CAR_ID
=
""
# 车机id (区别于硬件的车机号)
HTTP_PREFIX
=
"http://"
# http url前缀
HTTP_PREFIX
=
"https://"
# http url前缀
IS_ONLINE
=
True
# 车机是否在线
WHITE_LIST_ERROR
=
[
0
,
99
,
3022
]
# 白名单错误码(在白名单里面的错误码不会断言失败)
#################### 体验模式参数设置 ##################
#################### 体验模式参数设置 ##################
EX_HOST
=
"api.vandyo.com"
# 体验模式域名
EX_HOST
=
"api.vandyo.com"
# 体验模式域名
...
...
testCase/CarDynamic_interface_cases.py
View file @
d6986bfa
...
@@ -85,8 +85,7 @@ class CarDynamic_interface_cases(unittest.TestCase):
...
@@ -85,8 +85,7 @@ class CarDynamic_interface_cases(unittest.TestCase):
error
=
result
[
"error"
]
error
=
result
[
"error"
]
self
.
assertEqual
(
statusCode
,
200
,
"响应状态码为:"
+
str
(
statusCode
))
self
.
assertEqual
(
statusCode
,
200
,
"响应状态码为:"
+
str
(
statusCode
))
self
.
assertTrue
(
resTime
<
config
.
TIME_OUT
,
"响应时间大于"
+
str
(
int
(
config
.
TIME_OUT
/
1000
))
+
"秒,响应时间为:"
+
str
(
resTime
)
+
"毫秒"
)
self
.
assertTrue
(
resTime
<
config
.
TIME_OUT
,
"响应时间大于"
+
str
(
int
(
config
.
TIME_OUT
/
1000
))
+
"秒,响应时间为:"
+
str
(
resTime
)
+
"毫秒"
)
# self.assertEqual(error, 0, "接口返回错误:" + str(error) + " content: " + resObj.text)
self
.
assertTrue
(
error
in
config
.
WHITE_LIST_ERROR
,
"接口返回错误"
)
self
.
assertEqual
(
error
,
0
,
"接口返回错误"
)
print
(
"接口响应时间:"
+
str
(
resTime
)
+
"毫秒"
)
print
(
"接口响应时间:"
+
str
(
resTime
)
+
"毫秒"
)
def
startTest
(
self
):
def
startTest
(
self
):
...
...
testCase/Car_interface_cases.py
View file @
d6986bfa
...
@@ -369,8 +369,7 @@ class Car_interface_cases(unittest.TestCase):
...
@@ -369,8 +369,7 @@ class Car_interface_cases(unittest.TestCase):
error
=
result
[
"error"
]
error
=
result
[
"error"
]
self
.
assertEqual
(
statusCode
,
200
,
"响应状态码为:"
+
str
(
statusCode
))
self
.
assertEqual
(
statusCode
,
200
,
"响应状态码为:"
+
str
(
statusCode
))
self
.
assertTrue
(
resTime
<
config
.
TIME_OUT
,
"响应时间大于"
+
str
(
int
(
config
.
TIME_OUT
/
1000
))
+
"秒,响应时间为:"
+
str
(
resTime
)
+
"毫秒"
)
self
.
assertTrue
(
resTime
<
config
.
TIME_OUT
,
"响应时间大于"
+
str
(
int
(
config
.
TIME_OUT
/
1000
))
+
"秒,响应时间为:"
+
str
(
resTime
)
+
"毫秒"
)
# self.assertEqual(error, 0, "接口返回错误:" + str(error) + " content: " + resObj.text)
self
.
assertTrue
(
error
in
config
.
WHITE_LIST_ERROR
,
"接口返回错误"
)
self
.
assertEqual
(
error
,
0
,
"接口返回错误"
)
print
(
"接口响应时间:"
+
str
(
resTime
)
+
"毫秒"
)
print
(
"接口响应时间:"
+
str
(
resTime
)
+
"毫秒"
)
def
startTest
(
self
):
def
startTest
(
self
):
...
...
testCase/DemoCar_case.py
View file @
d6986bfa
...
@@ -112,7 +112,6 @@ class DemoCar_case(unittest.TestCase):
...
@@ -112,7 +112,6 @@ class DemoCar_case(unittest.TestCase):
lastTime
=
int
(
result
[
"result"
][
0
][
"sti"
])
#车机最近一次轨迹的开始时间
lastTime
=
int
(
result
[
"result"
][
0
][
"sti"
])
#车机最近一次轨迹的开始时间
durTime
=
ts
-
lastTime
durTime
=
ts
-
lastTime
self
.
assertTrue
(
durTime
<
11000
,
"demo车机已经有超过3小时未启动,请检查是否出现问题"
)
self
.
assertTrue
(
durTime
<
11000
,
"demo车机已经有超过3小时未启动,请检查是否出现问题"
)
# self.assertTrue(durTime < 3000, "demo车机已经有超过3小时未启动,请检查是否出现问题")
self
.
baseAssert
(
resObj
)
self
.
baseAssert
(
resObj
)
##########################################################
##########################################################
...
@@ -125,8 +124,7 @@ class DemoCar_case(unittest.TestCase):
...
@@ -125,8 +124,7 @@ class DemoCar_case(unittest.TestCase):
error
=
result
[
"error"
]
error
=
result
[
"error"
]
self
.
assertEqual
(
statusCode
,
200
,
"响应状态码为:"
+
str
(
statusCode
))
self
.
assertEqual
(
statusCode
,
200
,
"响应状态码为:"
+
str
(
statusCode
))
self
.
assertTrue
(
resTime
<
config
.
TIME_OUT
,
"响应时间大于"
+
str
(
int
(
config
.
TIME_OUT
/
1000
))
+
"秒,响应时间为:"
+
str
(
resTime
)
+
"毫秒"
)
self
.
assertTrue
(
resTime
<
config
.
TIME_OUT
,
"响应时间大于"
+
str
(
int
(
config
.
TIME_OUT
/
1000
))
+
"秒,响应时间为:"
+
str
(
resTime
)
+
"毫秒"
)
# self.assertEqual(error, 0, "接口返回错误:" + str(error) + " content: " + resObj.text)
self
.
assertTrue
(
error
in
config
.
WHITE_LIST_ERROR
,
"接口返回错误"
)
self
.
assertEqual
(
error
,
0
,
"接口返回错误"
)
print
(
"接口响应时间:"
+
str
(
resTime
)
+
"毫秒"
)
print
(
"接口响应时间:"
+
str
(
resTime
)
+
"毫秒"
)
def
startTest
(
self
):
def
startTest
(
self
):
...
...
testCase/User_interface_cases.py
View file @
d6986bfa
...
@@ -53,6 +53,7 @@ class User_interface_cases(unittest.TestCase):
...
@@ -53,6 +53,7 @@ class User_interface_cases(unittest.TestCase):
print
(
"-------------------------返回结果:-------------------------"
)
print
(
"-------------------------返回结果:-------------------------"
)
print
(
resObj
.
text
)
print
(
resObj
.
text
)
config
.
CAR_ID
=
result
[
"result"
][
0
][
"cid"
]
config
.
CAR_ID
=
result
[
"result"
][
0
][
"cid"
]
config
.
CAR_ID
=
result
[
"result"
][
0
][
"din"
]
##########################################################
##########################################################
# 商品列表
# 商品列表
...
@@ -292,8 +293,7 @@ class User_interface_cases(unittest.TestCase):
...
@@ -292,8 +293,7 @@ class User_interface_cases(unittest.TestCase):
error
=
result
[
"error"
]
error
=
result
[
"error"
]
self
.
assertEqual
(
statusCode
,
200
,
"响应状态码为:"
+
str
(
statusCode
))
self
.
assertEqual
(
statusCode
,
200
,
"响应状态码为:"
+
str
(
statusCode
))
self
.
assertTrue
(
resTime
<
config
.
TIME_OUT
,
"响应时间大于"
+
str
(
int
(
config
.
TIME_OUT
/
1000
))
+
"秒,响应时间为:"
+
str
(
resTime
)
+
"毫秒"
)
self
.
assertTrue
(
resTime
<
config
.
TIME_OUT
,
"响应时间大于"
+
str
(
int
(
config
.
TIME_OUT
/
1000
))
+
"秒,响应时间为:"
+
str
(
resTime
)
+
"毫秒"
)
# self.assertEqual(error, 0, "接口返回错误:" + str(error) + " content: " + resObj.text)
self
.
assertTrue
(
error
in
config
.
WHITE_LIST_ERROR
,
"接口返回错误"
)
self
.
assertEqual
(
error
,
0
,
"接口返回错误"
)
print
(
"接口响应时间:"
+
str
(
resTime
)
+
"毫秒"
)
print
(
"接口响应时间:"
+
str
(
resTime
)
+
"毫秒"
)
def
startTest
(
self
):
def
startTest
(
self
):
...
...
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