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
3a542930
Commit
3a542930
authored
Mar 21, 2019
by
马博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
秒杀兑换限制-自有
parent
7fe09374
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
1096 additions
and
41 deletions
+1096
-41
秒杀自有老优惠券_兑换限制_SeckillTest.java
...ava/http/cases/SeckillTest/秒杀自有老优惠券_兑换限制_SeckillTest.java
+250
-0
秒杀自有老实物_兑换限制.java
src/test/java/http/cases/SeckillTest/秒杀自有老实物_兑换限制.java
+0
-41
秒杀自有老实物_兑换限制_SeckillTest.java
...java/http/cases/SeckillTest/秒杀自有老实物_兑换限制_SeckillTest.java
+205
-0
秒杀自有老虚拟商品_兑换限制_SeckillTest.java
...va/http/cases/SeckillTest/秒杀自有老虚拟商品_兑换限制_SeckillTest.java
+227
-0
秒杀话费_兑换限制_SeckillTest.java
...st/java/http/cases/SeckillTest/秒杀话费_兑换限制_SeckillTest.java
+280
-0
Authorization.java
src/test/java/http/service/Authorization.java
+9
-0
SeckillService.java
src/test/java/http/service/app/SeckillService.java
+125
-0
No files found.
src/test/java/http/cases/SeckillTest/秒杀自有老优惠券_兑换限制_SeckillTest.java
0 → 100644
View file @
3a542930
package
http
.
cases
.
SeckillTest
;
import
base.DuibaTestBase
;
import
http.service.Authorization
;
import
http.service.app.SeckillService
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeMethod
;
import
org.testng.annotations.Test
;
import
utils.MatcherString
;
import
java.sql.SQLException
;
/**
* Created by mabo on 2019/3/15
*/
public
class
秒杀自有老优惠券
_
兑换限制
_SeckillTest
extends
DuibaTestBase
{
//app 13193333111
@Autowired
SeckillService
seckillService
;
@Autowired
Authorization
authorization
;
public
static
int
uid
=
6590
;
@BeforeMethod
public
void
beforeMethod
()
{
try
{
jdbc
.
update
(
"DELETE FROM credits_dev.consumer_limit_record where consumer_id = 100143018"
);
jdbc
.
update
(
"DELETE FROM credits_dev.consumer_limit_record_only where consumer_id = 100143018"
);
jdbc
.
update
(
"DELETE FROM goods.tb_everyday_limit where app_item_id=191791"
);
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
}
@Test
public
void
每人每日兑换限制
()
throws
InterruptedException
{
Response
response
=
seckillService
.
exchange2
(
"191788"
,
"undefined"
,
uid
);
response
.
prettyPrint
();
String
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Response
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uid
);
queryResponse
.
prettyPrint
();
Thread
.
sleep
(
10000
);
response
=
seckillService
.
queryBtnStatus
(
"191788"
,
uid
);
response
.
prettyPrint
();
String
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
Assert
.
assertEquals
(
exchangeText
,
"今日已兑换"
);
}
@Test
public
void
每人永久兑换限制
()
throws
InterruptedException
{
Response
response
=
seckillService
.
exchange2
(
"191789"
,
"undefined"
,
uid
);
response
.
prettyPrint
();
String
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Response
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uid
);
queryResponse
.
prettyPrint
();
Thread
.
sleep
(
10000
);
String
orderId
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"orderId: '(.*?)'"
,
1
);
response
=
seckillService
.
queryBtnStatus
(
"191789"
,
uid
);
response
.
prettyPrint
();
String
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
Assert
.
assertEquals
(
exchangeText
,
"已兑换"
);
}
@Test
public
void
每人周期兑换限制
()
throws
InterruptedException
{
Response
response
=
seckillService
.
queryBtnStatus
(
"191790"
,
uid
);
response
.
prettyPrint
();
String
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
Assert
.
assertEquals
(
exchangeText
,
"马上兑换"
);
response
=
seckillService
.
exchange2
(
"191790"
,
"undefined"
,
uid
);
response
.
prettyPrint
();
String
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Response
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uid
);
queryResponse
.
prettyPrint
();
Thread
.
sleep
(
10000
);
response
=
seckillService
.
queryBtnStatus
(
"191790"
,
uid
);
response
.
prettyPrint
();
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
Assert
.
assertEquals
(
exchangeText
,
"已兑换"
);
response
=
seckillService
.
exchange2
(
"191790"
,
"undefined"
,
uid
);
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Thread
.
sleep
(
10000
);
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uid
);
queryResponse
.
prettyPrint
();
String
result
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"<h2 class=\"tit\">(.*?)</h2>"
,
1
);
Assert
.
assertEquals
(
result
,
"好可惜,没抢到"
);
}
@Test
public
void
商品兑换限制
()
throws
InterruptedException
{
Response
response
=
seckillService
.
queryBtnStatus
(
"191791"
,
uid
);
response
.
prettyPrint
();
String
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
Assert
.
assertEquals
(
exchangeText
,
"马上兑换"
);
response
=
seckillService
.
exchange2
(
"191791"
,
"undefined"
,
uid
);
response
.
prettyPrint
();
String
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Thread
.
sleep
(
10000
);
Response
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uid
);
queryResponse
.
prettyPrint
();
response
=
seckillService
.
queryBtnStatus
(
"191791"
,
uid
);
response
.
prettyPrint
();
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
Assert
.
assertEquals
(
exchangeText
,
"今日已兑完"
);
}
@Test
public
void
无库存
()
throws
SQLException
,
InterruptedException
{
jdbc
.
update
(
"UPDATE stock.tb_stock set stock = 1 where stock_id = \"933147340081120308\""
);
jdbc
.
update
(
"update goods.tb_goods_batch set status =2 where gid = 191796"
);
Response
response
=
seckillService
.
queryBtnStatus
(
"191796"
,
uid
);
response
.
prettyPrint
();
String
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
int
i
=
50
;
while
(
i
>
0
&&
exchangeText
.
equals
(
"已兑完"
)){
Thread
.
sleep
(
3000
);
response
=
seckillService
.
queryBtnStatus
(
"191796"
,
uid
);
response
.
prettyPrint
();
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
System
.
out
.
println
(
i
);
i
--;
}
response
=
seckillService
.
exchange2
(
"191796"
,
"undefined"
,
uid
);
response
.
prettyPrint
();
String
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Thread
.
sleep
(
10000
);
Response
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uid
);
queryResponse
.
prettyPrint
();
Assert
.
assertEquals
(
MatcherString
.
getString
(
queryResponse
.
asString
(),
"\"kind\":\"(.*?)\","
,
1
),
"success"
,
"校验kind失败"
);
response
=
seckillService
.
exchange2
(
"191796"
,
"undefined"
,
uid
);
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Thread
.
sleep
(
15000
);
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uid
);
queryResponse
.
prettyPrint
();
Assert
.
assertEquals
(
MatcherString
.
getString
(
queryResponse
.
asString
(),
"\"kind\":\"(.*?)\","
,
1
),
"fail"
,
"校验kind失败"
);
response
=
seckillService
.
queryBtnStatus
(
"191796"
,
uid
);
response
.
prettyPrint
();
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
i
=
10
;
while
(
i
>
0
&&!
exchangeText
.
equals
(
"已兑完"
)){
Thread
.
sleep
(
3000
);
response
=
seckillService
.
queryBtnStatus
(
"191796"
,
uid
);
response
.
prettyPrint
();
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
System
.
out
.
println
(
i
);
i
--;
}
Assert
.
assertEquals
(
exchangeText
,
"已兑完"
);
jdbc
.
update
(
"UPDATE stock.tb_stock set stock = 1 where stock_id = \"933147340081120308\""
);
jdbc
.
update
(
"update goods.tb_goods_batch set status =2 where gid = 191796"
);
}
@Test
public
void
vip
限制
()
throws
InterruptedException
{
//未达到等级,不可秒杀
Response
response
=
seckillService
.
queryBtnStatus
(
"193754"
,
authorization
.
generateSignAutoLogin
(
"2wGQc3MZaQsqYFWcX4gguya5PnnS"
,
uid
,
0
));
response
.
prettyPrint
();
String
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.vipLimitViewInfoVO.isCanConsumerExchange"
);
Assert
.
assertEquals
(
exchangeText
,
"false"
);
response
=
seckillService
.
exchange2
(
"193754"
,
"undefined"
,
authorization
.
generateSignAutoLogin
(
"2wGQc3MZaQsqYFWcX4gguya5PnnS"
,
uid
,
0
));
response
.
prettyPrint
();
String
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Thread
.
sleep
(
5000
);
Response
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
authorization
.
generateSignAutoLogin
(
"2wGQc3MZaQsqYFWcX4gguya5PnnS"
,
uid
,
0
));
queryResponse
.
prettyPrint
();
String
title
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"<h2 class=\"tit\">(.*?)</h2>"
,
1
);
Assert
.
assertEquals
(
title
,
"好可惜,没抢到"
);
//达到等级,可秒杀
response
=
seckillService
.
queryBtnStatus
(
"193754"
,
authorization
.
generateSignAutoLogin
(
"2wGQc3MZaQsqYFWcX4gguya5PnnS"
,
uid
,
1
));
response
.
prettyPrint
();
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.vipLimitViewInfoVO.isCanConsumerExchange"
);
Assert
.
assertEquals
(
exchangeText
,
"true"
);
response
=
seckillService
.
exchange2
(
"193754"
,
"undefined"
,
authorization
.
generateSignAutoLogin
(
"2wGQc3MZaQsqYFWcX4gguya5PnnS"
,
uid
,
1
));
response
.
prettyPrint
();
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Thread
.
sleep
(
5000
);
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
authorization
.
generateSignAutoLogin
(
"2wGQc3MZaQsqYFWcX4gguya5PnnS"
,
uid
,
1
));
queryResponse
.
prettyPrint
();
String
kind
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"\"kind\":\"(.*?)\","
,
1
);
Assert
.
assertEquals
(
kind
,
"success"
);
}
}
src/test/java/http/cases/SeckillTest/秒杀自有老实物_兑换限制.java
deleted
100644 → 0
View file @
7fe09374
package
http
.
cases
.
SeckillTest
;
import
base.DuibaTestBase
;
import
http.service.app.SeckillService
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.testng.annotations.BeforeMethod
;
import
org.testng.annotations.Test
;
import
java.sql.SQLException
;
/**
* Created by mabo on 2019/3/13
*/
public
class
秒杀自有老实物
_
兑换限制
extends
DuibaTestBase
{
@Autowired
SeckillService
seckillService
;
public
static
int
uid
=
6554
;
// @BeforeMethod
// public void beforeMethod() {
// try {
// jdbc.update("DELETE FROM credits_dev.consumer_limit_record where item_id=191783 and consumer_id = 100137015");
// } catch (SQLException e) {
// e.printStackTrace();
// }
//
//
// }
// @Test
public
void
每人每日兑换限制
(){
Response
response
=
seckillService
.
exchange1
(
"191783"
,
"undefined"
,
uid
);
response
.
prettyPrint
();
response
=
seckillService
.
exchange1
(
"191783"
,
"undefined"
,
uid
);
response
.
prettyPrint
();
}
}
src/test/java/http/cases/SeckillTest/秒杀自有老实物_兑换限制_SeckillTest.java
0 → 100644
View file @
3a542930
package
http
.
cases
.
SeckillTest
;
import
base.DuibaTestBase
;
import
http.service.Authorization
;
import
http.service.app.SeckillService
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeMethod
;
import
org.testng.annotations.Test
;
import
utils.MatcherString
;
import
java.sql.SQLException
;
/**
* Created by mabo on 2019/3/13
*/
public
class
秒杀自有老实物
_
兑换限制
_SeckillTest
extends
DuibaTestBase
{
//app 13193333111
@Autowired
SeckillService
seckillService
;
@Autowired
Authorization
authorization
;
public
static
int
uid
=
6575
;
@BeforeMethod
public
void
beforeMethod
()
{
try
{
jdbc
.
update
(
"DELETE FROM credits_dev.consumer_limit_record where consumer_id = 100139002"
);
jdbc
.
update
(
"DELETE FROM credits_dev.consumer_limit_record_only where consumer_id = 100139002"
);
jdbc
.
update
(
"DELETE FROM goods.tb_everyday_limit where app_item_id=191786"
);
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
}
@Test
public
void
每人每日兑换限制
()
throws
InterruptedException
{
Response
response
=
seckillService
.
exchange2
(
"191783"
,
"undefined"
,
uid
);
// response.prettyPrint();
String
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Response
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uid
);
// queryResponse.prettyPrint();
Thread
.
sleep
(
10000
);
response
=
seckillService
.
queryBtnStatus
(
"191783"
,
uid
);
response
.
prettyPrint
();
String
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
//校验按钮转台
Assert
.
assertEquals
(
exchangeText
,
"今日已兑换"
);
}
@Test
public
void
每人永久兑换限制
()
throws
InterruptedException
{
Response
response
=
seckillService
.
exchange2
(
"191784"
,
"undefined"
,
uid
);
response
.
prettyPrint
();
String
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Thread
.
sleep
(
10000
);
Response
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uid
);
queryResponse
.
prettyPrint
();
String
orderId
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"orderId: '(.*?)'"
,
1
);
response
=
seckillService
.
queryBtnStatus
(
"191784"
,
uid
);
response
.
prettyPrint
();
String
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
Assert
.
assertEquals
(
exchangeText
,
"已兑换"
);
}
@Test
public
void
每人周期兑换限制
()
throws
InterruptedException
{
Response
response
=
seckillService
.
queryBtnStatus
(
"191785"
,
uid
);
response
.
prettyPrint
();
String
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
Assert
.
assertEquals
(
exchangeText
,
"马上兑换"
);
response
=
seckillService
.
exchange2
(
"191785"
,
"undefined"
,
uid
);
response
.
prettyPrint
();
String
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Thread
.
sleep
(
10000
);
Response
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uid
);
queryResponse
.
prettyPrint
();
response
=
seckillService
.
queryBtnStatus
(
"191785"
,
uid
);
response
.
prettyPrint
();
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
Assert
.
assertEquals
(
exchangeText
,
"已兑换"
);
}
@Test
public
void
商品兑换限制
()
throws
InterruptedException
{
Response
response
=
seckillService
.
queryBtnStatus
(
"191786"
,
uid
);
response
.
prettyPrint
();
String
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
Assert
.
assertEquals
(
exchangeText
,
"马上兑换"
);
response
=
seckillService
.
exchange2
(
"191786"
,
"undefined"
,
uid
);
response
.
prettyPrint
();
String
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Thread
.
sleep
(
10000
);
Response
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uid
);
queryResponse
.
prettyPrint
();
response
=
seckillService
.
queryBtnStatus
(
"191786"
,
uid
);
response
.
prettyPrint
();
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
Assert
.
assertEquals
(
exchangeText
,
"今日已兑完"
);
}
@Test
public
void
无库存
()
throws
SQLException
,
InterruptedException
{
jdbc
.
update
(
"UPDATE stock.tb_stock set stock = 1 where stock_id = \"933059354152870299\""
);
Response
response
=
seckillService
.
exchange2
(
"191787"
,
"undefined"
,
uid
);
response
.
prettyPrint
();
String
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Response
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uid
);
queryResponse
.
prettyPrint
();
Thread
.
sleep
(
10000
);
response
=
seckillService
.
queryBtnStatus
(
"191787"
,
uid
);
response
.
prettyPrint
();
String
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
response
=
seckillService
.
exchange2
(
"191787"
,
"undefined"
,
uid
);
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Thread
.
sleep
(
10000
);
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uid
);
queryResponse
.
prettyPrint
();
String
orderId
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"orderId: '(.*?)'"
,
1
);
String
result
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"<h2 class=\"tit\">(.*?)</h2>"
,
1
);
response
=
seckillService
.
detail
(
orderId
,
uid
);
response
.
prettyPrint
();
String
failedReason
=
response
.
jsonPath
().
getString
(
"data.failedReason"
);
Assert
.
assertEquals
(
failedReason
,
"库存不足"
);
}
@Test
public
void
vip
限制
()
throws
InterruptedException
{
//未达到等级不可兑换
Response
response
=
seckillService
.
queryBtnStatus
(
"193753"
,
authorization
.
generateSignAutoLogin
(
"2wGQc3MZaQsqYFWcX4gguya5PnnS"
,
uid
,
0
));
// response.prettyPrint();
String
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.vipLimitViewInfoVO.isCanConsumerExchange"
);
Assert
.
assertEquals
(
exchangeText
,
"false"
);
response
=
seckillService
.
exchange2
(
"193753"
,
"undefined"
,
authorization
.
generateSignAutoLogin
(
"2wGQc3MZaQsqYFWcX4gguya5PnnS"
,
uid
,
0
));
// response.prettyPrint();
String
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Thread
.
sleep
(
5000
);
Response
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
authorization
.
generateSignAutoLogin
(
"2wGQc3MZaQsqYFWcX4gguya5PnnS"
,
uid
,
0
));
// queryResponse.prettyPrint();
String
title
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"<h2 class=\"tit\">(.*?)</h2>"
,
1
);
Assert
.
assertEquals
(
title
,
"好可惜,没抢到"
);
//达到等级可兑换
response
=
seckillService
.
queryBtnStatus
(
"193753"
,
authorization
.
generateSignAutoLogin
(
"2wGQc3MZaQsqYFWcX4gguya5PnnS"
,
uid
,
1
));
// response.prettyPrint();
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.vipLimitViewInfoVO.isCanConsumerExchange"
);
Assert
.
assertEquals
(
exchangeText
,
"true"
);
response
=
seckillService
.
exchange2
(
"193753"
,
"undefined"
,
authorization
.
generateSignAutoLogin
(
"2wGQc3MZaQsqYFWcX4gguya5PnnS"
,
uid
,
1
));
// response.prettyPrint();
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Thread
.
sleep
(
5000
);
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
authorization
.
generateSignAutoLogin
(
"2wGQc3MZaQsqYFWcX4gguya5PnnS"
,
uid
,
1
));
// queryResponse.prettyPrint();
String
orderId
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"orderId: '(.*?)'"
,
1
);
response
=
seckillService
.
detail
(
orderId
,
uid
);
// response.prettyPrint();
String
statusText
=
response
.
jsonPath
().
getString
(
"data.statusText"
);
Assert
.
assertEquals
(
statusText
,
"等待商家发货"
);
}
}
src/test/java/http/cases/SeckillTest/秒杀自有老虚拟商品_兑换限制_SeckillTest.java
0 → 100644
View file @
3a542930
package
http
.
cases
.
SeckillTest
;
import
base.DuibaTestBase
;
import
http.service.Authorization
;
import
http.service.app.SeckillService
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeMethod
;
import
org.testng.annotations.Test
;
import
utils.MatcherString
;
import
java.sql.SQLException
;
/**
* Created by mabo on 2019/3/15
*/
public
class
秒杀自有老虚拟商品
_
兑换限制
_SeckillTest
extends
DuibaTestBase
{
//app 13193333111
@Autowired
SeckillService
seckillService
;
@Autowired
Authorization
authorization
;
public
static
int
uid
=
6591
;
@BeforeMethod
public
void
beforeMethod
()
{
try
{
jdbc
.
update
(
"DELETE FROM credits_dev.consumer_limit_record where consumer_id = 100143033"
);
jdbc
.
update
(
"DELETE FROM credits_dev.consumer_limit_record_only where consumer_id = 100143033"
);
jdbc
.
update
(
"DELETE FROM goods.tb_everyday_limit where app_item_id=192019"
);
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
}
@Test
public
void
每人每日兑换限制
()
throws
InterruptedException
{
Response
response
=
seckillService
.
exchange3
(
"191797"
,
"123"
,
uid
);
response
.
prettyPrint
();
String
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Response
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uid
);
queryResponse
.
prettyPrint
();
Thread
.
sleep
(
10000
);
response
=
seckillService
.
queryBtnStatus
(
"191797"
,
uid
);
response
.
prettyPrint
();
String
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
Assert
.
assertEquals
(
exchangeText
,
"今日已兑换"
);
}
@Test
public
void
每人永久兑换限制
()
throws
InterruptedException
{
Response
response
=
seckillService
.
exchange3
(
"191987"
,
"123456"
,
uid
);
response
.
prettyPrint
();
String
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Response
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uid
);
queryResponse
.
prettyPrint
();
Thread
.
sleep
(
10000
);
String
orderId
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"orderId: '(.*?)'"
,
1
);
response
=
seckillService
.
queryBtnStatus
(
"191987"
,
uid
);
response
.
prettyPrint
();
String
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
Assert
.
assertEquals
(
exchangeText
,
"已兑换"
);
}
@Test
public
void
每人周期兑换限制
()
throws
InterruptedException
{
Response
response
=
seckillService
.
queryBtnStatus
(
"192003"
,
uid
);
response
.
prettyPrint
();
String
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
Assert
.
assertEquals
(
exchangeText
,
"马上兑换"
);
response
=
seckillService
.
exchange2
(
"192003"
,
"undefined"
,
uid
);
response
.
prettyPrint
();
String
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Response
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uid
);
queryResponse
.
prettyPrint
();
Thread
.
sleep
(
10000
);
response
=
seckillService
.
queryBtnStatus
(
"192003"
,
uid
);
response
.
prettyPrint
();
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
Assert
.
assertEquals
(
exchangeText
,
"已兑换"
);
response
=
seckillService
.
exchange2
(
"192003"
,
"undefined"
,
uid
);
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Thread
.
sleep
(
10000
);
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uid
);
queryResponse
.
prettyPrint
();
String
orderId
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"orderId: '(.*?)'"
,
1
);
String
result
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"<h2 class=\"tit\">(.*?)</h2>"
,
1
);
Assert
.
assertEquals
(
result
,
"好可惜,没抢到"
);
}
@Test
public
void
商品兑换限制
()
throws
InterruptedException
{
Response
response
=
seckillService
.
queryBtnStatus
(
"192019"
,
uid
);
response
.
prettyPrint
();
String
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
Assert
.
assertEquals
(
exchangeText
,
"马上兑换"
);
response
=
seckillService
.
exchange3
(
"192019"
,
"123456"
,
uid
);
response
.
prettyPrint
();
String
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Thread
.
sleep
(
10000
);
Response
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uid
);
queryResponse
.
prettyPrint
();
response
=
seckillService
.
queryBtnStatus
(
"192019"
,
uid
);
response
.
prettyPrint
();
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
Assert
.
assertEquals
(
exchangeText
,
"今日已兑完"
);
}
@Test
public
void
无库存
()
throws
SQLException
,
InterruptedException
{
//更新数据库库存为1
jdbc
.
update
(
"UPDATE stock.tb_stock set stock = 1 where stock_id = \"934806710018620543\""
);
//第一次秒杀
Response
response
=
seckillService
.
exchange3
(
"192031"
,
"123456"
,
uid
);
//获取队列id
String
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Thread
.
sleep
(
10000
);
Response
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uid
);
queryResponse
.
prettyPrint
();
response
=
seckillService
.
queryBtnStatus
(
"192031"
,
uid
);
response
.
prettyPrint
();
String
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
// Assert.assertEquals(exchangeText,"已兑完");
response
=
seckillService
.
exchange3
(
"192031"
,
"123456"
,
uid
);
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Thread
.
sleep
(
10000
);
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uid
);
queryResponse
.
prettyPrint
();
String
orderId
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"orderId: '(.*?)'"
,
1
);
String
result
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"<h2 class=\"tit\">(.*?)</h2>"
,
1
);
response
=
seckillService
.
detail
(
orderId
,
uid
);
response
.
prettyPrint
();
String
failedReason
=
response
.
jsonPath
().
getString
(
"data.failedReason"
);
Assert
.
assertEquals
(
failedReason
,
"库存不足"
);
}
@Test
public
void
vip
限制
()
throws
InterruptedException
{
//未达到会员等级,不可秒杀
Response
response
=
seckillService
.
queryBtnStatus
(
"193755"
,
authorization
.
generateSignAutoLogin
(
"2wGQc3MZaQsqYFWcX4gguya5PnnS"
,
uid
,
0
));
// response.prettyPrint();
String
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.vipLimitViewInfoVO.isCanConsumerExchange"
);
Assert
.
assertEquals
(
exchangeText
,
"false"
);
response
=
seckillService
.
exchange3
(
"193755"
,
"123456"
,
authorization
.
generateSignAutoLogin
(
"2wGQc3MZaQsqYFWcX4gguya5PnnS"
,
uid
,
0
));
// response.prettyPrint();
String
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Thread
.
sleep
(
5000
);
Response
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
authorization
.
generateSignAutoLogin
(
"2wGQc3MZaQsqYFWcX4gguya5PnnS"
,
uid
,
0
));
// queryResponse.prettyPrint();
String
title
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"<h2 class=\"tit\">(.*?)</h2>"
,
1
);
Assert
.
assertEquals
(
title
,
"好可惜,没抢到"
);
//达到会员等级,可兑换
response
=
seckillService
.
queryBtnStatus
(
"193755"
,
authorization
.
generateSignAutoLogin
(
"2wGQc3MZaQsqYFWcX4gguya5PnnS"
,
uid
,
1
));
// response.prettyPrint();
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.vipLimitViewInfoVO.isCanConsumerExchange"
);
Assert
.
assertEquals
(
exchangeText
,
"true"
);
response
=
seckillService
.
exchange3
(
"193755"
,
"123456"
,
authorization
.
generateSignAutoLogin
(
"2wGQc3MZaQsqYFWcX4gguya5PnnS"
,
uid
,
1
));
// response.prettyPrint();
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Thread
.
sleep
(
5000
);
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
authorization
.
generateSignAutoLogin
(
"2wGQc3MZaQsqYFWcX4gguya5PnnS"
,
uid
,
1
));
// queryResponse.prettyPrint();
String
orderId
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"orderId: '(.*?)'"
,
1
);
response
=
seckillService
.
detail
(
orderId
,
uid
);
// response.prettyPrint();
String
status
=
response
.
jsonPath
().
getString
(
"data.status"
);
Assert
.
assertEquals
(
status
,
"success"
);
}
}
src/test/java/http/cases/SeckillTest/秒杀话费_兑换限制_SeckillTest.java
0 → 100644
View file @
3a542930
package
http
.
cases
.
SeckillTest
;
import
base.DuibaTestBase
;
import
com.alibaba.fastjson.JSON
;
import
http.service.Authorization
;
import
http.service.app.SeckillService
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeMethod
;
import
org.testng.annotations.Test
;
import
utils.MatcherString
;
import
java.sql.SQLException
;
/**
* Created by mabo on 2019/3/20
*/
public
class
秒杀话费
_
兑换限制
_SeckillTest
extends
DuibaTestBase
{
//app 13193333111
@Autowired
SeckillService
seckillService
;
@Autowired
Authorization
authorization
;
@BeforeMethod
public
void
beforeMethod
()
{
try
{
jdbc
.
update
(
"DELETE FROM credits_dev.consumer_limit_record where consumer_id = 100143514"
);
jdbc
.
update
(
"DELETE FROM credits_dev.consumer_limit_record_only where consumer_id = 100143514"
);
jdbc
.
update
(
"DELETE FROM goods.tb_everyday_limit where app_item_id=193206"
);
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
}
public
static
int
uid
=
6865
;
@Test
public
void
每日兑换限制
()
throws
InterruptedException
{
Response
response
=
seckillService
.
exchange4
(
"193206"
,
"1660"
,
uid
);
response
.
prettyPrint
();
String
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Thread
.
sleep
(
10000
);
Response
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uid
);
queryResponse
.
prettyPrint
();
Assert
.
assertEquals
(
MatcherString
.
getString
(
queryResponse
.
asString
(),
"\"kind\":\"(.*?)\","
,
1
),
"success"
,
"校验kind失败"
);
response
=
seckillService
.
queryBtnStatus
(
"193206"
,
uid
);
response
.
prettyPrint
();
String
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
Assert
.
assertEquals
(
exchangeText
,
"今日已兑完"
);
}
@Test
public
void
用户兑换限制
_
每天
()
throws
InterruptedException
{
Response
response
=
seckillService
.
exchange4
(
"193209"
,
"1662"
,
uid
);
response
.
prettyPrint
();
String
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Response
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uid
);
queryResponse
.
prettyPrint
();
String
kind
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"\"kind\":\"(.*?)\","
,
1
);
String
title
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"<title>(.*?)</title>"
,
1
);
int
i
=
20
;
while
(
i
>
0
&&(
"process"
.
equals
(
kind
)||(
title
.
equals
(
"等待中"
)))){
Thread
.
sleep
(
3000
);
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uid
);
queryResponse
.
prettyPrint
();
kind
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"\"kind\":\"(.*?)\","
,
1
);
title
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"<title>(.*?)</title>"
,
1
);
i
--;
}
Assert
.
assertEquals
(
MatcherString
.
getString
(
queryResponse
.
asString
(),
"\"kind\":\"(.*?)\","
,
1
),
"success"
,
"校验kind失败"
);
response
=
seckillService
.
queryBtnStatus
(
"193209"
,
uid
);
response
.
prettyPrint
();
String
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
Assert
.
assertEquals
(
exchangeText
,
"今日已兑换"
);
}
@Test
public
void
用户兑换限制
_
永久
()
throws
InterruptedException
{
Response
response
=
seckillService
.
exchange4
(
"193208"
,
"1661"
,
uid
);
response
.
prettyPrint
();
String
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Response
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uid
);
queryResponse
.
prettyPrint
();
String
kind
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"\"kind\":\"(.*?)\","
,
1
);
String
title
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"<title>(.*?)</title>"
,
1
);
int
i
=
20
;
while
(
i
>
0
&&(
"process"
.
equals
(
kind
)||(
title
.
equals
(
"等待中"
)))){
Thread
.
sleep
(
3000
);
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uid
);
queryResponse
.
prettyPrint
();
kind
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"\"kind\":\"(.*?)\","
,
1
);
title
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"<title>(.*?)</title>"
,
1
);
i
--;
}
Assert
.
assertEquals
(
MatcherString
.
getString
(
queryResponse
.
asString
(),
"\"kind\":\"(.*?)\","
,
1
),
"success"
,
"校验kind失败"
);
response
=
seckillService
.
queryBtnStatus
(
"193208"
,
uid
);
response
.
prettyPrint
();
String
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
Assert
.
assertEquals
(
exchangeText
,
"已兑换"
);
}
@Test
public
void
日期兑换限制
_
已过期
()
throws
InterruptedException
{
Response
response
=
seckillService
.
queryBtnStatus
(
"193211"
,
uid
);
response
.
prettyPrint
();
String
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
Assert
.
assertEquals
(
exchangeText
,
"已结束"
);
response
=
seckillService
.
exchange4
(
"193211"
,
"1664"
,
uid
);
response
.
prettyPrint
();
String
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Response
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uid
);
queryResponse
.
prettyPrint
();
String
title
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"<title>(.*?)</title>"
,
1
);
for
(
int
i
=
36
;
i
>
0
;
i
--){
if
(
title
.
equals
(
"等待中"
)){
Thread
.
sleep
(
3000
);
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uid
);
queryResponse
.
prettyPrint
();
}
}
logger
.
info
(
"queueId="
+
queueId
+
",queryResponse的信息为"
+
JSON
.
toJSONString
(
queryResponse
));
Assert
.
assertEquals
(
MatcherString
.
getString
(
queryResponse
.
asString
(),
"<h2 class=\"tit\">(.*?)</h2>"
,
1
),
"好可惜,没抢到"
,
"文案校验失败"
);
}
@Test
public
void
日期兑换限制
_
日期内
()
throws
InterruptedException
{
//app 13193333112
int
uids
=
6937
;
Response
response
=
seckillService
.
queryBtnStatus
(
"193449"
,
uids
);
response
.
prettyPrint
();
String
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.exchangeBtnVO.exchangeText"
);
Assert
.
assertEquals
(
exchangeText
,
"马上兑换"
);
response
=
seckillService
.
exchange4
(
"193449"
,
"1660"
,
uids
);
response
.
prettyPrint
();
String
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Response
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uids
);
queryResponse
.
prettyPrint
();
String
kind
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"\"kind\":\"(.*?)\","
,
1
);
String
title
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"<title>(.*?)</title>"
,
1
);
int
i
=
20
;
while
(
i
>
0
&&(
"process"
.
equals
(
kind
)||(
title
.
equals
(
"等待中"
)))){
Thread
.
sleep
(
3000
);
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
uids
);
queryResponse
.
prettyPrint
();
kind
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"\"kind\":\"(.*?)\","
,
1
);
title
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"<title>(.*?)</title>"
,
1
);
i
--;
}
Assert
.
assertEquals
(
MatcherString
.
getString
(
queryResponse
.
asString
(),
"\"kind\":\"(.*?)\","
,
1
),
"success"
,
"校验kind失败"
);
}
@Test
public
void
vip
限制
()
throws
InterruptedException
{
//app 13193333112
int
uids
=
6937
;
Response
response
=
seckillService
.
queryBtnStatus
(
"193451"
,
authorization
.
generateSignAutoLogin
(
"ZQyvfB6a47hpRnfyhggtkcs4KQS"
,
uids
,
0
));
response
.
prettyPrint
();
String
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.vipLimitViewInfoVO.isCanConsumerExchange"
);
Assert
.
assertEquals
(
exchangeText
,
"false"
);
// Assert.assertEquals(exchangeText,"马上兑换");
response
=
seckillService
.
exchange4
(
"193451"
,
"1661"
,
authorization
.
generateSignAutoLogin
(
"ZQyvfB6a47hpRnfyhggtkcs4KQS"
,
uids
,
0
));
response
.
prettyPrint
();
String
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Thread
.
sleep
(
5000
);
Response
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
authorization
.
generateSignAutoLogin
(
"ZQyvfB6a47hpRnfyhggtkcs4KQS"
,
uids
,
0
));
queryResponse
.
prettyPrint
();
String
title
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"<h2 class=\"tit\">(.*?)</h2>"
,
1
);
Assert
.
assertEquals
(
title
,
"好可惜,没抢到"
);
response
=
seckillService
.
queryBtnStatus
(
"193451"
,
authorization
.
generateSignAutoLogin
(
"ZQyvfB6a47hpRnfyhggtkcs4KQS"
,
uids
,
1
));
response
.
prettyPrint
();
exchangeText
=
response
.
jsonPath
().
getString
(
"data.seckillBtnVO.vipLimitViewInfoVO.isCanConsumerExchange"
);
Assert
.
assertEquals
(
exchangeText
,
"true"
);
response
=
seckillService
.
exchange4
(
"193451"
,
"1661"
,
authorization
.
generateSignAutoLogin
(
"ZQyvfB6a47hpRnfyhggtkcs4KQS"
,
uids
,
1
));
response
.
prettyPrint
();
queueId
=
response
.
jsonPath
().
getString
(
"data.queueId"
);
Thread
.
sleep
(
5000
);
queryResponse
=
seckillService
.
queueQuery
(
queueId
,
authorization
.
generateSignAutoLogin
(
"ZQyvfB6a47hpRnfyhggtkcs4KQS"
,
uids
,
1
));
queryResponse
.
prettyPrint
();
String
kind
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"\"kind\":\"(.*?)\","
,
1
);
title
=
MatcherString
.
getString
(
queryResponse
.
asString
(),
"<h2 class=\"tit\">(.*?)</h2>"
,
1
);
}
}
src/test/java/http/service/Authorization.java
View file @
3a542930
...
...
@@ -197,6 +197,15 @@ public class Authorization {
}
public
Map
generateSignAutoLogin
(
String
appKey
,
int
uid
,
int
vip
){
String
url
=
"http://activity.m.duibatest.com.cn/test/generateSign?appKey="
+
appKey
+
"&uid="
+
uid
+
"&vip="
+
vip
;
Response
response
=
given
().
get
(
url
);
url
=
response
.
jsonPath
().
get
(
"url"
);
response
=
given
().
redirects
().
follow
(
false
).
get
(
url
);
return
response
.
getCookies
();
}
//开发者后台登录
public
Map
hdLogin
(){
...
...
src/test/java/http/service/app/SeckillService.java
View file @
3a542930
...
...
@@ -81,6 +81,28 @@ public class SeckillService {
}
return
response
;
}
public
Response
queryBtnStatus
(
String
appItemId
,
Map
cookie
)
{
String
url
=
"http://"
+
seckillHost
+
"/appItemSecKill/queryBtnStatus"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"appItemId"
,
appItemId
);
Response
response
=
given
().
cookies
(
cookie
).
params
(
map
).
get
(
url
);
try
{
int
i
=
8
;
while
((!
checkNomal
(
"queryBtnStatus"
,
response
))&&
i
>
0
){
Thread
.
sleep
(
1000
);
response
=
given
().
cookies
(
cookie
).
params
(
map
).
get
(
url
);
response
.
prettyPrint
();
i
--;
}
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
return
response
;
}
public
Response
queryBtnStatus2
(
String
appItemId
)
{
...
...
@@ -139,6 +161,84 @@ public class SeckillService {
return
response
;
}
public
Response
exchange2
(
String
appItemId
,
String
itemId
,
Map
cookie
)
{
String
url
=
"http://"
+
seckillHost
+
"/appItemSecKill/exchange"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"validate"
,
"kwExo7h9lQwLWM0x87uYeYrLtFO9L16IIB22qqBi5o97ema7Ut0uOuSg5tD6tH5DFDIGFBFadR2pFEGsr9oR-wvieKqnTAUlJyuGPx_sSBHfcNWw4loVj6hXPV2IP04PrvfS15JIt7leklEfnmtEPAqrZmGx7jW5UAA2CzNvbXgEM-kGqGARuVFTnjG8_RwjkLBibXEHCGXhKZ8H7LMLo10C0nvyIHqWhVBdeWjuZl66bFYP8W0qbbwzzRNbobdx0_x59LecepmzNO2PdG4QPb9n4OYVQgSDTj.Nw0qizpZKcAWf0xnJeegXgVf66o_rZrZUHmSn2pgoz4qcZeSG0yekGMnng8Ak9YUvUhprowTpGT.DV8rs4Dw6Et2l1jUfkI7c4qaBKBbZbzaNvZzK5UvbpaaVFGtV2Kg.H_MrwgwBJjWiWNdds2K68aXYb6cpjtE6JwfIxiYu57TeZD9LUI_jJCq0BD0XPn5f6Q-MiudOLJX4EEdIBqQRl4r3"
);
map
.
put
(
"appItemId"
,
appItemId
);
map
.
put
(
"itemId"
,
itemId
);
map
.
put
(
"addrName"
,
"qianwenjun"
);
map
.
put
(
"addrPhone"
,
"18143476362"
);
map
.
put
(
"addrProvince"
,
"浙江省"
);
map
.
put
(
"addrCity"
,
"杭州市"
);
map
.
put
(
"addrArea"
,
"西湖区"
);
map
.
put
(
"addrDetail"
,
"数娱大厦"
);
Response
response
=
given
().
cookies
(
cookie
).
params
(
map
).
get
(
url
);
return
response
;
}
//虚拟商品
public
Response
exchange3
(
String
appItemId
,
String
degreeId
,
int
uid
)
{
String
url
=
"http://"
+
seckillHost
+
"/appItemSecKill/exchange"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"appItemId"
,
appItemId
);
map
.
put
(
"degreeId"
,
degreeId
);
Response
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
params
(
map
).
get
(
url
);
return
response
;
}
//虚拟商品
public
Response
exchange3
(
String
appItemId
,
String
degreeId
,
Map
cookie
)
{
String
url
=
"http://"
+
seckillHost
+
"/appItemSecKill/exchange"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"appItemId"
,
appItemId
);
map
.
put
(
"degreeId"
,
degreeId
);
Response
response
=
given
().
cookies
(
cookie
).
params
(
map
).
get
(
url
);
return
response
;
}
//话费
public
Response
exchange4
(
String
appItemId
,
String
itemId
,
int
uid
)
{
String
url
=
"http://"
+
seckillHost
+
"/appItemSecKill/exchange"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"appItemId"
,
appItemId
);
map
.
put
(
"itemId"
,
itemId
);
map
.
put
(
"phone"
,
"13599944422"
);
map
.
put
(
"phoneCatName"
,
"中国移动"
);
map
.
put
(
"phoneProvince"
,
"福建"
);
Response
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
params
(
map
).
get
(
url
);
return
response
;
}
//话费
public
Response
exchange4
(
String
appItemId
,
String
itemId
,
Map
cookie
)
{
String
url
=
"http://"
+
seckillHost
+
"/appItemSecKill/exchange"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"appItemId"
,
appItemId
);
map
.
put
(
"itemId"
,
itemId
);
map
.
put
(
"phone"
,
"13599944422"
);
map
.
put
(
"phoneCatName"
,
"中国移动"
);
map
.
put
(
"phoneProvince"
,
"福建"
);
Response
response
=
given
().
cookies
(
cookie
).
params
(
map
).
get
(
url
);
return
response
;
}
public
Response
queueQuery
(
String
queueId
,
Integer
uid
)
{
...
...
@@ -149,6 +249,27 @@ public class SeckillService {
return
response
;
}
public
Response
queueQuery
(
String
queueId
,
Map
cookie
)
{
String
url
=
"http://"
+
seckillHost
+
"/appItemSecKill/queueQuery"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"queueId"
,
queueId
);
Response
response
=
given
().
cookies
(
cookie
).
params
(
map
).
get
(
url
);
return
response
;
}
public
Response
detail
(
String
orderId
,
Integer
uid
)
{
String
url
=
"http://"
+
seckillHost
+
"/taw/h5/detail"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"orderId"
,
orderId
);
Response
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
params
(
map
).
get
(
url
);
return
response
;
}
public
Response
getSeckillBtn
(
Long
duibaActivityId
,
Long
operationActivityId
,
Integer
uid
)
{
...
...
@@ -210,6 +331,10 @@ public class SeckillService {
}
public
static
void
main
(
String
args
[])
{
SeckillService
seckillService
=
new
SeckillService
();
...
...
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