Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
test-platform
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
马博
test-platform
Commits
de520450
Commit
de520450
authored
Dec 03, 2018
by
赵然
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'mabo' of gitlab2.dui88.com:mabo/test-platform into mabo
parents
a8ad2db3
1279dbc5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
1 deletion
+28
-1
抽奖异常测试_DuibaTest.java
...est/java/http/cases/NewActivityTest/抽奖异常测试_DuibaTest.java
+5
-1
NewActivityService.java
src/test/java/http/service/Activity/NewActivityService.java
+20
-0
Authorization.java
src/test/java/http/service/Authorization.java
+3
-0
No files found.
src/test/java/http/cases/NewActivityTest/抽奖异常测试_DuibaTest.java
View file @
de520450
...
@@ -152,7 +152,11 @@ public class 抽奖异常测试_DuibaTest extends DuibaTestBase {
...
@@ -152,7 +152,11 @@ public class 抽奖异常测试_DuibaTest extends DuibaTestBase {
//获取未登录场景cookie
//获取未登录场景cookie
Response
responses
=
authorization
.
autoLogin
();
Response
responses
=
authorization
.
autoLogin
();
//进行接口测试传参
//进行接口测试传参
Response
response
=
newActivityService
.
doJoin
(
responses
.
getDetailedCookies
(),
data
.
get
(
"token"
),
data
.
get
(
"activityId"
));
Map
<
String
,
String
>
map
=
responses
.
getCookies
();
logger
.
info
(
"cookies:"
+
map
.
toString
());
if
(
responses
.
getDetailedCookies
()==
null
)
logger
.
info
(
"cookies = = null"
);
Response
response
=
newActivityService
.
doJoinMap
(
map
,
data
.
get
(
"token"
),
data
.
get
(
"activityId"
));
// Response response = newActivityService.doJoin(responses.getDetailedCookies(),data.get("token"),data.get("activityId"));
response
.
prettyPrint
();
response
.
prettyPrint
();
String
success
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"success"
));
String
success
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"success"
));
//根据case选择校验项
//根据case选择校验项
...
...
src/test/java/http/service/Activity/NewActivityService.java
View file @
de520450
...
@@ -68,6 +68,26 @@ public class NewActivityService {
...
@@ -68,6 +68,26 @@ public class NewActivityService {
map
.
put
(
"oaId"
,
activityId
);
map
.
put
(
"oaId"
,
activityId
);
logger
.
info
(
"请求/hdtool/doJoin接口,activityId="
+
activityId
);
logger
.
info
(
"请求/hdtool/doJoin接口,activityId="
+
activityId
);
logger
.
info
(
"url:"
+
url
+
"/hdtool/doJoin"
);
Response
response
=
given
().
cookies
(
cookies
).
params
(
map
).
post
(
url
+
"/hdtool/doJoin"
);
try
{
Assert
.
assertEquals
(
String
.
valueOf
(
response
.
getStatusCode
()),
"200"
);
logger
.
info
(
"/hdtool/doJoin接口成功,返回信息:"
+
response
.
asString
());
}
catch
(
Exception
e
){
throw
new
Exception
(
"/hdtool/doJoin接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"/hdtool/doJoin接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
public
Response
doJoinMap
(
Map
cookies
,
String
token
,
String
activityId
)
throws
Exception
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"token"
,
token
);
map
.
put
(
"activityId"
,
activityId
);
map
.
put
(
"oaId"
,
activityId
);
logger
.
info
(
"请求/hdtool/doJoin接口,activityId="
+
activityId
);
logger
.
info
(
"url:"
+
url
+
"/hdtool/doJoin"
);
Response
response
=
given
().
cookies
(
cookies
).
params
(
map
).
post
(
url
+
"/hdtool/doJoin"
);
Response
response
=
given
().
cookies
(
cookies
).
params
(
map
).
post
(
url
+
"/hdtool/doJoin"
);
try
{
try
{
Assert
.
assertEquals
(
String
.
valueOf
(
response
.
getStatusCode
()),
"200"
);
Assert
.
assertEquals
(
String
.
valueOf
(
response
.
getStatusCode
()),
"200"
);
...
...
src/test/java/http/service/Authorization.java
View file @
de520450
...
@@ -167,6 +167,9 @@ public class Authorization {
...
@@ -167,6 +167,9 @@ public class Authorization {
String
url
=
tool
.
buildUrlWithSign
(
"http://activity.m.duibatest.com.cn/autoLogin/autologin?"
,
params
);
String
url
=
tool
.
buildUrlWithSign
(
"http://activity.m.duibatest.com.cn/autoLogin/autologin?"
,
params
);
logger
.
info
(
"dafuweng免登陆url为:"
+
url
);
logger
.
info
(
"dafuweng免登陆url为:"
+
url
);
Response
response
=
given
().
redirects
().
follow
(
false
).
get
(
url
);
Response
response
=
given
().
redirects
().
follow
(
false
).
get
(
url
);
logger
.
info
(
"dafuweng免登陆,响应数据:"
+
response
.
asString
());
logger
.
info
(
"dafuweng免登陆,响应状态码:"
+
response
.
getStatusCode
());
return
response
;
return
response
;
}
}
public
Map
generateSignAutoLogin
(
String
appKey
,
int
uid
){
public
Map
generateSignAutoLogin
(
String
appKey
,
int
uid
){
...
...
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