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
027eeafe
Commit
027eeafe
authored
Dec 06, 2018
by
赵然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zr
parent
b71cf568
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
175 additions
and
3 deletions
+175
-3
补给站.java
src/test/java/http/cases/SaasDeveloperTest/补给站.java
+1
-1
自有单抽限制_AccessTest.java
.../java/http/cases/SingleLotteryTest/自有单抽限制_AccessTest.java
+174
-2
No files found.
src/test/java/http/cases/SaasDeveloperTest/补给站.java
View file @
027eeafe
...
@@ -35,7 +35,7 @@ public class 补给站 extends DuibaTestBase {
...
@@ -35,7 +35,7 @@ public class 补给站 extends DuibaTestBase {
developerBJZ
.
ajaxDirectUp
(
appId
,
id
);
developerBJZ
.
ajaxDirectUp
(
appId
,
id
);
//查询商品列表,验证商品是否上架成功
//查询商品列表,验证商品是否上架成功
Response
response2
=
developerObjectService
.
appItems
(
appId
,
title
);
Response
response2
=
developerObjectService
.
appItems
(
appId
,
title
);
String
appItemId
=
String
.
valueOf
(
response2
.
jsonPath
().
getString
(
"data.list[0].id"
));
String
appItemId
=
String
.
valueOf
(
response2
.
jsonPath
().
getString
(
"data.list[0].id"
));
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].title"
),
"测试至尊享版-实物3"
,
"校验实物标题失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].title"
),
"测试至尊享版-实物3"
,
"校验实物标题失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].status"
),
"1"
,
"校验实物状态失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].status"
),
"1"
,
"校验实物状态失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].type"
),
"object"
,
"校验实物类型失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].type"
),
"object"
,
"校验实物类型失败"
);
...
...
src/test/java/http/cases/SingleLotteryTest/自有单抽限制_AccessTest.java
View file @
027eeafe
...
@@ -36,14 +36,28 @@ public class 自有单抽限制_AccessTest extends DuibaTestBase {
...
@@ -36,14 +36,28 @@ public class 自有单抽限制_AccessTest extends DuibaTestBase {
//指定用户
//指定用户
private
static
int
uid
=
4881
;
private
static
int
uid
=
4881
;
private
static
int
uid2
=
4882
;
private
static
int
uid2
=
4882
;
private
static
int
uid3
=
2709
;
private
static
int
uid3
=
4883
;
private
static
int
uid4
=
2709
;
private
static
int
uid4
=
4884
;
private
static
int
uid5
=
4885
;
private
static
int
uid6
=
4886
;
@BeforeClass
@BeforeClass
public
void
before
()
{
public
void
before
()
{
try
{
try
{
//清除每日用户抽奖限制记录
RedisUtil
.
clearKey
(
"AC_K001_36686_"
+
getTime
(
0
));
RedisUtil
.
clearKey
(
"AC_K001_36686_"
+
getTime
(
0
));
//清除永久用户抽奖限制记录
jdbc
.
update
(
"delete from ckvtable.tb_kvtable_0804 where vkey = 'activity-centerjoinNum_100109092_36708'"
);
jdbc
.
update
(
"delete from ckvtable.tb_kvtable_0804 where vkey = 'activity-centerjoinNum_100109092_36708'"
);
//清除每日用户免费抽奖记录
RedisUtil
.
clearKey
(
"AC_K002_36685_"
+
getTime
(
0
));
//清除永久用户免费抽奖记录
jdbc
.
update
(
"delete from ckvtable.tb_kvtable_0830 where vkey = 'activity-centerfreeNum_100109118_36731'"
);
//清除永久用户中奖一次记录
jdbc
.
update
(
"delete from ckvtable.tb_kvtable_0831 where vkey = 'activity-centerwinOptionNum_100109119_36687_sigleLottery1'"
);
jdbc
.
update
(
"delete from ckvtable.tb_kvtable_0831 where vkey = 'activity-centerwinOptionNum_100109119_36687_sigleLottery0'"
);
//清除每日用户中奖一次记录
jdbc
.
update
(
"delete from credits_dev.single_lottery_order where consumer_id = '100109120' and prize_name = '自动化单抽实物'"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
@@ -94,6 +108,164 @@ public class 自有单抽限制_AccessTest extends DuibaTestBase {
...
@@ -94,6 +108,164 @@ public class 自有单抽限制_AccessTest extends DuibaTestBase {
logger
.
info
(
"校验success、lotteryButtonStatus、message正确"
);
logger
.
info
(
"校验success、lotteryButtonStatus、message正确"
);
}
}
@Test
public
void
每日免费抽奖限制
()
throws
Exception
{
//查询数据库,当前积分(抽奖扣积分流程校验)
Map
<
String
,
Object
>
mapuser
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id="
+
uid3
);
String
credits
=
String
.
valueOf
(
mapuser
.
get
(
"credits"
));
logger
.
info
(
"第一次抽奖前积分:"
+
credits
);
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"operationAcitvityId"
,
"36685"
);
map
.
put
(
"oaId"
,
"36685"
);
map
.
put
(
"token"
,
"12321"
);
Response
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid3
)).
params
(
map
).
post
(
activityHost
+
"/singleLottery/doJoin"
);
response
.
print
();
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
,
"校验success失败"
);
//查询数据库,当前积分(抽奖扣积分流程校验)
mapuser
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id="
+
uid3
);
String
credits2
=
String
.
valueOf
(
mapuser
.
get
(
"credits"
));
logger
.
info
(
"第一次抽奖后积分:"
+
credits2
);
Assert
.
assertEquals
(
credits
,
credits2
,
"校验免费抽奖失败"
);
credits2
=
String
.
valueOf
(
Integer
.
valueOf
(
credits2
)-
1
);
Thread
.
sleep
(
1000
);
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid3
)).
params
(
map
).
post
(
activityHost
+
"/singleLottery/doJoin"
);
response
.
print
();
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
,
"校验success失败"
);
//查询数据库,当前积分(抽奖扣积分流程校验)
mapuser
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id="
+
uid3
);
String
credits3
=
String
.
valueOf
(
mapuser
.
get
(
"credits"
));
logger
.
info
(
"第二次抽奖后积分:"
+
credits3
);
Assert
.
assertEquals
(
credits3
,
credits2
,
"校验扣积分抽奖失败"
);
logger
.
info
(
"校验每日一次免费抽奖限制正确"
);
}
@Test
public
void
永久免费抽奖限制
()
throws
Exception
{
//查询数据库,当前积分(抽奖扣积分流程校验)
Map
<
String
,
Object
>
mapuser
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id="
+
uid4
);
String
credits
=
String
.
valueOf
(
mapuser
.
get
(
"credits"
));
logger
.
info
(
"第一次抽奖前积分:"
+
credits
);
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"operationAcitvityId"
,
"36731"
);
map
.
put
(
"oaId"
,
"36731"
);
map
.
put
(
"token"
,
"12321"
);
Response
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid4
)).
params
(
map
).
post
(
activityHost
+
"/singleLottery/doJoin"
);
response
.
print
();
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
,
"校验success失败"
);
//查询数据库,当前积分(抽奖扣积分流程校验)
mapuser
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id="
+
uid4
);
String
credits2
=
String
.
valueOf
(
mapuser
.
get
(
"credits"
));
logger
.
info
(
"第一次抽奖后积分:"
+
credits2
);
Assert
.
assertEquals
(
credits
,
credits2
,
"校验免费抽奖失败"
);
credits2
=
String
.
valueOf
(
Integer
.
valueOf
(
credits2
)-
1
);
Thread
.
sleep
(
1000
);
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid4
)).
params
(
map
).
post
(
activityHost
+
"/singleLottery/doJoin"
);
response
.
print
();
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
,
"校验success失败"
);
//查询数据库,当前积分(抽奖扣积分流程校验)
mapuser
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id="
+
uid4
);
String
credits3
=
String
.
valueOf
(
mapuser
.
get
(
"credits"
));
logger
.
info
(
"第二次抽奖后积分:"
+
credits3
);
Assert
.
assertEquals
(
credits3
,
credits2
,
"校验扣积分抽奖失败"
);
logger
.
info
(
"校验永久一次免费抽奖限制正确"
);
}
@Test
public
void
每日用户中奖限制
()
throws
Exception
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"operationAcitvityId"
,
"36688"
);
map
.
put
(
"oaId"
,
"36688"
);
map
.
put
(
"token"
,
"12321"
);
Response
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid6
)).
params
(
map
).
post
(
activityHost
+
"/singleLottery/doJoin"
);
String
id
=
MatcherString
.
getString
(
response
.
asString
(),
"singleLotteryOrderId\":(.*?),"
,
1
);
response
=
singleLotteryService
.
getOrderStatus
(
uid6
,
id
,
"iOS"
);
int
i
=
10
;
while
(
"处理中"
.
equals
(
response
.
jsonPath
().
getString
(
"message"
))
&&
i
>
0
)
{
Thread
.
sleep
(
500
);
response
=
singleLotteryService
.
getOrderStatus
(
uid6
,
id
,
"iOS"
);
i
--;
}
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"descrption"
),
"自动化单抽实物"
,
"校验优惠券标题失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lotteryType"
),
"object"
,
"校验奖品类型失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lotteryButtonStatus"
),
"1"
,
"校验状态失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"message"
),
"成功"
,
"校验message失败"
);
Thread
.
sleep
(
1000
);
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid6
)).
params
(
map
).
post
(
activityHost
+
"/singleLottery/doJoin"
);
String
id2
=
MatcherString
.
getString
(
response
.
asString
(),
"singleLotteryOrderId\":(.*?),"
,
1
);
response
.
print
();
response
=
singleLotteryService
.
getOrderStatus
(
uid6
,
id2
,
"iOS"
);
int
n
=
10
;
while
(
"处理中"
.
equals
(
response
.
jsonPath
().
getString
(
"message"
))
&&
n
>
0
)
{
Thread
.
sleep
(
500
);
response
=
singleLotteryService
.
getOrderStatus
(
uid6
,
id2
,
"iOS"
);
response
.
print
();
n
--;
}
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
,
"校验success失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lotteryButtonStatus"
),
"1"
,
"校验状态失败"
);
Assert
.
assertNull
(
response
.
jsonPath
().
getString
(
"descrption"
),
"校验奖项失败"
);
logger
.
info
(
"校验每日用户中奖一次限制正确"
);
}
@Test
public
void
永久用户中奖限制
()
throws
Exception
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"operationAcitvityId"
,
"36687"
);
map
.
put
(
"oaId"
,
"36687"
);
map
.
put
(
"token"
,
"12321"
);
Response
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid5
)).
params
(
map
).
post
(
activityHost
+
"/singleLottery/doJoin"
);
String
id
=
MatcherString
.
getString
(
response
.
asString
(),
"singleLotteryOrderId\":(.*?),"
,
1
);
response
=
singleLotteryService
.
getOrderStatus
(
uid5
,
id
,
"iOS"
);
int
i
=
10
;
while
(
"处理中"
.
equals
(
response
.
jsonPath
().
getString
(
"message"
))
&&
i
>
0
)
{
Thread
.
sleep
(
500
);
response
=
singleLotteryService
.
getOrderStatus
(
uid5
,
id
,
"iOS"
);
i
--;
}
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"descrption"
),
"自动化单抽实物"
,
"校验优惠券标题失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lotteryType"
),
"object"
,
"校验奖品类型失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lotteryButtonStatus"
),
"1"
,
"校验状态失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"message"
),
"成功"
,
"校验message失败"
);
Thread
.
sleep
(
1000
);
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid5
)).
params
(
map
).
post
(
activityHost
+
"/singleLottery/doJoin"
);
String
id2
=
MatcherString
.
getString
(
response
.
asString
(),
"singleLotteryOrderId\":(.*?),"
,
1
);
response
.
print
();
response
=
singleLotteryService
.
getOrderStatus
(
uid5
,
id2
,
"iOS"
);
int
n
=
10
;
while
(
"处理中"
.
equals
(
response
.
jsonPath
().
getString
(
"message"
))
&&
n
>
0
)
{
Thread
.
sleep
(
500
);
response
=
singleLotteryService
.
getOrderStatus
(
uid5
,
id2
,
"iOS"
);
response
.
print
();
n
--;
}
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
,
"校验success失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lotteryButtonStatus"
),
"1"
,
"校验状态失败"
);
Assert
.
assertNull
(
response
.
jsonPath
().
getString
(
"descrption"
),
"校验奖项失败"
);
logger
.
info
(
"校验永久用户中奖一次限制正确"
);
}
@Test
@Test
public
void
抽奖日期限制
(){
public
void
抽奖日期限制
(){
...
...
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