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
7f72e747
Commit
7f72e747
authored
Jan 04, 2019
by
wangxiaoshuang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into wxs
parents
871f2ba4
2def637a
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
866 additions
and
43 deletions
+866
-43
ActiveGroup_FloorTest.java
...test/java/http/cases/FloorTest/ActiveGroup_FloorTest.java
+2
-2
Banner_FloorTest.java
src/test/java/http/cases/FloorTest/Banner_FloorTest.java
+2
-2
Coupon_FloorTest.java
src/test/java/http/cases/FloorTest/Coupon_FloorTest.java
+2
-2
Game_FloorTest.java
src/test/java/http/cases/FloorTest/Game_FloorTest.java
+2
-2
Icon_FloorTest.java
src/test/java/http/cases/FloorTest/Icon_FloorTest.java
+4
-4
Item_FloorTest.java
src/test/java/http/cases/FloorTest/Item_FloorTest.java
+2
-2
Seckill_FloorTest.java
src/test/java/http/cases/FloorTest/Seckill_FloorTest.java
+2
-2
Showcase_FloorTest.java
src/test/java/http/cases/FloorTest/Showcase_FloorTest.java
+2
-2
Sign_FloorTest.java
src/test/java/http/cases/FloorTest/Sign_FloorTest.java
+2
-2
新旧集卡_发卡_DuibaTest.java
.../http/cases/NewCollectActivityTest/新旧集卡_发卡_DuibaTest.java
+2
-2
pk_押注测试_AccessTest.java
src/test/java/http/cases/PkTest/pk_押注测试_AccessTest.java
+1
-0
pk_瓜分红包_发券测试.java
src/test/java/http/cases/PkTest/pk_瓜分红包_发券测试.java
+217
-0
pk_瓜分红包_首页中奖弹层测试_AccessTest.java
...t/java/http/cases/PkTest/pk_瓜分红包_首页中奖弹层测试_AccessTest.java
+235
-0
插件工具抽奖测试_pluginTest.java
...va/http/cases/PluginActivityTest/插件工具抽奖测试_pluginTest.java
+3
-3
补给站_活动_DuibaTest.java
...t/java/http/cases/SaasDeveloperTest/补给站_活动_DuibaTest.java
+13
-0
设置_应用信息_DuibaTest.java
.../java/http/cases/SaasDeveloperTest/设置_应用信息_DuibaTest.java
+89
-13
购物车测试.java
src/test/java/http/cases/SaasDeveloperTest/购物车测试.java
+56
-0
自有单抽限制.java
src/test/java/http/cases/SingleLotteryTest/自有单抽限制.java
+1
-3
PkPopPrizeVo.java
src/test/java/http/model/PkPopPrizeVo.java
+29
-0
Authorization.java
src/test/java/http/service/Authorization.java
+2
-2
ADeveloperService.java
src/test/java/http/service/Manager/ADeveloperService.java
+28
-0
MallService.java
src/test/java/http/service/Saas/MallService.java
+89
-0
UpdateAppInfoService.java
src/test/java/http/service/Saas/UpdateAppInfoService.java
+81
-0
No files found.
src/test/java/http/cases/FloorTest/ActiveGroup_FloorTest.java
View file @
7f72e747
...
...
@@ -387,7 +387,7 @@ public class ActiveGroup_FloorTest extends DuibaTestBase {
}
@Test
(
dependsOnMethods
=
{
"A_创建活动楼层皮肤"
})
@Test
public
void
B_
手机端活动
()
throws
Exception
{
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss:SSS"
);
//设置日期格式
logger
.
info
(
df
.
format
(
new
Date
()));
...
...
@@ -444,7 +444,7 @@ public class ActiveGroup_FloorTest extends DuibaTestBase {
}
@Test
(
dependsOnMethods
=
{
"B_手机端活动"
})
@Test
public
void
C_
删除活动楼层皮肤
()
throws
Exception
{
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss:SSS"
);
//设置日期格式
...
...
src/test/java/http/cases/FloorTest/Banner_FloorTest.java
View file @
7f72e747
...
...
@@ -154,7 +154,7 @@ public class Banner_FloorTest extends DuibaTestBase {
}
@Test
(
dependsOnMethods
=
{
"A_创建banner楼层皮肤"
})
@Test
public
void
B_banner
楼层活动校验
()
throws
Exception
{
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss:SSS"
);
//设置日期格式
...
...
@@ -212,7 +212,7 @@ public class Banner_FloorTest extends DuibaTestBase {
}
@Test
(
dependsOnMethods
=
{
"B_banner楼层活动校验"
})
@Test
public
void
C_banner
商品校验
()
throws
Exception
{
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss:SSS"
);
//设置日期格式
...
...
src/test/java/http/cases/FloorTest/Coupon_FloorTest.java
View file @
7f72e747
...
...
@@ -342,7 +342,7 @@ public class Coupon_FloorTest extends DuibaTestBase {
}
@Test
(
dependsOnMethods
=
{
"A_创建优惠券楼层皮肤"
})
@Test
public
void
B_
优惠券手机端
()
throws
Exception
{
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss:SSS"
);
//设置日期格式
logger
.
info
(
df
.
format
(
new
Date
()));
...
...
@@ -392,7 +392,7 @@ public class Coupon_FloorTest extends DuibaTestBase {
}
@Test
(
dependsOnMethods
=
{
"B_优惠券手机端"
})
@Test
public
void
C_
删除优惠券楼层皮肤
()
throws
Exception
{
...
...
src/test/java/http/cases/FloorTest/Game_FloorTest.java
View file @
7f72e747
...
...
@@ -230,7 +230,7 @@ public class Game_FloorTest extends DuibaTestBase {
}
@Test
(
dependsOnMethods
=
{
"A_创建游戏楼层皮肤"
})
@Test
public
void
B_
游戏手机端
()
throws
Exception
{
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss:SSS"
);
//设置日期格式
logger
.
info
(
df
.
format
(
new
Date
()));
...
...
@@ -272,7 +272,7 @@ public class Game_FloorTest extends DuibaTestBase {
}
@Test
(
dependsOnMethods
=
{
"B_游戏手机端"
})
@Test
public
void
C_
删除游戏楼层皮肤
()
throws
Exception
{
...
...
src/test/java/http/cases/FloorTest/Icon_FloorTest.java
View file @
7f72e747
...
...
@@ -222,7 +222,7 @@ public class Icon_FloorTest extends DuibaTestBase {
}
@Test
(
dependsOnMethods
=
{
"A_创建icon楼层皮肤"
})
@Test
public
void
B_icon
添加图标
()
throws
Exception
{
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss:SSS"
);
//设置日期格式
...
...
@@ -296,7 +296,7 @@ public class Icon_FloorTest extends DuibaTestBase {
}
@Test
(
dependsOnMethods
=
{
"B_icon添加图标"
})
@Test
public
void
C_icon
编辑图标
()
throws
Exception
{
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss:SSS"
);
//设置日期格式
logger
.
info
(
df
.
format
(
new
Date
()));
...
...
@@ -352,7 +352,7 @@ public class Icon_FloorTest extends DuibaTestBase {
Assert
.
assertEquals
(
map
.
get
(
"logo"
),
"//yun.dui88.com/images/201806/9lz5ifre0h.png"
,
"今日必抢logo校验错误"
);
}
@Test
(
dependsOnMethods
=
{
"C_icon编辑图标"
})
@Test
public
void
D_icon
删除图标
()
throws
Exception
{
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss:SSS"
);
//设置日期格式
logger
.
info
(
df
.
format
(
new
Date
()));
...
...
@@ -388,7 +388,7 @@ public class Icon_FloorTest extends DuibaTestBase {
}
@Test
(
dependsOnMethods
=
{
"D_icon删除图标"
})
@Test
public
void
E_
删除
icon
楼层皮肤
()
throws
Exception
{
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss:SSS"
);
//设置日期格式
logger
.
info
(
df
.
format
(
new
Date
()));
...
...
src/test/java/http/cases/FloorTest/Item_FloorTest.java
View file @
7f72e747
...
...
@@ -362,7 +362,7 @@ public class Item_FloorTest extends DuibaTestBase {
}
@Test
(
dependsOnMethods
=
{
"A_item创建楼层皮肤"
})
@Test
public
void
B_item
手机端
()
throws
Exception
{
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss:SSS"
);
//设置日期格式
...
...
@@ -404,7 +404,7 @@ public class Item_FloorTest extends DuibaTestBase {
}
@Test
(
dependsOnMethods
=
{
"B_item手机端"
})
@Test
public
void
C_item
删除楼层皮肤
()
throws
Exception
{
...
...
src/test/java/http/cases/FloorTest/Seckill_FloorTest.java
View file @
7f72e747
...
...
@@ -806,7 +806,7 @@ public class Seckill_FloorTest extends DuibaTestBase {
response
=
floorService
.
switchOpenState
(
authorization
.
ssoLogin
(),
skinId
,
"true"
);
}
@Test
(
dependsOnMethods
=
{
"A_Seckill创建楼层皮肤"
})
@Test
public
void
B_Seckill
手机端
()
throws
Exception
{
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss:SSS"
);
//设置日期格式
logger
.
info
(
df
.
format
(
new
Date
()));
...
...
@@ -849,7 +849,7 @@ public class Seckill_FloorTest extends DuibaTestBase {
}
@Test
(
dependsOnMethods
=
{
"B_Seckill手机端"
})
@Test
public
void
C_Seckill
删除楼层皮肤
()
throws
Exception
{
...
...
src/test/java/http/cases/FloorTest/Showcase_FloorTest.java
View file @
7f72e747
...
...
@@ -244,7 +244,7 @@ public class Showcase_FloorTest extends DuibaTestBase {
}
@Test
(
dependsOnMethods
=
{
"A_Showcase创建楼层皮肤"
})
@Test
public
void
B_Showcase
手机端
()
throws
Exception
{
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss:SSS"
);
//设置日期格式
...
...
@@ -289,7 +289,7 @@ public class Showcase_FloorTest extends DuibaTestBase {
}
@Test
(
dependsOnMethods
=
{
"B_Showcase手机端"
})
@Test
public
void
C_Showcase
删除楼层皮肤
()
throws
Exception
{
...
...
src/test/java/http/cases/FloorTest/Sign_FloorTest.java
View file @
7f72e747
...
...
@@ -510,7 +510,7 @@ public class Sign_FloorTest extends DuibaTestBase {
}
@Test
(
dependsOnMethods
=
{
"A_sign创建楼层皮肤"
})
@Test
public
void
B_sign
手机端
()
throws
Exception
{
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss:SSS"
);
//设置日期格式
logger
.
info
(
df
.
format
(
new
Date
()));
...
...
@@ -545,7 +545,7 @@ public class Sign_FloorTest extends DuibaTestBase {
}
@Test
(
dependsOnMethods
=
{
"B_sign手机端"
})
@Test
public
void
C_sign
删除楼层皮肤
()
throws
Exception
{
...
...
src/test/java/http/cases/NewCollectActivityTest/新旧集卡_发卡_DuibaTest.java
View file @
7f72e747
...
...
@@ -136,7 +136,7 @@ public class 新旧集卡_发卡_DuibaTest extends DuibaTestBase {
}
@Test
//
@Test
public
void
活动工具发旧集卡
_
扣积分
()
throws
Exception
{
String
activityId
=
"37274"
;
...
...
@@ -172,7 +172,7 @@ public class 新旧集卡_发卡_DuibaTest extends DuibaTestBase {
@Test
//
@Test
public
void
活动工具发新集卡
_
扣积分
()
throws
Exception
{
String
activityId
=
"37275"
;
...
...
src/test/java/http/cases/PkTest/pk_押注测试_AccessTest.java
View file @
7f72e747
...
...
@@ -306,6 +306,7 @@ public class pk_押注测试_AccessTest extends DuibaTestBase {
doJoinResponse
.
prettyPrint
();
Assert
.
assertEquals
(
doJoinResponse
.
jsonPath
().
getString
(
"code"
).
toString
(),
"100060"
);
clear
(
consumerIds
);
}
...
...
src/test/java/http/cases/PkTest/pk_瓜分红包_发券测试.java
0 → 100644
View file @
7f72e747
/**
* Copyright (C), 2015-2018
* FileName: pk_瓜分红包_首页中奖弹层测试_AccessTest
* Author: qianwenjun
* Date: 2018/12/22 12:38
* Description:
*/
package
http
.
cases
.
PkTest
;
import
base.DuibaLog
;
import
base.DuibaTestBase
;
import
com.alibaba.fastjson.JSONObject
;
import
http.model.PkPopPrizeVo
;
import
http.service.Activity.PkService
;
import
http.service.Manager.EditManagerInfoService
;
import
http.service.Manager.PkActivityService
;
import
http.service.hd.DeveloperConfigService
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.testng.Assert
;
import
org.testng.annotations.AfterClass
;
import
org.testng.annotations.Test
;
import
utils.GetCookieUtil
;
import
java.sql.SQLException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 〈〉
*
* @author qianwenjun
* @create 2018/12/22
* @since 1.0.0
*/
public
class
pk_
瓜分红包
_
发券测试
extends
DuibaTestBase
{
@Autowired
PkService
pkService
;
@Autowired
PkActivityService
pkActivityService
;
@Autowired
DeveloperConfigService
developerConfigService
;
@Autowired
EditManagerInfoService
editManagerInfoService
;
private
static
DuibaLog
logger
=
DuibaLog
.
getLogger
();
private
Integer
user01
=
5447
;
//appid=21982
private
Integer
user02
=
5448
;
//appid=21982
// private Integer user03 = 5449;//appid=21982
//
// private Integer user04 = 5450;//appid=21982
List
<
String
>
newBetIds
=
new
ArrayList
<>();
private
String
consumerIds
=
""
;
@Test
(
priority
=
0
)
public
void
瓜分红包
_
首页不中奖
_
发券
()
throws
Exception
{
String
newBetId
=
""
;
List
<
String
>
optionsIds
=
new
ArrayList
<>();
String
groupId
=
"199"
;
newBetId
=
createPk
(
"2"
,
"2020-08-12 00:00:00"
,
groupId
);
newBetIds
.
add
(
newBetId
);
List
<
Map
<
String
,
Object
>>
pks
=
jdbc
.
findModeResult
(
"select * from act_com_conf.tb_bet_option where bet_id = ?"
,
newBetId
);
logger
.
info
(
"pk活动信息为"
+
JSONObject
.
toJSONString
(
pks
));
for
(
int
i
=
0
;
i
<
pks
.
size
();
i
++){
optionsIds
.
add
(
pks
.
get
(
i
).
get
(
"id"
).
toString
());
}
logger
.
info
(
"pk活动id为:"
+
newBetId
+
",选项id为:"
+
optionsIds
.
toString
());
Response
res1
=
pkService
.
doJoin
(
user01
,
newBetId
,
optionsIds
.
get
(
0
));
Response
res2
=
pkService
.
doJoin
(
user02
,
newBetId
,
optionsIds
.
get
(
1
));
this
.
modifyOpenPrizeTime
(
newBetId
,
60
);
//调用开奖接口
Response
doDrowRresponse
=
pkActivityService
.
doDraw
();
Assert
.
assertEquals
(
doDrowRresponse
.
jsonPath
().
getString
(
"success"
),
"true"
,
"开奖结果校验失败"
);
Assert
.
assertEquals
(
doDrowRresponse
.
jsonPath
().
getString
(
"data"
),
"开奖中。。。"
,
"开奖messag校验失败"
);
Thread
.
sleep
(
8000
);
Response
popRes
=
pkService
.
popup
(
user02
);
popRes
.
prettyPrint
();
Assert
.
assertEquals
(
popRes
.
jsonPath
().
getString
(
"data.show"
),
"false"
,
"校验是否展示弹层失败"
);
Assert
.
assertEquals
(
popRes
.
jsonPath
().
getString
(
"data.totalBonus"
),
"0.0"
,
"校验红包值失败"
);
Assert
.
assertEquals
(
popRes
.
jsonPath
().
getString
(
"data.drawType"
),
"0"
,
"校验开奖类型失败"
);
Assert
.
assertEquals
(
popRes
.
jsonPath
().
getString
(
"data.lucky"
),
"true"
,
"校验不发福袋失败失败"
);
Assert
.
assertEquals
(
popRes
.
jsonPath
().
getString
(
"data.prizeList"
),
null
,
"校验中奖list为null"
);
Response
popRes1
=
pkService
.
popup
(
user01
);
popRes1
.
prettyPrint
();
Assert
.
assertEquals
(
popRes1
.
jsonPath
().
getString
(
"data.show"
),
"true"
,
"校验是否展示弹层失败"
);
Assert
.
assertEquals
(
popRes1
.
jsonPath
().
getString
(
"data.totalBonus"
),
"0.1"
,
"校验红包值失败"
);
Assert
.
assertEquals
(
popRes1
.
jsonPath
().
getString
(
"data.drawType"
),
"0"
,
"校验开奖类型失败"
);
Assert
.
assertEquals
(
popRes1
.
jsonPath
().
getString
(
"data.lucky"
),
"false"
,
"校验不发福袋失败失败"
);
List
<
PkPopPrizeVo
>
prizeVoList
=
popRes
.
jsonPath
().
getList
(
"data.prizeList"
,
PkPopPrizeVo
.
class
);
logger
.
info
(
"开奖结果的list为:"
+
JSONObject
.
toJSONString
(
prizeVoList
));
for
(
PkPopPrizeVo
prize:
prizeVoList
){
if
(
prize
.
getBonusType
().
equals
(
"2"
)){
Assert
.
assertEquals
(
prize
.
getTotalBonus
(),
"10"
,
"校验list的瓜分红包金额失败"
);
}
}
}
@Test
public
void
押注
_
新用户首次参与测试
()
throws
Exception
{
Map
<
String
,
String
>
user
=
this
.
createUser
();
consumerIds
=
user
.
get
(
"consumerId"
);
logger
.
info
(
"consumerIds的信息为"
+
consumerIds
);
String
newBetId
=
""
;
List
<
String
>
optionsIds
=
new
ArrayList
<>();
String
groupId
=
"200"
;
newBetId
=
createPk
(
"2"
,
"2020-08-12 00:00:00"
,
groupId
);
newBetIds
.
add
(
newBetId
);
List
<
Map
<
String
,
Object
>>
pks
=
jdbc
.
findModeResult
(
"select * from act_com_conf.tb_bet_option where bet_id = ?"
,
newBetId
);
logger
.
info
(
"pk活动信息为"
+
JSONObject
.
toJSONString
(
pks
));
for
(
int
i
=
0
;
i
<
pks
.
size
();
i
++){
optionsIds
.
add
(
pks
.
get
(
i
).
get
(
"id"
).
toString
());
}
logger
.
info
(
"pk活动id为:"
+
newBetId
+
",选项id为:"
+
optionsIds
.
toString
());
Response
doJoinResponse
=
pkService
.
doJoin2
(
Integer
.
valueOf
(
user
.
get
(
"uid"
)),
newBetId
,
optionsIds
.
get
(
0
));
doJoinResponse
.
prettyPrint
();
Assert
.
assertEquals
(
doJoinResponse
.
jsonPath
().
getString
(
"code"
).
toString
(),
"100060"
);
}
public
String
createPk
(
String
bounsType
,
String
endTime
,
String
groupId
)
throws
Exception
{
Response
betResponse
=
pkActivityService
.
betForSetUp
(
bounsType
,
endTime
);
logger
.
info
(
"新建pk活动的结果信息为"
+
JSONObject
.
toJSONString
(
betResponse
.
prettyPrint
()));
betResponse
.
prettyPrint
();
String
betId
=
betResponse
.
jsonPath
().
getString
(
"data"
);
logger
.
info
(
"newBetId的信息为"
+
betId
);
Response
betRelation
=
pkActivityService
.
betGroupRelation
(
betId
,
endTime
,
groupId
);
Response
modifyStatusResponse
=
pkActivityService
.
modifySatus
(
betId
);
return
betId
;
}
public
void
modifyOpenPrizeTime
(
String
betId
,
int
x
)
throws
Exception
{
String
endTimeStr
=
"2018-11-26 20:24:39"
;
Boolean
result1
=
jdbc
.
update
(
"update act_com_conf.tb_bet_config set end_time = ? where id = ?\n"
,
endTimeStr
,
betId
);
Boolean
result2
=
jdbc
.
update
(
"update act_com_conf.tb_bet_group_relation set end_time = ? where bet_id = ?\n"
,
endTimeStr
,
betId
);
}
public
Map
<
String
,
String
>
createUser
()
throws
Exception
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
Response
response
=
editManagerInfoService
.
createUser
(
"pk活动首次参与用户发券"
,
"103"
);
Map
<
String
,
Object
>
user
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where name = 'pk活动首次参与用户发券' and app_id = '103'\n"
);
String
uid
=
user
.
get
(
"id"
).
toString
();
String
url
=
GetCookieUtil
.
genUrl
(
uid
,
"3NhqvHsNBDfcAJBUvdxmAs8mHq2d"
);
JSONObject
cookie
=
GetCookieUtil
.
getConsumerIdFromCookie
(
url
);
map
.
put
(
"uid"
,
uid
);
map
.
put
(
"consumerId"
,
cookie
.
get
(
"cid"
).
toString
());
logger
.
info
(
"用户信息为,uid="
+
uid
+
"consumerId="
+
cookie
.
get
(
"cid"
).
toString
());
return
map
;
}
public
void
clear
(
String
comsumerIds
)
throws
Exception
{
Boolean
res
=
jdbc
.
update
(
"delete from dafuweng.user where name = 'pk活动首次参与用户' and app_id = '103'"
);
String
dbName
=
"new_consumer.consumer_"
+
String
.
format
(
"%04d"
,
Long
.
parseLong
(
comsumerIds
)/
10000000
);
logger
.
info
(
"用户的分表名dbName为"
+
dbName
);
Boolean
res1
=
jdbc
.
update
(
"delete from "
+
dbName
+
" where id = ?"
,
comsumerIds
);
}
// @AfterClass
public
void
tearDown
()
{
try
{
for
(
String
newBetId:
newBetIds
){
Boolean
result1
=
jdbc
.
update
(
"delete from act_com_conf.tb_bet_option where bet_id = ?"
,
newBetId
);
Boolean
result4
=
jdbc
.
update
(
"delete from act_record.tb_bet_record where bet_id = ?"
,
newBetId
);
Boolean
result5
=
jdbc
.
update
(
"delete from bet_activity.tb_bet_result where bet_id = ?"
,
newBetId
);
Boolean
result2
=
jdbc
.
update
(
"delete from act_com_conf.tb_bet_group_relation where bet_id = ?"
,
newBetId
);
Boolean
result3
=
jdbc
.
update
(
"delete from act_com_conf.tb_bet_config where id = ?"
,
newBetId
);
}
clear
(
consumerIds
);
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
}
}
\ No newline at end of file
src/test/java/http/cases/PkTest/pk_瓜分红包_首页中奖弹层测试_AccessTest.java
0 → 100644
View file @
7f72e747
/**
* Copyright (C), 2015-2018
* FileName: pk_瓜分红包_首页中奖弹层测试_AccessTest
* Author: qianwenjun
* Date: 2018/12/22 12:38
* Description:
*/
package
http
.
cases
.
PkTest
;
import
base.DuibaLog
;
import
base.DuibaTestBase
;
import
com.alibaba.fastjson.JSONObject
;
import
http.model.PkPopPrizeVo
;
import
http.service.Activity.PkService
;
import
http.service.Manager.PkActivityService
;
import
io.restassured.response.Response
;
import
org.joda.time.DateTime
;
import
org.joda.time.format.DateTimeFormat
;
import
org.joda.time.format.DateTimeFormatter
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.testng.Assert
;
import
org.testng.annotations.AfterClass
;
import
org.testng.annotations.BeforeMethod
;
import
org.testng.annotations.Test
;
import
java.sql.SQLException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
/**
* 〈〉
*
* @author qianwenjun
* @create 2018/12/22
* @since 1.0.0
*/
public
class
pk_
瓜分红包
_
首页中奖弹层测试
_AccessTest
extends
DuibaTestBase
{
@Autowired
PkService
pkService
;
@Autowired
PkActivityService
pkActivityService
;
private
static
DuibaLog
logger
=
DuibaLog
.
getLogger
();
private
Integer
user01
=
5434
;
//appid=21982
private
String
consumerId01
=
"100122071"
;
private
Integer
user02
=
5435
;
//appid=21982
private
String
consumerId02
=
"100122072"
;
private
Integer
user03
=
5449
;
//appid=21982
private
Integer
user04
=
5450
;
//appid=21982
List
<
String
>
newBetIds
=
new
ArrayList
<>();
@Test
(
priority
=
0
)
public
void
瓜分红包
_
首页中奖
()
throws
Exception
{
String
newBetId
=
""
;
List
<
String
>
optionsIds
=
new
ArrayList
<>();
String
groupId
=
"194"
;
newBetId
=
createPk
(
"2"
,
"2020-08-12 00:00:00"
,
groupId
);
newBetIds
.
add
(
newBetId
);
List
<
Map
<
String
,
Object
>>
pks
=
jdbc
.
findModeResult
(
"select * from act_com_conf.tb_bet_option where bet_id = ?"
,
newBetId
);
logger
.
info
(
"pk活动信息为"
+
JSONObject
.
toJSONString
(
pks
));
for
(
int
i
=
0
;
i
<
pks
.
size
();
i
++){
optionsIds
.
add
(
pks
.
get
(
i
).
get
(
"id"
).
toString
());
}
logger
.
info
(
"pk活动id为:"
+
newBetId
+
",选项id为:"
+
optionsIds
.
toString
());
Response
res1
=
pkService
.
doJoin
(
user03
,
newBetId
,
optionsIds
.
get
(
0
));
this
.
modifyOpenPrizeTime
(
newBetId
,
60
);
//调用开奖接口
Response
doDrowRresponse
=
pkActivityService
.
doDraw
();
Assert
.
assertEquals
(
doDrowRresponse
.
jsonPath
().
getString
(
"success"
),
"true"
,
"开奖结果校验失败"
);
Assert
.
assertEquals
(
doDrowRresponse
.
jsonPath
().
getString
(
"data"
),
"开奖中。。。"
,
"开奖messag校验失败"
);
Thread
.
sleep
(
8000
);
Response
popRes
=
pkService
.
popup
(
user03
);
popRes
.
prettyPrint
();
Assert
.
assertEquals
(
popRes
.
jsonPath
().
getString
(
"data.show"
),
"true"
,
"校验是否展示弹层失败"
);
Assert
.
assertEquals
(
popRes
.
jsonPath
().
getString
(
"data.totalBonus"
),
"0.1"
,
"校验是否展示弹层失败"
);
Assert
.
assertEquals
(
popRes
.
jsonPath
().
getString
(
"data.drawType"
),
"0"
,
"校验开奖类型失败"
);
Assert
.
assertEquals
(
popRes
.
jsonPath
().
getString
(
"data.lucky"
),
"false"
,
"校验不发福袋失败失败"
);
List
<
PkPopPrizeVo
>
prizeVoList
=
popRes
.
jsonPath
().
getList
(
"data.prizeList"
,
PkPopPrizeVo
.
class
);
logger
.
info
(
"开奖结果的list为:"
+
JSONObject
.
toJSONString
(
prizeVoList
));
for
(
PkPopPrizeVo
prize:
prizeVoList
){
if
(
prize
.
getBonusType
().
equals
(
"2"
)){
Assert
.
assertEquals
(
prize
.
getTotalBonus
(),
"10"
,
"校验list的瓜分红包金额失败"
);
}
}
}
@Test
(
priority
=
2
)
public
void
瓜分红包
_
首页不中奖
()
throws
Exception
{
String
newBetId
=
""
;
List
<
String
>
optionsIds
=
new
ArrayList
<>();
String
groupId
=
"194"
;
newBetId
=
createPk
(
"2"
,
"2020-08-12 00:00:00"
,
groupId
);
newBetIds
.
add
(
newBetId
);
List
<
Map
<
String
,
Object
>>
pks
=
jdbc
.
findModeResult
(
"select * from act_com_conf.tb_bet_option where bet_id = ?"
,
newBetId
);
logger
.
info
(
"pk活动信息为"
+
JSONObject
.
toJSONString
(
pks
));
for
(
int
i
=
0
;
i
<
pks
.
size
();
i
++){
optionsIds
.
add
(
pks
.
get
(
i
).
get
(
"id"
).
toString
());
}
logger
.
info
(
"pk活动id为:"
+
newBetId
+
",选项id为:"
+
optionsIds
.
toString
());
Response
res1
=
pkService
.
doJoin
(
user01
,
newBetId
,
optionsIds
.
get
(
0
));
Response
res2
=
pkService
.
doJoin
(
user02
,
newBetId
,
optionsIds
.
get
(
1
));
this
.
modifyOpenPrizeTime
(
newBetId
,
60
);
//调用开奖接口
Response
doDrowRresponse
=
pkActivityService
.
doDraw
();
Assert
.
assertEquals
(
doDrowRresponse
.
jsonPath
().
getString
(
"success"
),
"true"
,
"开奖结果校验失败"
);
Assert
.
assertEquals
(
doDrowRresponse
.
jsonPath
().
getString
(
"data"
),
"开奖中。。。"
,
"开奖messag校验失败"
);
Thread
.
sleep
(
8000
);
Response
popRes
=
pkService
.
popup
(
user02
);
popRes
.
prettyPrint
();
Assert
.
assertEquals
(
popRes
.
jsonPath
().
getString
(
"data.show"
),
"false"
,
"校验是否展示弹层失败"
);
Assert
.
assertEquals
(
popRes
.
jsonPath
().
getString
(
"data.totalBonus"
),
"0.0"
,
"校验红包值失败"
);
Assert
.
assertEquals
(
popRes
.
jsonPath
().
getString
(
"data.drawType"
),
"0"
,
"校验开奖类型失败"
);
Assert
.
assertEquals
(
popRes
.
jsonPath
().
getString
(
"data.lucky"
),
"false"
,
"校验不发福袋失败失败"
);
Assert
.
assertEquals
(
popRes
.
jsonPath
().
getString
(
"data.prizeList"
),
null
,
"校验中奖list为null"
);
}
@Test
(
priority
=
1
)
public
void
瓜分红包
_
首页中
_
多次中奖
()
throws
Exception
{
for
(
int
i
=
0
;
i
<
3
;
i
++){
String
newBetId
=
""
;
List
<
String
>
optionsIds
=
new
ArrayList
<>();
String
groupId
=
"194"
;
newBetId
=
createPk
(
"2"
,
"2020-08-12 00:00:00"
,
groupId
);
newBetIds
.
add
(
newBetId
);
List
<
Map
<
String
,
Object
>>
pks
=
jdbc
.
findModeResult
(
"select * from act_com_conf.tb_bet_option where bet_id = ?"
,
newBetId
);
logger
.
info
(
"pk活动信息为"
+
JSONObject
.
toJSONString
(
pks
));
for
(
int
j
=
0
;
j
<
pks
.
size
();
j
++){
optionsIds
.
add
(
pks
.
get
(
j
).
get
(
"id"
).
toString
());
}
logger
.
info
(
"pk活动id为:"
+
newBetId
+
",选项id为:"
+
optionsIds
.
toString
());
Response
res1
=
pkService
.
doJoin
(
user04
,
newBetId
,
optionsIds
.
get
(
0
));
this
.
modifyOpenPrizeTime
(
newBetId
,
60
);
}
//调用开奖接口
Response
doDrowRresponse
=
pkActivityService
.
doDraw
();
Assert
.
assertEquals
(
doDrowRresponse
.
jsonPath
().
getString
(
"success"
),
"true"
,
"开奖结果校验失败"
);
Assert
.
assertEquals
(
doDrowRresponse
.
jsonPath
().
getString
(
"data"
),
"开奖中。。。"
,
"开奖messag校验失败"
);
Thread
.
sleep
(
8000
);
Response
popRes
=
pkService
.
popup
(
user04
);
popRes
.
prettyPrint
();
Assert
.
assertEquals
(
popRes
.
jsonPath
().
getString
(
"data.show"
),
"true"
,
"校验是否展示弹层失败"
);
Assert
.
assertEquals
(
popRes
.
jsonPath
().
getString
(
"data.totalBonus"
),
"0.3"
,
"校验是否展示弹层失败"
);
Assert
.
assertEquals
(
popRes
.
jsonPath
().
getString
(
"data.drawType"
),
"0"
,
"校验开奖类型失败"
);
Assert
.
assertEquals
(
popRes
.
jsonPath
().
getString
(
"data.lucky"
),
"false"
,
"校验不发福袋失败失败"
);
List
<
PkPopPrizeVo
>
prizeVoList
=
popRes
.
jsonPath
().
getList
(
"data.prizeList"
,
PkPopPrizeVo
.
class
);
logger
.
info
(
"开奖结果的list为:"
+
JSONObject
.
toJSONString
(
prizeVoList
));
for
(
PkPopPrizeVo
prize:
prizeVoList
){
if
(
prize
.
getBonusType
().
equals
(
"2"
)){
Assert
.
assertEquals
(
prize
.
getTotalBonus
(),
"30"
,
"校验list的瓜分红包金额失败"
);
}
}
}
public
String
createPk
(
String
bounsType
,
String
endTime
,
String
groupId
)
throws
Exception
{
Response
betResponse
=
pkActivityService
.
betForSetUp
(
bounsType
,
endTime
);
logger
.
info
(
"新建pk活动的结果信息为"
+
JSONObject
.
toJSONString
(
betResponse
.
prettyPrint
()));
betResponse
.
prettyPrint
();
String
betId
=
betResponse
.
jsonPath
().
getString
(
"data"
);
logger
.
info
(
"newBetId的信息为"
+
betId
);
Response
betRelation
=
pkActivityService
.
betGroupRelation
(
betId
,
endTime
,
groupId
);
Response
modifyStatusResponse
=
pkActivityService
.
modifySatus
(
betId
);
return
betId
;
}
public
void
modifyOpenPrizeTime
(
String
betId
,
int
x
)
throws
Exception
{
String
endTimeStr
=
"2018-11-26 20:24:39"
;
Boolean
result1
=
jdbc
.
update
(
"update act_com_conf.tb_bet_config set end_time = ? where id = ?\n"
,
endTimeStr
,
betId
);
Boolean
result2
=
jdbc
.
update
(
"update act_com_conf.tb_bet_group_relation set end_time = ? where bet_id = ?\n"
,
endTimeStr
,
betId
);
}
@AfterClass
public
void
tearDown
()
{
try
{
for
(
String
newBetId:
newBetIds
){
Boolean
result1
=
jdbc
.
update
(
"delete from act_com_conf.tb_bet_option where bet_id = ?"
,
newBetId
);
Boolean
result4
=
jdbc
.
update
(
"delete from act_record.tb_bet_record where bet_id = ?"
,
newBetId
);
Boolean
result5
=
jdbc
.
update
(
"delete from bet_activity.tb_bet_result where bet_id = ?"
,
newBetId
);
Boolean
result2
=
jdbc
.
update
(
"delete from act_com_conf.tb_bet_group_relation where bet_id = ?"
,
newBetId
);
Boolean
result3
=
jdbc
.
update
(
"delete from act_com_conf.tb_bet_config where id = ?"
,
newBetId
);
}
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
}
}
\ No newline at end of file
src/test/java/http/cases/PluginActivityTest/插件工具抽奖测试_pluginTest.java
View file @
7f72e747
...
...
@@ -59,9 +59,9 @@ public class 插件工具抽奖测试_pluginTest extends DuibaTestBase {
Object
[][]
result
=
null
;
if
(
method
.
getName
().
equals
(
"插件工具抽奖测试"
))
{
result
=
new
Object
[][]{
new
Object
[]{
1
,
"1100"
,
"插件出奖开心码测试"
},
//
new Object[]{2,"881","插件工具积分消耗"},
//
new Object[]{3,"1137","插件工具免费次数使用"},
//
new Object[]{1,"1100","插件出奖开心码测试"},
new
Object
[]{
2
,
"881"
,
"插件工具积分消耗"
},
new
Object
[]{
3
,
"1137"
,
"插件工具免费次数使用"
},
};
}
...
...
src/test/java/http/cases/SaasDeveloperTest/补给站_活动_DuibaTest.java
View file @
7f72e747
...
...
@@ -28,6 +28,19 @@ public class 补给站_活动_DuibaTest extends AbstractTestNGSpringContextTests
//添加活动
@Test
(
description
=
"//添加活动"
)
public
void
a_
添加活动
()
throws
Exception
{
//查询订单列表
Response
orderResponse
=
developerBJZ
.
selectOrders
(
"1"
,
appId
);
String
id
=
orderResponse
.
jsonPath
().
getString
(
"data.list"
);
logger
.
info
(
"待付款订单id为:"
+
id
);
if
(
id
.
equals
(
"[]"
)){
logger
.
info
(
"订购列表无待付款订单"
);
}
else
{
id
=
orderResponse
.
jsonPath
().
getString
(
"data.list[0].id"
);
logger
.
info
(
"待付款订单id为:"
+
id
);
developerBJZ
.
cancleOrder
(
id
,
appId
);
logger
.
info
(
"待付款订单取消成功"
);
}
//查询热门活动-活动列表,获取商品ID
Response
response
=
developerBJZ
.
saasActivitys
(
"3"
,
appId
);
String
goodItemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.saasActivitys[0].id"
));
...
...
src/test/java/http/cases/SaasDeveloperTest/设置_应用信息_DuibaTest.java
View file @
7f72e747
package
http
.
cases
.
SaasDeveloperTest
;
import
base.Config
;
import
base.DuibaBase
;
import
http.service.Manager.ADeveloperService
;
import
http.service.Saas.UpdateAppInfoService
;
import
base.DuibaLog
;
import
io.restassured.response.Response
;
import
org.apache.commons.exec.ExecuteException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.testng.AbstractTestNGSpringContextTests
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
@ContextConfiguration
(
classes
=
Config
.
class
)
public
class
设置
_
应用信息
_DuibaTest
extends
AbstractTestNGSpringContextTests
{
//@ContextConfiguration(classes = Config.class)
public
class
设置
_
应用信息
_DuibaTest
extends
DuibaBase
{
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
@Autowired
UpdateAppInfoService
updateAppInfoService
;
@Autowired
ADeveloperService
aDeveloperService
;
String
appId
=
"19515"
;
//设置--保存应用信息
@Test
public
void
保存应用信息
()
throws
Exception
{
String
appId
=
"19515"
;
String
earnCreditsUrl
=
"https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&tn=baidu&wd=www.baidu.com"
;
String
creditsDetailUrl
=
"https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&tn=baidu&wd=www.baidu.com"
;
Response
response
=
updateAppInfoService
.
appInfo
(
appId
);
Boolean
isDecimalOpen
=
response
.
jsonPath
().
getBoolean
(
"data.isDecimalOpen"
);
logger
.
info
(
"******"
+
isDecimalOpen
);
//
@Test
public
void
保存应用信息
()
throws
Exception
{
String
appId
=
"19515"
;
String
earnCreditsUrl
=
"https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&tn=baidu&wd=www.baidu.com"
;
String
creditsDetailUrl
=
"https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&tn=baidu&wd=www.baidu.com"
;
Response
response
=
updateAppInfoService
.
appInfo
(
appId
);
Boolean
isDecimalOpen
=
response
.
jsonPath
().
getBoolean
(
"data.isDecimalOpen"
);
logger
.
info
(
"******"
+
isDecimalOpen
);
String
unitName
=
isDecimalOpen
?
"元"
:
"积分"
;
updateAppInfoService
.
UpdateAppInfo
(
appId
,
unitName
,
earnCreditsUrl
,
creditsDetailUrl
,
isDecimalOpen
);
updateAppInfoService
.
UpdateAppInfo
(
appId
,
unitName
,
earnCreditsUrl
,
creditsDetailUrl
,
isDecimalOpen
);
Thread
.
sleep
(
1000
);
Response
response2
=
updateAppInfoService
.
appInfo
(
appId
);
Response
response2
=
updateAppInfoService
.
appInfo
(
appId
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.name"
),
"(saas自动化)至尊版"
,
"校验应用名称失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.earnCreditsLetter"
),
"积分文案&2"
,
"校验积分文案失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.creditsDetailUrl"
),
"https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&tn=baidu&wd=www.baidu.com"
,
"校验积分明细链接失败"
);
logger
.
info
(
"保存应用信息成功"
);
}
@Test
(
description
=
"// 查询员工信息——高级管理员信息"
)
public
void
a_
查询高级管理员信息
()
throws
Exception
{
Response
response1
=
aDeveloperService
.
developer
(
"109"
,
"text"
);
logger
.
info
(
"response1"
);
Response
response2
=
updateAppInfoService
.
selectEmployeeList
(
""
,
""
,
appId
);
logger
.
info
(
"response2"
);
String
mappname
=
response1
.
jsonPath
().
getString
(
"list[0].appName"
);
String
memail
=
response1
.
jsonPath
().
getString
(
"list[0].email"
);
String
mname
=
response1
.
jsonPath
().
getString
(
"list[0].name"
);
String
demail
=
response2
.
jsonPath
().
getString
(
"data.list[0].developerAccount"
);
String
dname
=
response2
.
jsonPath
().
getString
(
"data.list[0].nickName"
);
// 校验2个接口的信息是否一致
Assert
.
assertEquals
(
mappname
,
"(saas自动化)至尊版"
,
"校验应用名称失败"
);
Assert
.
assertEquals
(
memail
,
demail
,
"校验邮箱失败"
);
Assert
.
assertEquals
(
mname
,
dname
,
"校验高级管理员名称失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].roleName"
),
"高级管理员"
,
"校验角色名称失败"
);
logger
.
info
(
"校验高级管理员信息成功"
);
}
@Test
(
description
=
"//添加/编辑员工"
)
public
void
b_
添加员工
()
throws
Exception
{
Response
response
=
updateAppInfoService
.
selectAllRoles
(
appId
);
//查询角色接口,得到普通管理员的角色ID
String
roleId
=
response
.
jsonPath
().
getString
(
"data[1].id"
);
//添加一个注册过的开发者&普通管理员信息
updateAppInfoService
.
saveOrUpdate
(
"18258853242"
,
"hmx自动化测试"
,
roleId
,
"普通管理员"
,
appId
);
//刷新员工管理列表
updateAppInfoService
.
selectEmployeeList
(
""
,
"1"
,
appId
);
//校验是否添加成功
Assert
.
assertEquals
(
updateAppInfoService
.
selectEmployeeList
(
""
,
""
,
appId
).
jsonPath
().
getString
(
"data.list[1].developerAccount"
),
"18258853242"
,
"校验账号信息失败"
);
Assert
.
assertEquals
(
updateAppInfoService
.
selectEmployeeList
(
""
,
""
,
appId
).
jsonPath
().
getString
(
"data.list[1].nickName"
),
"hmx自动化测试"
,
"校验名称失败"
);
Assert
.
assertEquals
(
updateAppInfoService
.
selectEmployeeList
(
""
,
""
,
appId
).
jsonPath
().
getString
(
"data.list[1].roleName"
),
"普通管理员"
,
"校验角色名称失败"
);
logger
.
info
(
"校验普通管理员信息添加成功"
);
}
@Test
(
description
=
"兑吧账号精确搜索,姓名模糊搜索"
)
public
void
c_
搜索场景
()
throws
Exception
{
//通过邮箱号精确搜索
updateAppInfoService
.
selectEmployeeList
(
""
,
"wxs@duiba.com.cn"
,
appId
);
//通过手机号精确搜索
updateAppInfoService
.
selectEmployeeList
(
""
,
"18258853242"
,
appId
);
//姓名模糊搜索
updateAppInfoService
.
selectEmployeeList
(
""
,
"hmx"
,
appId
);
//通过角色名称搜索
updateAppInfoService
.
selectEmployeeList
(
"395"
,
""
,
appId
);
logger
.
info
(
"校验各种搜索成功"
);
}
@Test
(
description
=
"删除添加的管理员"
)
public
void
d_
删除管理员
()
throws
Exception
{
Response
response
=
updateAppInfoService
.
selectEmployeeList
(
""
,
""
,
appId
);
String
id
=
response
.
jsonPath
().
getString
(
"data.list[1].id"
);
logger
.
info
(
"员工id为:"
+
id
);
response
=
updateAppInfoService
.
delete
(
appId
,
id
);
logger
.
info
(
"员工删除成功!"
);
}
}
src/test/java/http/cases/SaasDeveloperTest/购物车测试.java
0 → 100644
View file @
7f72e747
/**
* Copyright (C), 2015-2018
* FileName: 购物车测试
* Author: zhaoran
* Date: 2018/12/10 19:45
* Description:
*/
package
http
.
cases
.
SaasDeveloperTest
;
import
base.DuibaLog
;
import
base.DuibaTestBase
;
import
http.service.Activity.PkService
;
import
http.service.Authorization
;
import
http.service.Saas.MallService
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.testng.Assert
;
import
org.testng.annotations.DataProvider
;
import
org.testng.annotations.Test
;
import
java.lang.reflect.Method
;
import
java.math.BigDecimal
;
import
java.util.HashMap
;
import
java.util.Map
;
import
static
io
.
restassured
.
RestAssured
.
given
;
public
class
购物车测试
extends
DuibaTestBase
{
@Value
(
"${activity.host}"
)
String
activityHost
;
@Autowired
MallService
mallService
;
@Autowired
Authorization
authorization
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
private
static
Integer
uid
=
5415
;
@Test
public
void
加入购物车
()
throws
Exception
{
//获取当前购物车数量
Response
response
=
mallService
.
getMallCount
(
uid
);
response
.
prettyPrint
();
logger
.
info
(
"购物车当前的数量为:"
+
response
.
jsonPath
().
getString
(
"data.trolleyItemCount"
));
}
}
\ No newline at end of file
src/test/java/http/cases/SingleLotteryTest/自有单抽限制
_AccessTest
.java
→
src/test/java/http/cases/SingleLotteryTest/自有单抽限制.java
View file @
7f72e747
...
...
@@ -9,12 +9,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Value
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.DataProvider
;
import
org.testng.annotations.Test
;
import
utils.MatcherString
;
import
utils.RedisUtil
;
import
java.lang.reflect.Method
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
...
...
@@ -23,7 +21,7 @@ import static io.restassured.RestAssured.given;
/**
* Created by zhaoran on 2018/6/8.
*/
public
class
自有单抽限制
_AccessTest
extends
DuibaTestBase
{
public
class
自有单抽限制
extends
DuibaTestBase
{
@Autowired
SingleLotteryService
singleLotteryService
;
@Autowired
...
...
src/test/java/http/model/PkPopPrizeVo.java
0 → 100644
View file @
7f72e747
/**
* Copyright (C), 2015-2018
* FileName: PkPopPrizeVo
* Author: qianwenjun
* Date: 2018/12/22 14:07
* Description:
*/
package
http
.
model
;
import
lombok.Getter
;
import
lombok.Setter
;
/**
* 〈〉
*
* @author qianwenjun
* @create 2018/12/22
* @since 1.0.0
*/
@Getter
@Setter
public
class
PkPopPrizeVo
{
private
String
bonusType
;
private
String
pluginId
;
private
String
title
;
private
String
totalBonus
;
}
\ No newline at end of file
src/test/java/http/service/Authorization.java
View file @
7f72e747
...
...
@@ -300,7 +300,7 @@ public class Authorization {
public
Map
hdLoginSaasNew
(
String
account
,
String
appId
){
String
path
=
"/doLoginNew"
;
int
i
=
10
;
logger
.
info
(
"hdCookiesSaas
ByApp
cookies:"
+
hdCookiesSaasNew
.
toString
());
logger
.
info
(
"hdCookiesSaas
New
cookies:"
+
hdCookiesSaasNew
.
toString
());
Map
<
String
,
String
>
hdCookies
=
hdCookiesSaasNew
.
get
(
appId
);
while
((
hdCookies
==
null
||
hdCookies
.
size
()==
0
)&&
i
>
0
)
{
Response
token
=
this
.
hdGetToken
();
...
...
@@ -328,7 +328,7 @@ public class Authorization {
i
--;
}
logger
.
info
(
"hdCookiesSaas
ByApp
cookies集合:"
+
hdCookiesSaasNew
.
toString
());
logger
.
info
(
"hdCookiesSaas
New
cookies集合:"
+
hdCookiesSaasNew
.
toString
());
return
hdCookies
;
}
...
...
src/test/java/http/service/Manager/ADeveloperService.java
View file @
7f72e747
...
...
@@ -97,4 +97,32 @@ public class ADeveloperService {
}
return
response
;
}
//管理后台-开发者维护-查询开发者账号详细信息
public
Response
developer
(
String
queryStrId
,
String
type
)
throws
Exception
{
String
url
=
"http://"
+
ManagerHost
+
"/newmanager/ADeveloper/developer"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"queryStr"
,
""
);
map
.
put
(
"queryStrId"
,
queryStrId
);
map
.
put
(
"type"
,
type
);
map
.
put
(
"pageNo"
,
"1"
);
map
.
put
(
"pageSize"
,
"20"
);
logger
.
info
(
"url"
+
url
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
ssoLogin
()).
params
(
map
).
get
(
url
);
response
.
prettyPrint
();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
);
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"创建接口1失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
)
{
throw
new
Exception
(
"创建接口2失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
}
src/test/java/http/service/Saas/MallService.java
0 → 100644
View file @
7f72e747
package
http
.
service
.
Saas
;
import
base.DuibaLog
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
http.service.Authorization
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.testng.Assert
;
import
java.util.HashMap
;
import
java.util.Map
;
import
static
io
.
restassured
.
RestAssured
.
given
;
/**
* Created by zhaoran on 2018/12/19.
*/
@Service
public
class
MallService
{
@Value
(
"${activity.host}"
)
String
activityHost
;
@Autowired
Authorization
authorization
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//获取购物车列表商品
public
Response
mallget
(
Integer
uid
)
throws
Exception
{
String
url
=
activityHost
+
"/mall-api/consumer/shopping-trolley/get"
;
Response
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
get
(
url
);
response
.
prettyPrint
();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"购物车列表接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"购物车列表接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//获取购物车列表商品
public
Response
getMallCount
(
Integer
uid
)
throws
Exception
{
String
url
=
activityHost
+
"/mall-api/consumer/market-activity/getMallCount"
;
Response
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
get
(
url
);
response
.
prettyPrint
();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"购物车数目接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"购物车数目接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
// 加入购物车
public
Response
malladd
(
String
appItemId
,
Integer
uid
)
throws
Exception
{
String
url
=
activityHost
+
"/mall-api/consumer/shopping-trolley/add"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appItemId"
,
appItemId
);
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
body
(
jsonParam
).
post
(
url
);
response
.
prettyPrint
();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"添加购物车接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"添加购物车接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
}
\ No newline at end of file
src/test/java/http/service/Saas/UpdateAppInfoService.java
View file @
7f72e747
...
...
@@ -2,6 +2,8 @@ package http.service.Saas;
import
base.DuibaLog
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
http.service.Authorization
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -73,4 +75,83 @@ public class UpdateAppInfoService {
return
response
;
}
//查询员工管理高级管理员信息(模糊查询,没有传参数)
public
Response
selectEmployeeList
(
String
roleId
,
String
keyword
,
String
appId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/employee/selectEmployeeList"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"roleId"
,
roleId
);
map
.
put
(
"rowId"
,
"1"
);
map
.
put
(
"keyword"
,
keyword
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
(
appId
)).
params
(
map
).
get
(
url
);
response
.
prettyPrint
();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"创建接口1失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
)
{
throw
new
Exception
(
"创建接口2失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//查询有的角色信息
public
Response
selectAllRoles
(
String
appId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/employee/selectAllRoles"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
(
appId
)).
params
(
map
).
get
(
url
);
response
.
prettyPrint
();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"创建接口1失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
)
{
throw
new
Exception
(
"创建接口2失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//添加员工——普通管理员
public
Response
saveOrUpdate
(
String
developerAccount
,
String
nickName
,
String
roleId
,
String
roleName
,
String
appId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/employee/saveOrUpdate"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"developerAccount"
,
developerAccount
);
map
.
put
(
"nickName"
,
nickName
);
map
.
put
(
"roleId"
,
roleId
);
map
.
put
(
"roleName"
,
roleName
);
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
Response
response
=
given
().
contentType
(
"application/json;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
(
appId
)).
body
(
jsonParam
).
post
(
url
);
response
.
prettyPrint
();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"创建接口1失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
)
{
throw
new
Exception
(
"创建接口2失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//删除管理员
public
Response
delete
(
String
appId
,
String
id
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/employee/delete"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"id"
,
id
);
Response
response
=
given
().
cookies
(
authorization
.
hdLoginSaas
(
appId
)).
params
(
map
).
get
(
url
);
response
.
prettyPrint
();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"/employee/delete失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
)
{
throw
new
Exception
(
"/employee/delete失败,返回信息:"
+
response
.
asString
());
}
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