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
cf15013e
Commit
cf15013e
authored
Mar 18, 2019
by
吕雯燕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lv fix
parent
9d321d67
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
124 additions
and
8 deletions
+124
-8
多档位话费_兑换流程测试_ExchangeTest.java
...va/http/cases/ExchangeTest/多档位话费_兑换流程测试_ExchangeTest.java
+84
-0
话费_兑换限制测试_ExchangeTest.java
.../java/http/cases/ExchangeTest/话费_兑换限制测试_ExchangeTest.java
+36
-5
插件场景测试_pluginTest.java
...java/http/cases/PluginActivityTest/插件场景测试_pluginTest.java
+3
-3
CouponExchangeService.java
src/test/java/http/service/app/CouponExchangeService.java
+1
-0
No files found.
src/test/java/http/cases/ExchangeTest/多档位话费_兑换流程测试_ExchangeTest.java
0 → 100644
View file @
cf15013e
package
http
.
cases
.
ExchangeTest
;
import
http.service.Authorization
;
import
http.service.app.CouponExchangeService
;
import
http.service.app.CrecordService
;
import
http.service.app.MobileService
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeMethod
;
import
org.testng.annotations.DataProvider
;
import
org.testng.annotations.Test
;
import
utils.MatcherString
;
import
java.lang.reflect.Method
;
import
java.sql.SQLException
;
import
java.util.HashMap
;
import
java.util.Map
;
import
static
io
.
restassured
.
RestAssured
.
given
;
/**
* Created by lvwenyan on 2019/3/14
*/
public
class
多档位话费
_
兑换流程测试
_ExchangeTest
extends
CheckTemplet
{
@Autowired
private
MobileService
mobileService
;
@Autowired
private
Authorization
authorization
;
@Autowired
private
CouponExchangeService
couponExchangeService
;
@Autowired
private
CrecordService
crecordService
;
private
static
int
uid
=
6537
;
@Test
(
description
=
"多档位话费10元用户每天兑换限制"
)
public
void
多档位话费用户每日兑换限制测试
()
throws
Exception
{
String
message
=
""
;
try
{
//话费第一次兑换
Response
response
=
couponExchangeService
.
phonebillExchange
(
authorization
.
dafuwengLogin
(
uid
),
"10"
);
response
.
prettyPrint
();
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
,
"校验兑换失败"
);
logger
.
info
(
"用户成功兑换一次"
);
//再次兑换
try
{
response
=
couponExchangeService
.
phonebillExchange
(
authorization
.
dafuwengLogin
(
uid
),
"10"
);
response
.
prettyPrint
();
}
catch
(
Exception
e
){
message
=
e
.
toString
();
}
logger
.
info
(
message
);
//获取按钮状态
Response
detailResponse
=
mobileService
.
detail
(
authorization
.
dafuwengLogin
(
uid
),
"1"
);
String
exchangeText
=
MatcherString
.
getString
(
detailResponse
.
asString
(),
"\"btnText\":\"(.\"btnText\\\":\\\"(.*?)\\\"*?)\","
,
1
);
logger
.
info
(
"兑换按钮:"
+
exchangeText
);
Assert
.
assertTrue
(
message
.
contains
(
"已兑完"
),
"校验message失败"
);
Assert
.
assertEquals
(
exchangeText
,
"今日已兑换"
,
"校验马上兑换按钮状态失败"
);
logger
.
info
(
"校验多档位话费用户每日兑换限制成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"异常信息打印:"
+
e
);
}
finally
{
jdbc
.
update
(
"DELETE FROM credits_dev.consumer_limit_record WHERE item_id = '1'"
);
}
}
}
src/test/java/http/cases/ExchangeTest/话费_兑换限制测试_ExchangeTest.java
View file @
cf15013e
...
...
@@ -63,7 +63,7 @@ public class 话费_兑换限制测试_ExchangeTest extends CheckTemplet{
}
@Test
(
description
=
"
每个
用户每日兑换限制"
)
@Test
(
description
=
"
5元话费
用户每日兑换限制"
)
public
void
phonebill_
每日
()
throws
Exception
{
Thread
.
sleep
(
2000
);
Map
<
String
,
Object
>
mapuser
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id="
+
uid
);
...
...
@@ -104,7 +104,7 @@ public class 话费_兑换限制测试_ExchangeTest extends CheckTemplet{
}
@Test
(
description
=
"永久兑换限制"
)
@Test
(
description
=
"
10元话费用户
永久兑换限制"
)
public
void
phonebill_
永久
()
throws
Exception
{
Thread
.
sleep
(
2000
);
Map
<
String
,
Object
>
mapuser
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id="
+
uid
);
...
...
@@ -144,7 +144,7 @@ public class 话费_兑换限制测试_ExchangeTest extends CheckTemplet{
}
}
@Test
@Test
(
description
=
"20元话费每日兑换上限"
)
public
void
每日兑换上限测试
()
throws
Exception
{
String
appItemId
=
"191793"
;
...
...
@@ -224,13 +224,13 @@ public class 话费_兑换限制测试_ExchangeTest extends CheckTemplet{
case
1
:
Assert
.
assertTrue
(
message
.
contains
(
"请在限定时间内兑换哦(13)"
),
"校验message失败"
);
Assert
.
assertEquals
(
exchangeText
,
"即将开始"
,
"校验马上兑换按钮状态失败"
);
logger
.
info
(
"校验话费兑换日期限制未开始成功"
);
logger
.
info
(
"校验
2元
话费兑换日期限制未开始成功"
);
break
;
case
2
:
Assert
.
assertTrue
(
message
.
contains
(
"已结束"
),
"校验message失败"
);
Assert
.
assertEquals
(
exchangeText
,
"已结束"
,
"校验马上兑换按钮状态失败"
);
logger
.
info
(
"校验话费兑换日期限制已结束成功"
);
logger
.
info
(
"校验
50元
话费兑换日期限制已结束成功"
);
break
;
}
...
...
@@ -242,6 +242,37 @@ public class 话费_兑换限制测试_ExchangeTest extends CheckTemplet{
@Test
(
description
=
"1元话费会员等级"
)
public
void
会员等级测试
()
throws
Exception
{
String
appItemId
=
"191794"
;
String
itemId
=
"1660"
;
String
degreeId
=
"1"
;
String
message
=
""
;
//会员等级无法兑换
try
{
Response
response
=
couponExchangeService
.
phonebillExchange
(
authorization
.
dafuwengLogin
(
uid
),
appItemId
,
itemId
,
degreeId
);
response
.
prettyPrint
();
}
catch
(
Exception
e
){
message
=
e
.
toString
();
}
logger
.
info
(
message
);
//会员等级可兑换,vip=5
Response
response
=
couponExchangeService
.
phonebillExchange
(
authorization
.
generateSignAutoLogin
(
"SoMhngEcDDfJcqPF6Siz3gVQCfz"
,
6574
),
appItemId
,
itemId
,
degreeId
);
response
.
prettyPrint
();
Assert
.
assertTrue
(
message
.
contains
(
"会员等级不符,请挑选其他吧(15)"
),
"校验message失败"
);
Assert
.
assertTrue
(
message
.
contains
(
"\"success\":false"
),
"校验success失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
,
"校验兑换结果失败"
);
logger
.
info
(
"校验1元话费会员等级成功"
);
}
...
...
src/test/java/http/cases/PluginActivityTest/插件场景测试_pluginTest.java
View file @
cf15013e
...
...
@@ -36,7 +36,7 @@ public class 插件场景测试_pluginTest extends DuibaTestBase {
private
static
DuibaLog
logger
=
DuibaLog
.
getLogger
();
// private MysqlUtils jdbc;
//指定用户
private
static
int
uid
=
2721
;
private
static
int
uid
=
6618
;
@BeforeClass
public
void
before
(){
...
...
@@ -104,7 +104,7 @@ public class 插件场景测试_pluginTest extends DuibaTestBase {
//先定向再开启
Map
<
String
,
Object
>
mapId
=
jdbc
.
findSimpleResult
(
"SELECT * FROM credits_activity.tb_activity_plugin ORDER BY gmt_create DESC LIMIT 1"
);
String
id
=
String
.
valueOf
(
mapId
.
get
(
"id"
));
logger
.
info
(
id
);
logger
.
info
(
"插件活动ID:"
+
id
);
pluginService
.
addSpecify
(
id
);
pluginService
.
changeStatus
(
id
,
"1"
);
...
...
@@ -157,7 +157,7 @@ public class 插件场景测试_pluginTest extends DuibaTestBase {
//先定向再开启
Map
<
String
,
Object
>
mapId
=
jdbc
.
findSimpleResult
(
"SELECT * FROM credits_activity.tb_activity_plugin ORDER BY gmt_create DESC LIMIT 1"
);
String
id
=
String
.
valueOf
(
mapId
.
get
(
"id"
));
logger
.
info
(
id
);
logger
.
info
(
"插件活动id:"
+
id
);
pluginService
.
addSpecify
(
id
);
pluginService
.
changeStatus
(
id
,
"1"
);
...
...
src/test/java/http/service/app/CouponExchangeService.java
View file @
cf15013e
...
...
@@ -154,6 +154,7 @@ public class CouponExchangeService {
map
.
put
(
"phone"
,
"18012341234"
);
map
.
put
(
"phoneCatName"
,
"中国电信"
);
map
.
put
(
"phoneProvince"
,
"江苏"
);
map
.
put
(
"itemId"
,
"1"
);
logger
.
info
(
"请求/phonebillExchange/exchange接口"
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
cookies
).
params
(
map
).
post
(
"http://"
+
goodsHost
+
"/phonebillExchange/exchange"
);
//phonebillExchange
// response.prettyPrint();
...
...
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