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
055557ec
Commit
055557ec
authored
Dec 07, 2018
by
赵然
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'zr' into develop
parents
a2b0fc70
600a77d2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
24 deletions
+38
-24
CustomActivity_DuibaTest.java
...p/cases/DefinedActivityTest/CustomActivity_DuibaTest.java
+1
-0
答题_答对题数抽奖_DuibaTest.java
...a/http/cases/DefinedActivityTest/答题_答对题数抽奖_DuibaTest.java
+25
-12
无积分测试_DuibaTest.java
...test/java/http/cases/NewActivityTest/无积分测试_DuibaTest.java
+2
-2
ActivityCtrlService.java
src/test/java/http/service/hd/ActivityCtrlService.java
+10
-10
No files found.
src/test/java/http/cases/DefinedActivityTest/CustomActivity_DuibaTest.java
View file @
055557ec
...
@@ -253,6 +253,7 @@ public class CustomActivity_DuibaTest extends DuibaTestBase {
...
@@ -253,6 +253,7 @@ public class CustomActivity_DuibaTest extends DuibaTestBase {
String
orderId
=
response
.
jsonPath
().
getString
(
"orderId"
);
String
orderId
=
response
.
jsonPath
().
getString
(
"orderId"
);
newActivityService
.
submit
(
orderId
);
newActivityService
.
submit
(
orderId
);
Thread
.
sleep
(
1000
);
response
=
newActivityService
.
getOrderStatus2
(
orderId
,
device
);
response
=
newActivityService
.
getOrderStatus2
(
orderId
,
device
);
String
result
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"result"
));
String
result
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"result"
));
int
i
=
8
;
int
i
=
8
;
...
...
src/test/java/http/cases/DefinedActivityTest/答题_答对题数抽奖_DuibaTest.java
View file @
055557ec
...
@@ -61,19 +61,32 @@ public class 答题_答对题数抽奖_DuibaTest extends AbstractTestNGSpringCon
...
@@ -61,19 +61,32 @@ public class 答题_答对题数抽奖_DuibaTest extends AbstractTestNGSpringCon
Assert
.
assertEquals
(
submitResponse
.
jsonPath
().
getString
(
"message"
),
message
);
Assert
.
assertEquals
(
submitResponse
.
jsonPath
().
getString
(
"message"
),
message
);
}
else
{
}
else
{
Assert
.
assertEquals
(
submitResponse
.
jsonPath
().
getInt
(
"rightCount"
),
rightCount
);
Assert
.
assertEquals
(
submitResponse
.
jsonPath
().
getInt
(
"rightCount"
),
rightCount
);
for
(
int
i
=
1
;
i
<=
5
;
i
++)
{
// for (int i =1; i <= 5; i++) {
//获取中奖结果,校验中奖结果
// //获取中奖结果,校验中奖结果
Response
lotterysResponse
=
activityCtrlService
.
getOrderStatus
(
orderId
);
// Response lotterysResponse = activityCtrlService.getOrderStatus(orderId);
int
result
=
lotterysResponse
.
jsonPath
().
getInt
(
"result"
);
// int result = lotterysResponse.jsonPath().getInt("result");
if
(
result
!=
0
)
{
// if(result != 0) {
Assert
.
assertTrue
(
lotterysResponse
.
jsonPath
().
getBoolean
(
"success"
));
// Assert.assertTrue(lotterysResponse.jsonPath().getBoolean("success"));
// Assert.assertEquals(lotterysResponse.jsonPath().getString("lottery.type"),prize);
// // Assert.assertEquals(lotterysResponse.jsonPath().getString("lottery.type"),prize);
Assert
.
assertTrue
(
prize
.
contains
(
lotterysResponse
.
jsonPath
().
getString
(
"lottery.type"
)));
// Assert.assertTrue(prize.contains(lotterysResponse.jsonPath().getString("lottery.type")));
break
;
// break;
}
// }
Thread
.
sleep
(
500
);
// Thread.sleep(500);
// }
Thread
.
sleep
(
2000
);
Response
lotterysResponse
=
activityCtrlService
.
getOrderStatus
(
orderId
);
String
result
=
lotterysResponse
.
jsonPath
().
getString
(
"result"
);
int
i
=
30
;
while
(
i
>
0
&&(
result
.
equals
(
"0"
))){
Thread
.
sleep
(
1000
);
lotterysResponse
=
activityCtrlService
.
getOrderStatus
(
orderId
);
result
=
lotterysResponse
.
jsonPath
().
getString
(
"result"
);
i
--;
lotterysResponse
.
prettyPrint
();
}
}
Assert
.
assertFalse
(
false
,
caseDesc
+
" 测试失败,轮询5次未请求到中奖结果"
);
Assert
.
assertTrue
(
lotterysResponse
.
jsonPath
().
getBoolean
(
"success"
));
Assert
.
assertTrue
(
prize
.
contains
(
lotterysResponse
.
jsonPath
().
getString
(
"lottery.type"
)));
// Assert.assertFalse(false,caseDesc+" 测试失败,轮询5次未请求到中奖结果");
}
}
}
}
...
...
src/test/java/http/cases/NewActivityTest/无积分测试_DuibaTest.java
View file @
055557ec
...
@@ -62,7 +62,7 @@ public class 无积分测试_DuibaTest extends DuibaTestBase {
...
@@ -62,7 +62,7 @@ public class 无积分测试_DuibaTest extends DuibaTestBase {
Assert
.
assertEquals
(
response_ajax
.
jsonPath
().
getString
(
"element.status"
),
"4"
,
"校验status失败"
);
Assert
.
assertEquals
(
response_ajax
.
jsonPath
().
getString
(
"element.status"
),
"4"
,
"校验status失败"
);
logger
.
info
(
"ajax校验项:status成功"
);
logger
.
info
(
"ajax校验项:status成功"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"message"
),
"永久次数已用完"
,
"校验message失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"message"
),
"永久次数已用完"
,
"校验message失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"status"
),
"
3
"
,
"校验status失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"status"
),
"
4
"
,
"校验status失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"false"
,
"校验success失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"false"
,
"校验success失败"
);
logger
.
info
(
"doJoin校验项:message,status,success成功"
);
logger
.
info
(
"doJoin校验项:message,status,success成功"
);
break
;
break
;
...
@@ -84,7 +84,7 @@ public class 无积分测试_DuibaTest extends DuibaTestBase {
...
@@ -84,7 +84,7 @@ public class 无积分测试_DuibaTest extends DuibaTestBase {
}
}
//切换回2720用户
//切换回2720用户
authorization
.
dafuwengLogin
(
2720
,
true
);
//
authorization.dafuwengLogin(2720,true);
}
}
...
...
src/test/java/http/service/hd/ActivityCtrlService.java
View file @
055557ec
...
@@ -48,8 +48,8 @@ public class ActivityCtrlService {
...
@@ -48,8 +48,8 @@ public class ActivityCtrlService {
params
.
put
(
"actId"
,
actId
);
params
.
put
(
"actId"
,
actId
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
params
(
params
)
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
params
(
params
)
.
post
(
activityHost
+
"/
newActivity
/ajaxElement"
);
.
post
(
activityHost
+
"/
hdtool
/ajaxElement"
);
logger
.
info
(
"请求/
newActivity
/ajaxElement接口,响应结果:"
+
response
.
asString
());
logger
.
info
(
"请求/
hdtool
/ajaxElement接口,响应结果:"
+
response
.
asString
());
return
response
;
return
response
;
}
}
...
@@ -58,8 +58,8 @@ public class ActivityCtrlService {
...
@@ -58,8 +58,8 @@ public class ActivityCtrlService {
params
.
put
(
"activityId"
,
activityId
);
params
.
put
(
"activityId"
,
activityId
);
params
.
put
(
"token"
,
token
);
params
.
put
(
"token"
,
token
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
params
(
params
)
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
params
(
params
)
.
post
(
activityHost
+
"/
newActivity
/doJoin"
);
.
post
(
activityHost
+
"/
hdtool
/doJoin"
);
logger
.
info
(
"请求/
newActivity
/doJoin接口,响应结果:"
+
response
.
asString
());
logger
.
info
(
"请求/
hdtool
/doJoin接口,响应结果:"
+
response
.
asString
());
return
response
;
return
response
;
}
}
...
@@ -84,8 +84,8 @@ public class ActivityCtrlService {
...
@@ -84,8 +84,8 @@ public class ActivityCtrlService {
params
.
put
(
"answerData"
,
answerData
);
params
.
put
(
"answerData"
,
answerData
);
params
.
put
(
"token"
,
token
);
params
.
put
(
"token"
,
token
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
params
(
params
)
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
params
(
params
)
.
post
(
activityHost
+
"/
newActivity
/submit"
);
.
post
(
activityHost
+
"/
hdtool
/submit"
);
logger
.
info
(
"请求/
newActivity
/submit接口,响应结果:"
+
response
.
asString
());
logger
.
info
(
"请求/
hdtool
/submit接口,响应结果:"
+
response
.
asString
());
return
response
;
return
response
;
}
}
...
@@ -96,14 +96,14 @@ public class ActivityCtrlService {
...
@@ -96,14 +96,14 @@ public class ActivityCtrlService {
*/
*/
public
Response
getOrderStatus
(
long
orderId
)
throws
Exception
{
public
Response
getOrderStatus
(
long
orderId
)
throws
Exception
{
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
param
(
"orderId"
,
orderId
)
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
param
(
"orderId"
,
orderId
)
.
post
(
activityHost
+
"/
newActivity
/getOrderStatus"
);
.
post
(
activityHost
+
"/
hdtool
/getOrderStatus"
);
logger
.
info
(
"请求/
newActivity
/getOrderStatus接口,响应结果:"
+
response
.
asString
());
logger
.
info
(
"请求/
hdtool
/getOrderStatus接口,响应结果:"
+
response
.
asString
());
try
{
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
throw
new
Exception
(
"/
newActivity
/getOrderStatus接口失败,返回信息:"
+
response
.
asString
());
throw
new
Exception
(
"/
hdtool
/getOrderStatus接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
}
catch
(
Error
er
){
throw
new
Exception
(
"/
newActivity
/getOrderStatus接口失败,返回信息:"
+
response
.
asString
());
throw
new
Exception
(
"/
hdtool
/getOrderStatus接口失败,返回信息:"
+
response
.
asString
());
}
}
return
response
;
return
response
;
...
...
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