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
4f87e98b
Commit
4f87e98b
authored
Nov 09, 2018
by
赵然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zr
parent
2957c24e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
163 additions
and
1 deletion
+163
-1
种红包_AccessTest.java
src/test/java/http/cases/WalletTest/种红包_AccessTest.java
+1
-1
种红包登录解锁_AccessTest.java
src/test/java/http/cases/WalletTest/种红包登录解锁_AccessTest.java
+162
-0
No files found.
src/test/java/http/cases/WalletTest/种红包_AccessTest.java
View file @
4f87e98b
...
...
@@ -104,7 +104,7 @@ public class 种红包_AccessTest extends DuibaTestBase{
}
@Test
@Test
(
description
=
"第二款土地种植一次解锁"
)
public
void
解锁土地
()
throws
Exception
{
Response
response
=
seedRedPacketService
.
updateUserLand
(
"19380"
,
"1"
,
"2"
,
"100066444"
,
"2"
);
Map
cookies
=
authorization
.
dafuwengLogin
(
3454
);
...
...
src/test/java/http/cases/WalletTest/种红包登录解锁_AccessTest.java
0 → 100644
View file @
4f87e98b
package
http
.
cases
.
WalletTest
;
import
base.DuibaLog
;
import
base.DuibaTestBase
;
import
http.service.Activity.SeedRedPacketService
;
import
http.service.Activity.WalletAccountService
;
import
http.service.Authorization
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
import
utils.RedisUtil
;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
/**
* Created by mabo on 2018/8/15
*/
public
class
种红包登录解锁
_AccessTest
extends
DuibaTestBase
{
@Autowired
SeedRedPacketService
seedRedPacketService
;
@Autowired
WalletAccountService
walletAccountService
;
@Autowired
Authorization
authorization
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//指定用户
private
static
int
uid
=
4565
;
private
static
String
consumerId
=
"100101043"
;
@BeforeClass
public
void
beforeclass
()
{
try
{
//还原用户的连续登陆天数为2
RedisUtil
.
setKey
(
"AAW_K146_19380_"
+
consumerId
+
"_"
+
getTime
(),
"2"
);
seedRedPacketService
.
updateUserLand
(
"19380"
,
"1"
,
"3"
,
consumerId
,
"1"
);
seedRedPacketService
.
updateUserLand
(
"19380"
,
"1"
,
"5"
,
consumerId
,
"1"
);
seedRedPacketService
.
updateUserLand
(
"19380"
,
"1"
,
"7"
,
consumerId
,
"1"
);
}
catch
(
Exception
e
)
{
logger
.
info
(
"数据前后置操作异常"
);
}
}
@Test
(
description
=
"第三块土地连续登录3天解锁"
)
public
void
a_
第三块土地解锁
()
throws
Exception
{
//dafuweng登陆获取cookies
Map
cookies
=
authorization
.
dafuwengLogin
(
uid
);
//调用getLandList接口
Response
response
=
seedRedPacketService
.
getLandList
(
cookies
,
"1"
,
"424"
);
String
landStatus
=
response
.
jsonPath
().
getString
(
"data.landList[2].landStatus"
);
logger
.
info
(
"第三块土地状态为:未解锁-"
+
landStatus
);
Assert
.
assertEquals
(
landStatus
,
"1"
,
"第三块土地状态校验失败"
);
//修改redis用户连续登陆天数为3天
RedisUtil
.
setKey
(
"AAW_K146_19380_"
+
consumerId
+
"_"
+
getTime
(),
"3"
);
//调用getLandList接口
response
=
seedRedPacketService
.
getLandList
(
cookies
,
"1"
,
"424"
);
landStatus
=
response
.
jsonPath
().
getString
(
"data.landList[2].landStatus"
);
logger
.
info
(
"第三块土地状态为:可解锁-"
+
landStatus
);
Assert
.
assertEquals
(
landStatus
,
"2"
,
"第三块土地状态校验失败"
);
//调用解锁土地接口
response
=
seedRedPacketService
.
unlockLand
(
cookies
,
"1"
,
"424"
,
"3"
);
//调用getLandList接口
response
=
seedRedPacketService
.
getLandList
(
cookies
,
"1"
,
"424"
);
landStatus
=
response
.
jsonPath
().
getString
(
"data.landList[2].landStatus"
);
logger
.
info
(
"第三块土地状态为:空地-"
+
landStatus
);
Assert
.
assertEquals
(
landStatus
,
"3"
,
"第三块土地状态校验失败"
);
}
@Test
(
description
=
"第五块土地连续登录7天解锁"
)
public
void
b_
第五块土地解锁
()
throws
Exception
{
//dafuweng登陆获取cookies
Map
cookies
=
authorization
.
dafuwengLogin
(
uid
);
//调用getLandList接口
Response
response
=
seedRedPacketService
.
getLandList
(
cookies
,
"1"
,
"424"
);
String
landStatus
=
response
.
jsonPath
().
getString
(
"data.landList[4].landStatus"
);
logger
.
info
(
"第五块土地状态为:未解锁-"
+
landStatus
);
Assert
.
assertEquals
(
landStatus
,
"1"
,
"第五块土地状态校验失败"
);
//修改redis用户连续登陆天数为3天
RedisUtil
.
setKey
(
"AAW_K146_19380_"
+
consumerId
+
"_"
+
getTime
(),
"7"
);
//调用getLandList接口
response
=
seedRedPacketService
.
getLandList
(
cookies
,
"1"
,
"424"
);
landStatus
=
response
.
jsonPath
().
getString
(
"data.landList[4].landStatus"
);
logger
.
info
(
"第五块土地状态为:可解锁-"
+
landStatus
);
Assert
.
assertEquals
(
landStatus
,
"2"
,
"第五块土地状态校验失败"
);
//调用解锁土地接口
response
=
seedRedPacketService
.
unlockLand
(
cookies
,
"1"
,
"424"
,
"5"
);
//调用getLandList接口
response
=
seedRedPacketService
.
getLandList
(
cookies
,
"1"
,
"424"
);
landStatus
=
response
.
jsonPath
().
getString
(
"data.landList[4].landStatus"
);
logger
.
info
(
"第五块土地状态为:空地-"
+
landStatus
);
Assert
.
assertEquals
(
landStatus
,
"3"
,
"第五块土地状态校验失败"
);
}
@Test
(
description
=
"第七块土地连续登录15天解锁"
)
public
void
c_
第七块土地解锁
()
throws
Exception
{
//dafuweng登陆获取cookies
Map
cookies
=
authorization
.
dafuwengLogin
(
uid
);
//调用getLandList接口
Response
response
=
seedRedPacketService
.
getLandList
(
cookies
,
"1"
,
"424"
);
String
landStatus
=
response
.
jsonPath
().
getString
(
"data.landList[6].landStatus"
);
logger
.
info
(
"第七块土地状态为:未解锁-"
+
landStatus
);
Assert
.
assertEquals
(
landStatus
,
"1"
,
"第七块土地状态校验失败"
);
//修改redis用户连续登陆天数为3天
RedisUtil
.
setKey
(
"AAW_K146_19380_"
+
consumerId
+
"_"
+
getTime
(),
"15"
);
//调用getLandList接口
response
=
seedRedPacketService
.
getLandList
(
cookies
,
"1"
,
"424"
);
landStatus
=
response
.
jsonPath
().
getString
(
"data.landList[6].landStatus"
);
logger
.
info
(
"第七块土地状态为:可解锁-"
+
landStatus
);
Assert
.
assertEquals
(
landStatus
,
"2"
,
"第七块土地状态校验失败"
);
//调用解锁土地接口
response
=
seedRedPacketService
.
unlockLand
(
cookies
,
"1"
,
"424"
,
"7"
);
//调用getLandList接口
response
=
seedRedPacketService
.
getLandList
(
cookies
,
"1"
,
"424"
);
landStatus
=
response
.
jsonPath
().
getString
(
"data.landList[6].landStatus"
);
logger
.
info
(
"第七块土地状态为:空地-"
+
landStatus
);
Assert
.
assertEquals
(
landStatus
,
"3"
,
"第七块土地状态校验失败"
);
}
//获取当天日期
public
String
getTime
(){
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"YYYY-MM-dd"
,
Locale
.
ENGLISH
);
Date
date
=
new
Date
();
String
time
=
dateFormat
.
format
(
date
);
return
time
;
}
public
void
解锁土地
(
String
landId
)
throws
Exception
{
Response
response
=
seedRedPacketService
.
updateUserLand
(
"19380"
,
"1"
,
landId
,
consumerId
,
"1"
);
Map
cookies
=
authorization
.
dafuwengLogin
(
uid
);
response
=
seedRedPacketService
.
unlockLand
(
cookies
,
"1"
,
"424"
,
"2"
);
response
=
seedRedPacketService
.
getLandList
(
cookies
,
"1"
,
"424"
);
List
<
Map
>
list
=
response
.
jsonPath
().
getList
(
"data.landList"
,
Map
.
class
);
int
landStatus
=
(
int
)
list
.
get
(
1
).
get
(
"landStatus"
);
Assert
.
assertEquals
(
landStatus
,
3
,
"解锁失败"
);
logger
.
info
(
"解锁土地成功"
);
}
}
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