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
45efea03
Commit
45efea03
authored
Dec 06, 2018
by
赵然
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop'
parents
c570bb3f
2485f9e3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
137 additions
and
0 deletions
+137
-0
自有单抽限制_AccessTest.java
.../java/http/cases/SingleLotteryTest/自有单抽限制_AccessTest.java
+127
-0
种红包_AccessTest.java
src/test/java/http/cases/WalletTest/种红包_AccessTest.java
+10
-0
No files found.
src/test/java/http/cases/SingleLotteryTest/自有单抽限制_AccessTest.java
0 → 100644
View file @
45efea03
package
http
.
cases
.
SingleLotteryTest
;
import
base.DuibaLog
;
import
base.DuibaTestBase
;
import
http.service.Activity.SingleLotteryService
;
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.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.*
;
import
static
io
.
restassured
.
RestAssured
.
given
;
/**
* Created by zhaoran on 2018/6/8.
*/
public
class
自有单抽限制
_AccessTest
extends
DuibaTestBase
{
@Autowired
SingleLotteryService
singleLotteryService
;
@Autowired
Authorization
authorization
;
@Value
(
"${activity.host}"
)
String
activityHost
;
@Value
(
"${manager.host}"
)
private
static
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//指定用户
private
static
int
uid
=
4881
;
private
static
int
uid2
=
4882
;
private
static
int
uid3
=
2709
;
private
static
int
uid4
=
2709
;
@BeforeClass
public
void
before
()
{
try
{
RedisUtil
.
clearKey
(
"AC_K001_36686_"
+
getTime
(
0
));
jdbc
.
update
(
"delete from ckvtable.tb_kvtable_0804 where vkey = 'activity-centerjoinNum_100109092_36708'"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
@Test
public
void
每日用户抽奖限制
()
throws
Exception
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"operationAcitvityId"
,
"36686"
);
map
.
put
(
"oaId"
,
"36686"
);
map
.
put
(
"token"
,
"12321"
);
Response
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid2
)).
params
(
map
).
post
(
activityHost
+
"/singleLottery/doJoin"
);
response
.
print
();
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
,
"校验success失败"
);
Thread
.
sleep
(
1000
);
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid2
)).
params
(
map
).
post
(
activityHost
+
"/singleLottery/doJoin"
);
response
.
print
();
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"false"
,
"校验success失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lotteryButtonStatus"
),
"8"
,
"校验状态失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"message"
),
"今日已抽完"
,
"校验信息失败"
);
logger
.
info
(
"校验success、lotteryButtonStatus、message正确"
);
}
@Test
public
void
永久用户抽奖限制
()
throws
Exception
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"operationAcitvityId"
,
"36708"
);
map
.
put
(
"oaId"
,
"36708"
);
map
.
put
(
"token"
,
"12321"
);
Response
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid2
)).
params
(
map
).
post
(
activityHost
+
"/singleLottery/doJoin"
);
response
.
print
();
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
,
"校验success失败"
);
Thread
.
sleep
(
1000
);
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid2
)).
params
(
map
).
post
(
activityHost
+
"/singleLottery/doJoin"
);
response
.
print
();
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"false"
,
"校验success失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lotteryButtonStatus"
),
"2"
,
"校验状态失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"message"
),
"已抽完"
,
"校验信息失败"
);
logger
.
info
(
"校验success、lotteryButtonStatus、message正确"
);
}
@Test
public
void
抽奖日期限制
(){
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"operationAcitvityId"
,
"36689"
);
map
.
put
(
"oaId"
,
"36689"
);
map
.
put
(
"token"
,
"12321"
);
Response
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
params
(
map
).
post
(
activityHost
+
"/singleLottery/doJoin"
);
//response.prettyPeek();
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"false"
,
"校验success失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lotteryButtonStatus"
),
"4"
,
"校验状态失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"message"
),
"已结束"
,
"校验信息失败"
);
logger
.
info
(
"校验success、lotteryButtonStatus、message正确"
);
}
public
String
getTime
(
int
amount
){
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"YYYY-MM-dd"
,
Locale
.
ENGLISH
);
Date
date
=
new
Date
();
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
date
);
calendar
.
add
(
Calendar
.
MONTH
,
amount
);
date
=
calendar
.
getTime
();
// System.out.println(dateFormat.format(date));
String
time
=
dateFormat
.
format
(
date
);
// System.out.println(time);
return
time
;
}
}
\ No newline at end of file
src/test/java/http/cases/WalletTest/种红包_AccessTest.java
View file @
45efea03
package
http
.
cases
.
WalletTest
;
import
base.DuibaTestBase
;
import
org.testng.annotations.BeforeClass
;
import
utils.RedisUtil
;
import
http.service.Activity.SeedRedPacketService
;
import
http.service.Activity.WalletAccountService
;
...
...
@@ -28,6 +29,15 @@ public class 种红包_AccessTest extends DuibaTestBase{
Authorization
authorization
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
@BeforeClass
public
void
beforeclass
()
{
try
{
//前置操作,确保土地是空地状态
seedRedPacketService
.
updateUserLand
(
"19380"
,
"1"
,
"1"
,
"100066444"
,
"3"
);
}
catch
(
Exception
e
)
{
logger
.
info
(
"数据前后置操作异常"
);
}
}
@Test
public
void
种红包
()
throws
Exception
{
...
...
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