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
4010541c
Commit
4010541c
authored
Apr 04, 2019
by
吕雯燕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lv
parent
29127928
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
268 additions
and
0 deletions
+268
-0
兑吧活动工具_新商品_DuibaTest.java
...java/http/cases/NewActivityTest/兑吧活动工具_新商品_DuibaTest.java
+70
-0
自有活动工具_新商品_DuibaTest.java
...java/http/cases/NewActivityTest/自有活动工具_新商品_DuibaTest.java
+121
-0
AdminNewDuibaHdtoolService.java
...java/http/service/Manager/AdminNewDuibaHdtoolService.java
+56
-0
LaunchService.java
src/test/java/http/service/hd/LaunchService.java
+21
-0
No files found.
src/test/java/http/cases/NewActivityTest/兑吧活动工具_新商品_DuibaTest.java
0 → 100644
View file @
4010541c
package
http
.
cases
.
NewActivityTest
;
import
base.DuibaTestBase
;
import
http.service.Manager.AdminNewDuibaHdtoolService
;
import
http.service.Activity.NewActivityService
;
import
org.apache.bcel.generic.NEW
;
import
utils.MatcherString
;
import
base.DuibaLog
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.testng.Assert
;
import
org.testng.annotations.DataProvider
;
import
org.testng.annotations.Test
;
/**
* Created by lvwenyan on 2019/4/4.
*/
public
class
兑吧活动工具
_
新商品
_DuibaTest
extends
DuibaTestBase
{
@Autowired
AdminNewDuibaHdtoolService
adminNewDuibaHdtoolService
;
@Autowired
NewActivityService
newActivityService
;
@Test
(
description
=
"兑吧活动工具添加新实物"
)
public
void
添加新实物奖品
()
throws
Exception
{
String
type
=
"object"
;
String
name
=
"兑吧新实物活动专用"
;
Response
response
=
adminNewDuibaHdtoolService
.
ajaxFindItemByName
(
type
,
name
);
response
.
prettyPrint
();
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"list[0].appItemId"
),
"32604"
,
"校验appItmId失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"list[0].title"
),
"兑吧新实物活动专用"
,
"校验title失败"
);
logger
.
info
(
"校验兑吧活动工具添加新实物奖品成功"
);
}
@Test
(
description
=
"兑吧活动工具中奖新实物"
)
public
void
中奖新实物奖品
()
throws
Exception
{
String
activityId
=
"43752"
;
String
token
=
"ulxn1sd"
;
int
uid
=
7126
;
Response
response
=
newActivityService
.
doJoin2
(
uid
,
activityId
,
token
);
response
.
prettyPrint
();
String
orderId
=
response
.
jsonPath
().
getString
(
"orderId"
);
response
=
newActivityService
.
getOrderStatus2
(
uid
,
orderId
);
response
.
prettyPrint
();
String
result
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"result"
));
int
i
=
30
;
while
(
i
>
0
&&(
result
.
equals
(
"0"
))){
Thread
.
sleep
(
1000
);
response
=
newActivityService
.
getOrderStatus2
(
uid
,
orderId
);
result
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"result"
));
i
--;
response
.
prettyPrint
();
}
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lottery.id"
),
"28244"
,
"校验奖品id失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lottery.title"
),
"兑吧新实物"
,
"校验奖品title失败"
);
logger
.
info
(
"校验兑吧活动工具中奖新实物成功"
);
}
}
src/test/java/http/cases/NewActivityTest/自有活动工具_新商品_DuibaTest.java
0 → 100644
View file @
4010541c
package
http
.
cases
.
NewActivityTest
;
import
base.DuibaTestBase
;
import
http.service.Authorization
;
import
http.service.hd.LaunchService
;
import
http.service.Activity.NewActivityService
;
import
org.apache.bcel.generic.NEW
;
import
utils.MatcherString
;
import
base.DuibaLog
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.testng.Assert
;
import
org.testng.annotations.DataProvider
;
import
org.testng.annotations.Test
;
import
java.util.Map
;
/**
* Created by lvwenyan on 2019/4/4.
*/
public
class
自有活动工具
_
新商品
_DuibaTest
extends
DuibaTestBase
{
@Autowired
LaunchService
launchService
;
@Autowired
Authorization
authorization
;
@Autowired
NewActivityService
newActivityService
;
int
uid
=
7126
;
@Test
(
description
=
"自有活动工具添加新实物奖品"
)
public
void
添加新实物奖品
()
throws
Exception
{
Map
cookies
=
authorization
.
hdLoginCommonNew
(
"15855555555"
);
String
type
=
"object"
;
String
name
=
"自有实物活动专用"
;
String
appId
=
"22561"
;
Response
response
=
launchService
.
findItemBySearch
(
cookies
,
type
,
name
,
appId
);
response
.
prettyPrint
();
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].appItemId"
),
"195020"
,
"校验appItemId失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].title"
),
"【自动化勿动】自有实物活动专用"
,
"校验title失败"
);
logger
.
info
(
"校验自有活动工具添加新实物成功"
);
}
@Test
(
description
=
"自有活动工具中奖新实物"
)
public
void
中奖新实物
()
throws
Exception
{
String
activityId
=
"43753"
;
String
token
=
"ulxn1sd"
;
Response
response
=
newActivityService
.
doJoin2
(
uid
,
activityId
,
token
);
response
.
prettyPrint
();
String
orderId
=
response
.
jsonPath
().
getString
(
"orderId"
);
response
=
newActivityService
.
getOrderStatus2
(
uid
,
orderId
);
response
.
prettyPrint
();
String
result
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"result"
));
int
i
=
30
;
while
(
i
>
0
&&(
result
.
equals
(
"0"
))){
Thread
.
sleep
(
1000
);
response
=
newActivityService
.
getOrderStatus2
(
uid
,
orderId
);
result
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"result"
));
i
--;
response
.
prettyPrint
();
}
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lottery.id"
),
"31650"
,
"校验奖品id失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lottery.title"
),
"新实物"
,
"校验奖品title失败"
);
logger
.
info
(
"校验自有活动工具中奖新实物成功"
);
}
@Test
(
description
=
"添加下架的实物奖品"
)
public
void
添加下架的实物奖品
()
throws
Exception
{
Map
cookies
=
authorization
.
hdLoginCommonNew
(
"15855555555"
);
String
type
=
"object"
;
String
name
=
"自有实物下架活动专用"
;
String
appId
=
"22561"
;
String
activityId
=
"43754"
;
String
token
=
"h5wn0epv"
;
//添加奖品
Response
findResponse
=
launchService
.
findItemBySearch
(
cookies
,
type
,
name
,
appId
);
findResponse
.
prettyPrint
();
Assert
.
assertEquals
(
findResponse
.
jsonPath
().
getString
(
"data.list[0].appItemId"
),
"195024"
,
"校验appItemId失败"
);
Assert
.
assertEquals
(
findResponse
.
jsonPath
().
getString
(
"data.list[0].title"
),
"【自动化勿动】自有实物下架活动专用"
,
"校验title失败"
);
logger
.
info
(
"校验自有活动工具添加下架实物成功"
);
//抽奖
Response
response
=
newActivityService
.
doJoin2
(
uid
,
activityId
,
token
);
// response.prettyPrint();
String
orderId
=
response
.
jsonPath
().
getString
(
"orderId"
);
response
=
newActivityService
.
getOrderStatus2
(
uid
,
orderId
);
response
.
prettyPrint
();
String
result
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"result"
));
int
i
=
30
;
while
(
i
>
0
&&(
result
.
equals
(
"0"
))){
Thread
.
sleep
(
1000
);
response
=
newActivityService
.
getOrderStatus2
(
uid
,
orderId
);
result
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"result"
));
i
--;
response
.
prettyPrint
();
}
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lottery.id"
),
"31654"
,
"校验奖品id失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lottery.title"
),
"下架实物"
,
"校验奖品title失败"
);
logger
.
info
(
"校验自有活动工具中奖下架实物成功"
);
}
}
src/test/java/http/service/Manager/AdminNewDuibaHdtoolService.java
0 → 100644
View file @
4010541c
package
http
.
service
.
Manager
;
import
base.DuibaLog
;
import
cn.com.duiba.activity.center.api.dto.activity.CLRewardDto
;
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.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
static
io
.
restassured
.
RestAssured
.
given
;
/**
* Created by lvwenyan on 2019/4/4.
*/
@Service
public
class
AdminNewDuibaHdtoolService
{
@Value
(
"${manager.host}"
)
String
ManagerHost
;
@Autowired
Authorization
authorization
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//单品抽奖添加奖品
public
Response
ajaxFindItemByName
(
String
type
,
String
name
)
throws
Exception
{
String
url
=
ManagerHost
+
"/AdminNewDuibaHdtool/ajaxFindItemByName"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"type"
,
type
);
map
.
put
(
"name"
,
name
);
Response
response
=
given
().
contentType
(
"application/json;charset=UTF-8"
).
cookies
(
authorization
.
ssoLogin
()).
params
(
map
).
get
(
"http://"
+
url
);
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
,
"/AdminNewDuibaHdtool/ajaxFindItemByName接口失败"
);
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"/AdminNewDuibaHdtool/ajaxFindItemByName接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
)
{
throw
new
Exception
(
"/AdminNewDuibaHdtool/ajaxFindItemByName接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
}
src/test/java/http/service/hd/LaunchService.java
View file @
4010541c
...
...
@@ -68,4 +68,25 @@ public class LaunchService {
return
response
;
}
//选择奖品
public
Response
findItemBySearch
(
Map
cookies
,
String
type
,
String
name
,
String
appId
)
throws
Exception
{
String
url
=
hdHost
+
"/launch/findItemBySearch"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"type"
,
type
);
map
.
put
(
"name"
,
name
);
map
.
put
(
"appId"
,
appId
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
cookies
).
params
(
map
).
post
(
"http://"
+
url
);
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"请求/launch/findItemBySearch接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"请求/launch/findItemBySearch接口失败,返回信息:"
+
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