Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oto
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
龚小红
oto
Commits
f41e53f7
Commit
f41e53f7
authored
Aug 20, 2021
by
xiamengchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增秒杀互动-管理后台配置商品
parent
56b95093
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
21 deletions
+49
-21
LiveMaterial.java
...test/java/com/kjj/cases/live/liveConfig/LiveMaterial.java
+2
-2
SaveLive.java
src/test/java/com/kjj/cases/live/liveConfig/SaveLive.java
+46
-19
BasicConfig.java
src/test/java/com/kjj/config/BasicConfig.java
+1
-0
No files found.
src/test/java/com/kjj/cases/live/liveConfig/LiveMaterial.java
View file @
f41e53f7
...
@@ -22,7 +22,7 @@ public class LiveMaterial implements Authorization {
...
@@ -22,7 +22,7 @@ public class LiveMaterial implements Authorization {
private
final
String
killGoodsPicture
=
"https://yun.dui88.com/kjy/image/20210818/1629269488947.jpeg"
;
private
final
String
killGoodsPicture
=
"https://yun.dui88.com/kjy/image/20210818/1629269488947.jpeg"
;
private
final
long
companyId
=
101
;
// 直播公司ID
private
final
long
companyId
=
101
;
// 直播公司ID
private
final
String
newGoodsTitle
=
"秒杀商品1"
;
private
final
String
newGoodsTitle
=
"秒杀商品1"
;
p
ublic
static
long
skGoodsId
;
// 秒杀商品id
p
rivate
long
skGoodsId
;
// 秒杀商品id
private
int
pageNum
;
// 秒杀商品分页数
private
int
pageNum
;
// 秒杀商品分页数
private
int
goodsCount
;
// 当前页面商品数量
private
int
goodsCount
;
// 当前页面商品数量
public
static
String
skGoodsTitle
=
"编辑秒杀商品"
;
//秒杀商品名称
public
static
String
skGoodsTitle
=
"编辑秒杀商品"
;
//秒杀商品名称
...
@@ -400,7 +400,7 @@ public class LiveMaterial implements Authorization {
...
@@ -400,7 +400,7 @@ public class LiveMaterial implements Authorization {
}
}
List
<
KillGoodsList
>
killGoodsLists
=
JsonUtil
.
parseResponseToPageBean
(
skGoodsListsRes
,
KillGoodsList
.
class
);
List
<
KillGoodsList
>
killGoodsLists
=
JsonUtil
.
parseResponseToPageBean
(
skGoodsListsRes
,
KillGoodsList
.
class
);
goodsCount
=
killGoodsLists
.
size
();
goodsCount
=
killGoodsLists
.
size
();
KillGoodsList
killGoodsList
=
killGoodsLists
.
get
(
goodsCount
-
1
);
KillGoodsList
killGoodsList
=
killGoodsLists
.
get
(
0
);
String
goodsTitle
=
killGoodsList
.
getGoodsTitle
();
String
goodsTitle
=
killGoodsList
.
getGoodsTitle
();
Assert
.
assertEquals
(
goodsTitle
,
newGoodsTitle
,
network
.
message
(
skGoodsListsPar
,
BasicConfig
.
MANAGER_skGoodsLists
,
"新增商品错误"
,
skGoodsListsRes
.
body
().
asString
()));
Assert
.
assertEquals
(
goodsTitle
,
newGoodsTitle
,
network
.
message
(
skGoodsListsPar
,
BasicConfig
.
MANAGER_skGoodsLists
,
"新增商品错误"
,
skGoodsListsRes
.
body
().
asString
()));
skGoodsId
=
killGoodsList
.
getId
();
skGoodsId
=
killGoodsList
.
getId
();
...
...
src/test/java/com/kjj/cases/live/liveConfig/SaveLive.java
View file @
f41e53f7
...
@@ -28,8 +28,8 @@ public class SaveLive implements Authorization {
...
@@ -28,8 +28,8 @@ public class SaveLive implements Authorization {
public
long
welfareConfId
;
public
long
welfareConfId
;
private
Integer
taskId
;
private
Integer
taskId
;
public
List
<
RedList
>
redId
;
public
List
<
RedList
>
redId
;
private
int
secKillNum
;
// 本场直播秒杀轮次数量
private
long
newSecKillId
;
// 新增秒杀id
private
List
<
Long
>
secKillIdList
=
new
ArrayList
<>();
// 本场直播秒杀id列表
private
final
long
secKillGoodsId
=
115
;
// 用来配置轮次的秒杀商品ID
@BeforeClass
@BeforeClass
public
void
setUp
()
{
BaseUtils
.
ssoLogin
();
}
public
void
setUp
()
{
BaseUtils
.
ssoLogin
();
}
...
@@ -2350,14 +2350,20 @@ public class SaveLive implements Authorization {
...
@@ -2350,14 +2350,20 @@ public class SaveLive implements Authorization {
@Test
(
description
=
"添加秒杀互动"
,
priority
=
125
)
@Test
(
description
=
"添加秒杀互动"
,
priority
=
125
)
public
void
添加秒杀互动
()
{
public
void
添加秒杀互动
()
{
Map
<
String
,
Object
>
secKillAddPar
=
new
HashMap
<>();
Map
<
String
,
Object
>
secKillAddPar
=
new
HashMap
<>();
secKillAddPar
.
put
(
"goodsId"
,
LiveMaterial
.
sk
GoodsId
);
secKillAddPar
.
put
(
"goodsId"
,
secKill
GoodsId
);
secKillAddPar
.
put
(
"goodsAmount"
,
0.01
);
secKillAddPar
.
put
(
"goodsAmount"
,
0.01
);
secKillAddPar
.
put
(
"interactNum"
,
3
);
secKillAddPar
.
put
(
"interactNum"
,
3
);
secKillAddPar
.
put
(
"ableAgent"
,
0
);
// 代理人不可参与
secKillAddPar
.
put
(
"ableAgent"
,
0
);
// 代理人不可参与
secKillAddPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
secKillAddPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
Response
secKillAddRes
=
network
.
postResponse
(
secKillAddPar
,
BasicConfig
.
MANAGER_secondKillSave
);
Response
secKillAddRes
=
network
.
postResponse
(
secKillAddPar
,
BasicConfig
.
MANAGER_secondKillSave
);
boolean
data
=
secKillAddRes
.
jsonPath
().
getBoolean
(
"data"
);
try
{
Assert
.
assertTrue
(
data
,
network
.
message
(
secKillAddPar
,
BasicConfig
.
MANAGER_secondKillSave
,
"添加秒杀互动失败"
,
secKillAddRes
.
body
().
asString
()));
boolean
data
=
secKillAddRes
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
secKillAddPar
,
BasicConfig
.
MANAGER_secondKillSave
,
"添加秒杀互动失败"
,
secKillAddRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
System
.
out
.
println
(
secKillAddRes
.
body
().
asString
());
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
secKillAddPar
,
BasicConfig
.
MANAGER_secondKillSave
,
"获取数据失败"
,
secKillAddRes
.
body
().
asString
()));
}
}
}
@Test
(
description
=
"获取秒杀轮次列表"
,
priority
=
126
)
@Test
(
description
=
"获取秒杀轮次列表"
,
priority
=
126
)
...
@@ -2365,19 +2371,17 @@ public class SaveLive implements Authorization {
...
@@ -2365,19 +2371,17 @@ public class SaveLive implements Authorization {
Map
<
String
,
Object
>
liveSecKillPar
=
new
HashMap
<>();
Map
<
String
,
Object
>
liveSecKillPar
=
new
HashMap
<>();
liveSecKillPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
liveSecKillPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
Response
liveSecKillRes
=
network
.
getResponse
(
liveSecKillPar
,
BasicConfig
.
MANAGER_secondKillLists
);
Response
liveSecKillRes
=
network
.
getResponse
(
liveSecKillPar
,
BasicConfig
.
MANAGER_secondKillLists
);
List
<
SecondKillList
>
secondKillLists
=
null
;
List
<
SecondKillList
>
secondKillLists
;
try
{
try
{
secondKillLists
=
JsonUtil
.
parseResponseToPageBean
(
liveSecKillRes
,
SecondKillList
.
class
);
secondKillLists
=
JsonUtil
.
parseResponseToPageBean
(
liveSecKillRes
,
SecondKillList
.
class
);
}
catch
(
JsonParseException
e
){
}
catch
(
JsonParseException
e
){
System
.
out
.
println
(
liveSecKillRes
.
body
().
asString
());
e
.
printStackTrace
();
e
.
printStackTrace
();
return
;
return
;
}
}
for
(
SecondKillList
secondKillList
:
secondKillLists
){
secKillIdList
.
add
(
secondKillList
.
getId
());
}
SecondKillList
secondKillList
=
secondKillLists
.
get
(
0
);
SecondKillList
secondKillList
=
secondKillLists
.
get
(
0
);
long
goodsId
=
secondKillList
.
getGoodsId
();
long
goodsId
=
secondKillList
.
getGoodsId
();
Assert
.
assertEquals
(
goodsId
,
LiveMaterial
.
sk
GoodsId
,
network
.
message
(
liveSecKillPar
,
BasicConfig
.
MANAGER_secondKillLists
,
"商品id与实际添加的不符"
,
liveSecKillRes
.
body
().
asString
()));
Assert
.
assertEquals
(
goodsId
,
secKill
GoodsId
,
network
.
message
(
liveSecKillPar
,
BasicConfig
.
MANAGER_secondKillLists
,
"商品id与实际添加的不符"
,
liveSecKillRes
.
body
().
asString
()));
int
goodsAmount
=
secondKillList
.
getGoodsAmount
();
int
goodsAmount
=
secondKillList
.
getGoodsAmount
();
Assert
.
assertEquals
(
goodsAmount
,
0.01
,
network
.
message
(
liveSecKillPar
,
BasicConfig
.
MANAGER_secondKillLists
,
"商品价格与实际添加的不符"
,
liveSecKillRes
.
body
().
asString
()));
Assert
.
assertEquals
(
goodsAmount
,
0.01
,
network
.
message
(
liveSecKillPar
,
BasicConfig
.
MANAGER_secondKillLists
,
"商品价格与实际添加的不符"
,
liveSecKillRes
.
body
().
asString
()));
String
goodsTitle
=
secondKillList
.
getGoodsTitle
();
String
goodsTitle
=
secondKillList
.
getGoodsTitle
();
...
@@ -2388,24 +2392,47 @@ public class SaveLive implements Authorization {
...
@@ -2388,24 +2392,47 @@ public class SaveLive implements Authorization {
Assert
.
assertEquals
(
surplusNum
,
3
,
network
.
message
(
liveSecKillPar
,
BasicConfig
.
MANAGER_secondKillLists
,
"商品剩余数量与实际不符"
,
liveSecKillRes
.
body
().
asString
()));
Assert
.
assertEquals
(
surplusNum
,
3
,
network
.
message
(
liveSecKillPar
,
BasicConfig
.
MANAGER_secondKillLists
,
"商品剩余数量与实际不符"
,
liveSecKillRes
.
body
().
asString
()));
int
ableAgent
=
secondKillList
.
getAbleAgent
();
int
ableAgent
=
secondKillList
.
getAbleAgent
();
Assert
.
assertEquals
(
ableAgent
,
0
,
network
.
message
(
liveSecKillPar
,
BasicConfig
.
MANAGER_secondKillLists
,
"代理人参与限制与实际添加的不符"
,
liveSecKillRes
.
body
().
asString
()));
Assert
.
assertEquals
(
ableAgent
,
0
,
network
.
message
(
liveSecKillPar
,
BasicConfig
.
MANAGER_secondKillLists
,
"代理人参与限制与实际添加的不符"
,
liveSecKillRes
.
body
().
asString
()));
newSecKillId
=
secondKillList
.
getId
();
}
}
@Test
(
description
=
"编辑秒杀轮次"
,
priority
=
127
)
@Test
(
description
=
"编辑秒杀轮次"
,
priority
=
127
)
public
void
编辑秒杀轮次
()
{
public
void
编辑秒杀轮次
()
{
Map
<
String
,
Object
>
secKillUpdatePar
=
new
HashMap
<>();
secKillUpdatePar
.
put
(
"goodsId"
,
secKillGoodsId
);
secKillUpdatePar
.
put
(
"goodsAmount"
,
0.01
);
secKillUpdatePar
.
put
(
"interactNum"
,
1
);
secKillUpdatePar
.
put
(
"id"
,
newSecKillId
);
secKillUpdatePar
.
put
(
"ableAgent"
,
0
);
Response
secKillUpdateRes
=
network
.
postResponse
(
secKillUpdatePar
,
BasicConfig
.
MANAGER_secondKillUpdate
);
try
{
boolean
data
=
secKillUpdateRes
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
secKillUpdatePar
,
BasicConfig
.
MANAGER_secondKillUpdate
,
"编辑秒杀轮次失败"
,
secKillUpdateRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
System
.
out
.
println
(
secKillUpdateRes
.
body
().
asString
());
e
.
printStackTrace
();
}
}
}
@Test
(
description
=
"删除秒杀轮次"
,
priority
=
128
)
@Test
(
description
=
"删除秒杀轮次"
,
priority
=
128
)
public
void
删除秒杀轮次
()
{
public
void
删除秒杀轮次
()
{
Map
<
String
,
Object
>
secKillDelPar
=
new
HashMap
<>();
Map
<
String
,
Object
>
secKillDelPar
=
new
HashMap
<>();
Response
secKillDelRes
;
secKillDelPar
.
put
(
"id"
,
newSecKillId
);
boolean
data
;
Response
secKillDelRes
=
network
.
postResponse
(
secKillDelPar
,
BasicConfig
.
MANAGER_secondKillDel
);
for
(
Long
id
:
secKillIdList
){
boolean
data
=
secKillDelRes
.
jsonPath
().
getBoolean
(
"data"
);
secKillDelPar
.
clear
();
Assert
.
assertTrue
(
data
,
network
.
message
(
secKillDelPar
,
BasicConfig
.
MANAGER_secondKillDel
,
"删除轮次失败"
,
secKillDelRes
.
body
().
asString
()));
secKillDelPar
.
put
(
"id"
,
id
);
secKillDelRes
=
network
.
postResponse
(
secKillDelPar
,
BasicConfig
.
MANAGER_secondKillDel
);
Map
<
String
,
Object
>
liveSecKillPar
=
new
HashMap
<>();
data
=
secKillDelRes
.
jsonPath
().
getBoolean
(
"data"
);
liveSecKillPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
Assert
.
assertTrue
(
data
,
network
.
message
(
secKillDelPar
,
BasicConfig
.
MANAGER_secondKillDel
,
"删除秒杀轮次失败"
,
secKillDelRes
.
body
().
asString
()));
Response
liveSecKillRes
=
network
.
getResponse
(
liveSecKillPar
,
BasicConfig
.
MANAGER_secondKillLists
);
List
<
SecondKillList
>
secondKillLists
=
null
;
try
{
secondKillLists
=
JsonUtil
.
parseResponseToPageBean
(
liveSecKillRes
,
SecondKillList
.
class
);
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
}
for
(
SecondKillList
secondKillList
:
secondKillLists
){
Assert
.
assertNotEquals
(
newSecKillId
,
secondKillList
.
getId
(),
network
.
message
(
liveSecKillPar
,
BasicConfig
.
MANAGER_secondKillLists
,
"被删除的轮次id还存在"
,
liveSecKillRes
.
body
().
asString
()));
}
}
}
}
...
...
src/test/java/com/kjj/config/BasicConfig.java
View file @
f41e53f7
...
@@ -132,6 +132,7 @@ public class BasicConfig {
...
@@ -132,6 +132,7 @@ public class BasicConfig {
public
static
final
String
MANAGER_secondKillSave
=
MANAGER_HOST
+
"/kjy/manager/live/second/kill/goods/save"
;
public
static
final
String
MANAGER_secondKillSave
=
MANAGER_HOST
+
"/kjy/manager/live/second/kill/goods/save"
;
public
static
final
String
MANAGER_secondKillLists
=
MANAGER_HOST
+
"/kjy/manager/live/second/kill/goods/list"
;
public
static
final
String
MANAGER_secondKillLists
=
MANAGER_HOST
+
"/kjy/manager/live/second/kill/goods/list"
;
public
static
final
String
MANAGER_secondKillDel
=
MANAGER_HOST
+
"/kjy/manager/live/second/kill/goods/delete"
;
public
static
final
String
MANAGER_secondKillDel
=
MANAGER_HOST
+
"/kjy/manager/live/second/kill/goods/delete"
;
public
static
final
String
MANAGER_secondKillUpdate
=
MANAGER_HOST
+
"/kjy/manager/live/second/kill/goods/update"
;
// *************** 闯关答题 ***************
// *************** 闯关答题 ***************
public
static
final
String
MANAGER_addOrUpdateQues
=
MANAGER_HOST
+
"/kjy/manager/pass/ques/addOrUpdateQues"
;
public
static
final
String
MANAGER_addOrUpdateQues
=
MANAGER_HOST
+
"/kjy/manager/pass/ques/addOrUpdateQues"
;
...
...
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