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
5d7a149d
Commit
5d7a149d
authored
Dec 04, 2019
by
吕雯燕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lv
parent
c8eddab0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
151 additions
and
0 deletions
+151
-0
集卡活动助力_AccessTest.java
src/test/java/http/cases/ClcardTest/集卡活动助力_AccessTest.java
+88
-0
集卡活动领奖_AccessTest.java
src/test/java/http/cases/ClcardTest/集卡活动领奖_AccessTest.java
+3
-0
ClcardService.java
src/test/java/http/service/Activity/ClcardService.java
+60
-0
No files found.
src/test/java/http/cases/ClcardTest/集卡活动助力_AccessTest.java
0 → 100644
View file @
5d7a149d
package
http
.
cases
.
ClcardTest
;
import
base.DuibaTestBase
;
import
http.service.Activity.ClcardService
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.testng.Assert
;
import
org.testng.annotations.AfterMethod
;
import
org.testng.annotations.BeforeMethod
;
import
org.testng.annotations.Test
;
import
java.sql.SQLException
;
import
java.util.Map
;
import
base.DuibaTestBase
;
/**
* Created by lvwenyan on 2019/11/28
*/
public
class
集卡活动助力
_AccessTest
extends
DuibaTestBase
{
@Autowired
ClcardService
clcardService
;
@BeforeMethod
public
void
before
(){
try
{
//删除助力表数据
jdbc
.
update
(
"DELETE FROM act_com_conf.tb_share_code_record WHERE share_code = '11nmxcq'"
);
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
}
@Test
(
description
=
"集卡活动助力测试"
)
public
void
集卡活动助力成功
()
throws
Exception
{
int
uid1
=
7407
;
int
uid2
=
7402
;
String
activityId
=
"45502"
;
String
shareCode
=
"11nmxcq"
;
//首页集卡信息
Response
indexResponse
=
clcardService
.
activity
(
uid1
,
activityId
);
int
count
=
Integer
.
parseInt
(
indexResponse
.
jsonPath
().
getString
(
"data.cards[1].count"
));
logger
.
info
(
"当前助力用户卡数量:"
+
count
);
Response
indexResponse2
=
clcardService
.
activity
(
uid2
,
activityId
);
int
count2
=
Integer
.
parseInt
(
indexResponse2
.
jsonPath
().
getString
(
"data.cards[0].count"
));
logger
.
info
(
"当前被助力用户卡数量:"
+
count2
);
//助力用户 7407
//开始助力
Response
helpResponse
=
clcardService
.
doHelpNew
(
uid1
,
activityId
,
shareCode
);
helpResponse
.
prettyPrint
();
Thread
.
sleep
(
100
);
//首页集卡信息
indexResponse
=
clcardService
.
activity
(
uid1
,
activityId
);
int
resultCount
=
Integer
.
parseInt
(
indexResponse
.
jsonPath
().
getString
(
"data.cards[1].count"
));
logger
.
info
(
"助力后用户卡数量:"
+
resultCount
);
Assert
.
assertEquals
(
helpResponse
.
jsonPath
().
getString
(
"data.inviter"
),
"100164132"
,
"校验inviter失败"
);
Assert
.
assertEquals
(
helpResponse
.
jsonPath
().
getString
(
"data.invitee"
),
"100166015"
,
"校验invitee失败"
);
Assert
.
assertEquals
(
resultCount
,
count
+
1
,
"校验助力得卡失败"
);
logger
.
info
(
"校验集卡助力者获得助力奖励成功"
);
//被助力用户7402
//获得助力结果
Response
resultResponse
=
clcardService
.
helpResult
(
uid2
,
activityId
);
resultResponse
.
prettyPrint
();
//首页集卡信息
indexResponse2
=
clcardService
.
activity
(
uid2
,
activityId
);
int
resultCount2
=
Integer
.
parseInt
(
indexResponse2
.
jsonPath
().
getString
(
"data.cards[0].count"
));
logger
.
info
(
"被助力后用户卡数量:"
+
resultCount2
);
Assert
.
assertEquals
(
resultResponse
.
jsonPath
().
getString
(
"data.cardCount"
),
"1"
,
"校验cardCount失败"
);
Assert
.
assertEquals
(
resultCount2
,
count2
+
1
,
"校验被助力得卡失败"
);
logger
.
info
(
"校验集卡被助力者获得被助力奖励成功"
);
}
}
src/test/java/http/cases/ClcardTest/集卡活动领奖_AccessTest.java
View file @
5d7a149d
...
@@ -12,6 +12,9 @@ import org.testng.annotations.Test;
...
@@ -12,6 +12,9 @@ import org.testng.annotations.Test;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.util.Map
;
import
java.util.Map
;
/**
* Created by lvwenyan on 2019/11/28
*/
public
class
集卡活动领奖
_AccessTest
extends
DuibaTestBase
{
public
class
集卡活动领奖
_AccessTest
extends
DuibaTestBase
{
...
...
src/test/java/http/service/Activity/ClcardService.java
View file @
5d7a149d
...
@@ -79,4 +79,64 @@ public class ClcardService {
...
@@ -79,4 +79,64 @@ public class ClcardService {
return
response
;
return
response
;
}
}
/**
* @param activityId 活动id
* @param uid 用户id
* @param shareCode 邀请码
* @return
* @throws Exception
*/
public
Response
doHelpNew
(
int
uid
,
String
activityId
,
String
shareCode
)
throws
Exception
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"activityId"
,
activityId
);
map
.
put
(
"activityType"
,
"hdtool"
);
map
.
put
(
"shareCode"
,
shareCode
);
map
.
put
(
"singleLimitType"
,
"0"
);
map
.
put
(
"subType"
,
"clcard"
);
logger
.
info
(
"请求/activtyShareCode/doHelpNew接口"
);
Response
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
params
(
map
).
post
(
activityHost
+
"/activtyShareCode/doHelpNew"
);
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
,
"/activtyShareCode/doHelpNew接口失败"
);
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"/activtyShareCode/doHelpNew接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
)
{
throw
new
Exception
(
"/activtyShareCode/doHelpNew接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
/**
* @param activityId 活动id
* @param uid 用户id
* @return
* @throws Exception
*/
public
Response
helpResult
(
int
uid
,
String
activityId
)
throws
Exception
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"activityId"
,
activityId
);
logger
.
info
(
"请求/hdtool/clcard/helpResult接口"
);
Response
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
params
(
map
).
get
(
activityHost
+
"/hdtool/clcard/helpResult"
);
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
,
"/hdtool/clcard/helpResult接口失败"
);
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"/hdtool/clcard/helpResult接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
)
{
throw
new
Exception
(
"/hdtool/clcard/helpResult接口失败,返回信息:"
+
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