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
4827eb11
Commit
4827eb11
authored
Nov 01, 2018
by
赵然
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'zr' into develop
parents
0fc90c7a
a1b3edd9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
16 deletions
+17
-16
新活动工具测试_DuibaTest.java
...st/java/http/cases/NewActivityTest/新活动工具测试_DuibaTest.java
+15
-14
NewActivityService.java
src/test/java/http/service/Activity/NewActivityService.java
+2
-2
No files found.
src/test/java/http/cases/NewActivityTest/新活动工具测试_DuibaTest.java
View file @
4827eb11
...
...
@@ -26,11 +26,12 @@ public class 新活动工具测试_DuibaTest extends DuibaTestBase {
ActivityService
activityService
;
private
static
DuibaLog
logger
=
DuibaLog
.
getLogger
();
private
static
int
uid
=
4259
;
@Test
public
void
福袋商品测试
()
throws
Exception
{
logger
.
info
(
"-------------------------------------活动中奖福袋商品-------------------------------------"
);
Response
response
=
this
.
新活动工具接口传参
(
"18567"
,
"1gffs6mq3"
,
"iOS
"
);
Response
response
=
this
.
新活动工具接口传参
(
uid
,
"18567"
,
"1gffs6mq3
"
);
//String type = String.valueOf(response.jsonPath().getString("lottery.type"));
//推啊出券系统检测
// if(activityService.isRunning("10.110.10.12","17791","tuia-engine")){
...
...
@@ -53,7 +54,7 @@ public class 新活动工具测试_DuibaTest extends DuibaTestBase {
@Test
public
void
谢谢参与转福袋测试
()
throws
Exception
{
logger
.
info
(
"-------------------------------------活动中奖谢谢参与转福袋-------------------------------------"
);
Response
response
=
this
.
新活动工具接口传参
(
"26640"
,
"1gffs6mq3"
,
"iOS
"
);
Response
response
=
this
.
新活动工具接口传参
(
uid
,
"26640"
,
"1gffs6mq3
"
);
//String type = String.valueOf(response.jsonPath().getString("lottery.type"));
//推啊出券系统检测
// if(activityService.isRunning("10.110.10.12","17791","tuia-engine")){
...
...
@@ -75,14 +76,14 @@ public class 新活动工具测试_DuibaTest extends DuibaTestBase {
@Test
public
void
免费次数测试
()
throws
Exception
{
Response
response1
=
newActivityService
.
ajaxElement
(
"3251"
,
"19114"
);
Response
response1
=
newActivityService
.
ajaxElement
(
uid
,
"3251"
,
"19114"
);
String
freeLimit
=
String
.
valueOf
(
response1
.
jsonPath
().
getString
(
"element.freeLimit"
));
logger
.
info
(
"抽奖前剩余免费抽奖次数:"
+
freeLimit
);
freeLimit
=
String
.
valueOf
(
Integer
.
valueOf
(
freeLimit
)-
1
);
Response
response
=
this
.
新活动工具接口传参
(
"19114"
,
"ogw24k6ns"
,
"iOS
"
);
Response
response
=
this
.
新活动工具接口传参
(
uid
,
"19114"
,
"ogw24k6ns
"
);
Thread
.
sleep
(
1000
);
Response
response2
=
newActivityService
.
ajaxElement
(
"3251"
,
"19114"
);
Response
response2
=
newActivityService
.
ajaxElement
(
uid
,
"3251"
,
"19114"
);
String
freeLimitNew
=
String
.
valueOf
(
response2
.
jsonPath
().
getString
(
"element.freeLimit"
));
logger
.
info
(
"抽奖后剩余免费抽奖次数:"
+
freeLimitNew
);
...
...
@@ -94,14 +95,14 @@ public class 新活动工具测试_DuibaTest extends DuibaTestBase {
@Test
public
void
再抽一次测试
()
throws
Exception
{
//查询数据库,当前积分(抽奖扣积分流程校验)
Map
<
String
,
Object
>
mapuser
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id=
2720"
);
Map
<
String
,
Object
>
mapuser
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id=
"
+
uid
);
String
credits
=
String
.
valueOf
(
mapuser
.
get
(
"credits"
));
logger
.
info
(
"抽奖前积分:"
+
credits
);
//扣去1积分
credits
=
String
.
valueOf
(
Integer
.
valueOf
(
credits
)-
1
);
//第一次抽奖
Response
response
=
this
.
新活动工具接口传参
(
"18580"
,
"m8rhchc"
,
"iOS
"
);
Response
response
=
this
.
新活动工具接口传参
(
uid
,
"18580"
,
"m8rhchc
"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lottery.type"
),
"again"
,
"校验type失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lottery.id"
),
"11608"
,
"校验id失败"
);
...
...
@@ -109,7 +110,7 @@ public class 新活动工具测试_DuibaTest extends DuibaTestBase {
logger
.
info
(
"校验:type,id,result成功"
);
//第一次抽奖后查询数据库,获取当前积分
mapuser
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id=
2720"
);
mapuser
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id=
"
+
uid
);
String
creditsNew
=
String
.
valueOf
(
mapuser
.
get
(
"credits"
));
logger
.
info
(
"第一次抽奖后积分:"
+
creditsNew
);
//校验比较,抽奖前后积分
...
...
@@ -117,11 +118,11 @@ public class 新活动工具测试_DuibaTest extends DuibaTestBase {
logger
.
info
(
"校验第一次抽奖前后积分正确"
);
//第二次抽奖
response
=
newActivityService
.
doJoin2
(
"18580"
,
"m8rhchc"
,
response
.
jsonPath
().
getString
(
"againTag"
));
response
=
newActivityService
.
doJoin2
(
uid
,
"18580"
,
"m8rhchc"
,
response
.
jsonPath
().
getString
(
"againTag"
));
response
.
prettyPrint
();
Thread
.
sleep
(
2000
);
//第二次抽奖后查询数据库,获取当前积分
mapuser
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id=
2720"
);
mapuser
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id=
"
+
uid
);
String
creditsNew2
=
String
.
valueOf
(
mapuser
.
get
(
"credits"
));
logger
.
info
(
"第二次抽奖后积分:"
+
creditsNew2
);
//校验比较,抽奖前后积分
...
...
@@ -129,18 +130,18 @@ public class 新活动工具测试_DuibaTest extends DuibaTestBase {
logger
.
info
(
"校验第二次抽奖前后积分正确"
);
}
public
Response
新活动工具接口传参
(
String
activityId
,
String
token
,
String
device
)
throws
Exception
{
Response
response
=
newActivityService
.
doJoin2
(
activityId
,
token
);
public
Response
新活动工具接口传参
(
int
uid
,
String
activityId
,
String
token
)
throws
Exception
{
Response
response
=
newActivityService
.
doJoin2
(
uid
,
activityId
,
token
);
response
.
prettyPrint
();
String
orderId
=
response
.
jsonPath
().
getString
(
"orderId"
);
response
=
newActivityService
.
getOrderStatus2
(
orderId
,
device
);
response
=
newActivityService
.
getOrderStatus2
(
uid
,
orderId
);
response
.
prettyPrint
();
String
result
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"result"
));
int
i
=
30
;
while
(
i
>
0
&&(
result
.
equals
(
"0"
))){
Thread
.
sleep
(
1000
);
response
=
newActivityService
.
getOrderStatus2
(
orderId
,
device
);
response
=
newActivityService
.
getOrderStatus2
(
uid
,
orderId
);
result
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"result"
));
i
--;
response
.
prettyPrint
();
...
...
src/test/java/http/service/Activity/NewActivityService.java
View file @
4827eb11
...
...
@@ -113,13 +113,13 @@ public class NewActivityService {
return
response
;
}
public
Response
doJoin2
(
String
activityId
,
String
token
,
String
orderId
)
throws
Exception
{
public
Response
doJoin2
(
int
uid
,
String
activityId
,
String
token
,
String
orderId
)
throws
Exception
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"activityId"
,
activityId
);
map
.
put
(
"token"
,
token
);
map
.
put
(
"againOrderId"
,
orderId
);
logger
.
info
(
"请求/hdtool/doJoin接口,activityId="
+
activityId
);
Response
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
2720
)).
params
(
map
).
post
(
url
+
"/hdtool/doJoin"
);
Response
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
params
(
map
).
post
(
url
+
"/hdtool/doJoin"
);
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
);
}
catch
(
Exception
e
){
...
...
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