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
63e15316
Commit
63e15316
authored
Nov 02, 2018
by
赵然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zr
parent
7903729d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
150 additions
and
5 deletions
+150
-5
CustomActivity_DuibaTest.java
...p/cases/DefinedActivityTest/CustomActivity_DuibaTest.java
+1
-1
活动增加抽奖次数_DuibaTest.java
...va/http/cases/DefinedActivityTest/活动增加抽奖次数_DuibaTest.java
+136
-0
定向测试_DuibaTest.java
src/test/java/http/cases/NewActivityTest/定向测试_DuibaTest.java
+13
-4
No files found.
src/test/java/http/cases/DefinedActivityTest/CustomActivity_DuibaTest.java
View file @
63e15316
...
...
@@ -160,7 +160,7 @@ public class CustomActivity_DuibaTest extends DuibaTestBase {
}
@Test
//
@Test
public
void
自定义活动增加抽奖次数
()
throws
Exception
{
this
.
创建并上架活动
();
...
...
src/test/java/http/cases/DefinedActivityTest/活动增加抽奖次数_DuibaTest.java
0 → 100644
View file @
63e15316
package
http
.
cases
.
DefinedActivityTest
;
import
base.DuibaLog
;
import
base.DuibaTestBase
;
import
http.service.Activity.ManagerService
;
import
http.service.Activity.NewActivityService
;
import
http.service.Authorization
;
import
http.service.hd.ActivityService
;
import
http.service.hd.DeveloperService
;
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.DataProvider
;
import
org.testng.annotations.Test
;
import
utils.MatcherString
;
import
java.lang.reflect.Method
;
import
java.util.Map
;
/**
* Created by lvwenyan on 2018/1/5.
*/
public
class
活动增加抽奖次数
_DuibaTest
extends
DuibaTestBase
{
@Autowired
NewActivityService
newActivityService
;
@Autowired
ManagerService
managerService
;
@Autowired
Authorization
authorization
;
@Autowired
ActivityService
activityService
;
@Autowired
DeveloperService
developerService
;
private
static
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//兑吧活动id
private
static
String
hdtoolId
;
//活动入库id
private
static
String
actId
;
@AfterClass
public
void
after
()
throws
Exception
{
//数据库删除
try
{
jdbc
.
update
(
"delete from hdtool_conf.duiba_hdtool where title=?"
,
"自动化测试自定义活动"
);
jdbc
.
update
(
"delete from credits_dev.operating_activity where title=?"
,
"自动化测试自定义活动"
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
e
);
}
}
@Test
public
void
自定义活动增加抽奖次数
()
throws
Exception
{
this
.
创建并上架活动
();
//获取开发者后台活动列表,获取活动id
//Response listResponse = activityService.list2("2239", "1");
//String hdtoolId = listResponse.jsonPath().getString("data.list[0].activityId");
//String actId = listResponse.jsonPath().getString("data.list[0].id");
Map
<
String
,
Object
>
selectResult
=
jdbc
.
findSimpleResult
(
"select * from credits_dev.operating_activity where activity_id = "
+
hdtoolId
);
actId
=
String
.
valueOf
(
selectResult
.
get
(
"id"
));
logger
.
info
(
"兑吧活动ID:"
+
hdtoolId
);
logger
.
info
(
"活动入库ID:"
+
actId
);
//活动创建后,页面免费次数
Response
Response
=
newActivityService
.
ajaxElement
(
"duiba"
,
hdtoolId
,
actId
,
"false"
);
logger
.
info
(
"活动创建后,初始页面免费次数:"
+
Response
.
jsonPath
().
getString
(
"element.freeLimit"
));
//增加活动免费抽奖次数
Response
addResponse
=
newActivityService
.
addtimes
(
"1"
,
actId
,
"hdtool"
);
addResponse
.
prettyPrint
();
//增加次数后验证活动页面免费次数
Response
ajaxResponse
=
newActivityService
.
ajaxElement
(
"duiba"
,
hdtoolId
,
actId
,
"false"
);
logger
.
info
(
"增加次数后活动页面免费次数为:"
+
ajaxResponse
.
jsonPath
().
getString
(
"element.freeLimit"
));
Assert
.
assertEquals
(
ajaxResponse
.
jsonPath
().
getString
(
"element.freeLimit"
),
"1"
,
"免费次数增加失败"
);
//增加次数后进行抽奖
Response
dojoinResponse
=
this
.
自定义活动工具抽奖
(
actId
,
"lmxayt9a"
);
Response
endResponse
=
newActivityService
.
ajaxElement
(
"duiba"
,
hdtoolId
,
actId
,
"false"
);
int
i
=
20
;
while
(
i
>
0
&&
(!
endResponse
.
jsonPath
().
getString
(
"element.freeLimit"
).
equals
(
"0"
)))
{
Thread
.
sleep
(
1000
);
dojoinResponse
=
this
.
自定义活动工具抽奖
(
actId
,
"lmxayt9a"
);
endResponse
=
newActivityService
.
ajaxElement
(
"duiba"
,
hdtoolId
,
actId
,
"false"
);
i
--;
}
logger
.
info
(
"抽奖后活动页面免费次数为:"
+
endResponse
.
jsonPath
().
getString
(
"element.freeLimit"
));
Assert
.
assertEquals
(
endResponse
.
jsonPath
().
getString
(
"element.freeLimit"
),
"0"
,
"免费次数使用不正确"
);
logger
.
info
(
"校验活动使用免费次数成功"
);
}
public
Response
自定义活动工具抽奖
(
String
activityId
,
String
token
)
throws
Exception
{
Response
response
=
newActivityService
.
doJoin2
(
activityId
,
token
);
response
.
prettyPrint
();
String
orderId
=
response
.
jsonPath
().
getString
(
"orderId"
);
response
=
newActivityService
.
getOrderStatus2
(
orderId
);
response
.
prettyPrint
();
String
result
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"result"
));
int
i
=
8
;
while
(
i
>
0
&&
(
result
.
equals
(
"0"
)))
{
Thread
.
sleep
(
1000
);
response
=
newActivityService
.
getOrderStatus2
(
orderId
);
result
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"result"
));
i
--;
response
.
prettyPrint
();
}
return
response
;
}
public
void
创建并上架活动
()
throws
Exception
{
//管理后台创建活动并开启
Response
ManagerResponse
=
managerService
.
save_customHdtool
();
hdtoolId
=
ManagerResponse
.
jsonPath
().
getString
(
"data.actId"
);
//活动状态开启
managerService
.
switchSpecifyAndBlack
(
"1"
,
hdtoolId
);
//定向开发者
managerService
.
saveSpecify
(
hdtoolId
,
"2239"
);
//开发者上架活动
Response
HdResponse
=
developerService
.
joinIn
(
hdtoolId
,
"12"
);
logger
.
info
(
"创建活动并上架成功"
);
}
}
\ No newline at end of file
src/test/java/http/cases/NewActivityTest/定向测试_DuibaTest.java
View file @
63e15316
...
...
@@ -58,9 +58,19 @@ public class 定向测试_DuibaTest extends DuibaTestBase {
Assert
.
assertEquals
(
direct
,
"true"
,
"校验创建活动自动打开定向功能失败"
);
Response
hdResponse
=
developerService
.
list
(
"2239"
);
String
title
=
hdResponse
.
jsonPath
().
getString
(
"data[0].title"
);
// Assert.assertNotEquals(title, "【推荐位测试数据】", "校验开发者集市定向活动失败,应不展示未定向到2239活动");
Assert
.
assertEquals
(
title
.
equals
(
"【定向测试数据】"
+
data
),
false
,
"校验开发者集市定向活动失败,应不展示未定向到2239活动!"
);
//String title = hdResponse.jsonPath().getString("data[0].title");
for
(
int
z
=
0
;
z
<
6
;
z
++){
String
title2
=
hdResponse
.
jsonPath
().
getString
(
"data["
+
z
+
"].title"
);
logger
.
info
(
"第"
+
z
+
"个活动名称为"
+
title2
);
if
(
title2
.
equals
(
"【定向测试数据】"
+
data
)){
throw
new
Exception
(
"校验开发者集市定向活动失败,应展示定向到2239的活动"
);
}
if
(
z
==
5
){
logger
.
info
(
"校验开发者集市定向活动成功,应不展示未定向到2239活动!"
);
break
;
}
}
//Assert.assertEquals(title.equals("【定向测试数据】"+data), false,"校验开发者集市定向活动失败,应不展示未定向到2239活动!");
}
// @Test(description = "打开定向功能未指定开发者",priority = 2)
...
...
@@ -86,7 +96,6 @@ public class 定向测试_DuibaTest extends DuibaTestBase {
String
title2
=
hdResponse
.
jsonPath
().
getString
(
"data["
+
z
+
"].title"
);
logger
.
info
(
"第"
+
z
+
"个活动名称为"
+
title2
);
if
(
title2
.
equals
(
"【定向测试数据】"
+
data
)){
// Assert.assertEquals(title2, "【定向测试数据】"+data, "校验开发者集市定向活动失败,应展示定向到2239的活动");
break
;
}
if
(
z
==
5
){
...
...
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