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
7c97c630
Commit
7c97c630
authored
Mar 20, 2019
by
吕雯燕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lv
parent
ff707124
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
185 additions
and
0 deletions
+185
-0
兑吧新实物_兑换流程测试_ExchangeTest.java
...va/http/cases/ExchangeTest/兑吧新实物_兑换流程测试_ExchangeTest.java
+96
-0
gawService.java
src/test/java/http/service/app/gawService.java
+65
-0
tawService.java
src/test/java/http/service/app/tawService.java
+24
-0
No files found.
src/test/java/http/cases/ExchangeTest/兑吧新实物_兑换流程测试_ExchangeTest.java
0 → 100644
View file @
7c97c630
package
http
.
cases
.
ExchangeTest
;
import
base.DuibaBase
;
import
base.DuibaBases
;
import
http.service.Activity.ManagerService
;
import
http.service.Authorization
;
import
http.service.app.MobileService
;
import
http.service.app.gawService
;
import
http.service.app.tawService
;
import
http.service.hd.DeveloperAccountService
;
import
http.service.hd.DappConfigService
;
import
org.apache.logging.log4j.core.pattern.AbstractStyleNameConverter
;
import
org.testng.annotations.AfterClass
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.DataProvider
;
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.Test
;
import
java.lang.reflect.Method
;
import
java.util.HashMap
;
import
java.util.Map
;
import
utils.RedisUtil
;
import
static
io
.
restassured
.
RestAssured
.
given
;
/**
* Created by lvwenyan on 2019/3/19.
*/
public
class
兑吧新实物
_
兑换流程测试
_ExchangeTest
extends
CheckTemplet
{
@Autowired
gawService
gawService
;
@Autowired
tawService
tawService
;
int
uid
=
6866
;
// @Test(description = "兑吧新实物每人限购每日限制")
public
void
每人限购每日限制测试
()
throws
Exception
{
String
appItemId
=
"192950"
;
String
itemId
=
"32439"
;
// try{
//第一次兑换
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
//获取兑换结果
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
response
.
prettyPrint
();
//
// Response detailResponse = mobileService.detail(authorization.dafuwengLogin(uid),itemId);
// String exchangeText = MatcherString.getString(detailResponse.asString(), "\"exchangeText\":\"(.*?)\",", 1);
// logger.info("商品兑换按钮:" + exchangeText);
//
// //第二次兑换
// Thread.sleep(3000);
// try{
// response = couponExchangeService.objectExchange(authorization.dafuwengLogin(uid), appItemId, itemId, "null", "yrJRr7Cddp2YeQd", "null");
// response.prettyPrint();
//
// }catch (Exception e){
// message = e.toString();
// }
// logger.info(message);
//
// Assert.assertTrue(message.contains("今日已达兑换上限"),"校验message失败");
// Assert.assertTrue(message.contains("\"success\":false"),"校验success失败");
//
// 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 = '"+itemId+"'");
//
// }
}
}
src/test/java/http/service/app/gawService.java
0 → 100644
View file @
7c97c630
package
http
.
service
.
app
;
import
base.DuibaLog
;
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.HashMap
;
import
java.util.Map
;
import
static
io
.
restassured
.
RestAssured
.
given
;
@Service
public
class
gawService
{
@Value
(
"${goods.host}"
)
private
String
goodsHost
;
@Autowired
Authorization
authorization
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//普通实物兑换接口
public
Response
objectExchange
(
int
uid
,
String
appItemId
,
String
itemId
)
throws
Exception
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"remark"
,
""
);
//买家留言
map
.
put
(
"degreeId"
,
""
);
map
.
put
(
"actualPrice"
,
"0"
);
//总金额
map
.
put
(
"actualCredits"
,
"100"
);
//总积分
map
.
put
(
"itemParam"
,
"[{\"itemId\":"
+
itemId
+
",\"skuId\":16,\"appItemId\":"
+
appItemId
+
",\"credits\":\"100\",\"price\":0}]"
);
map
.
put
(
"payType"
,
"3"
);
map
.
put
(
"expressPrice"
,
"0"
);
map
.
put
(
"validate"
,
""
);
map
.
put
(
"token"
,
"yrJRr7Cddp2YeQd"
);
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
logger
.
info
(
"请求实物兑换接口:"
+
"/gaw/objectExchange/create"
);
Response
response
=
given
().
contentType
(
"application/json; charset=UTF-8"
).
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
body
(
jsonParam
).
post
(
"http://"
+
goodsHost
+
"/gaw/objectExchange/create"
);
response
.
prettyPrint
();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"/gaw/objectExchange/create接口返回异常,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"/gaw/objectExchange/create接口返回异常,返回信息:"
+
response
.
asString
());
}
return
response
;
}
}
src/test/java/http/service/app/tawService.java
View file @
7c97c630
...
...
@@ -45,4 +45,28 @@ public class tawService {
}
//订单轮询接口
public
Response
orderStatus
(
String
orderId
,
int
uid
)
throws
Exception
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"orderId"
,
orderId
);
Response
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
params
(
map
).
get
(
"http://"
+
tradeHost
+
"/taw/h5/orderStatus"
);
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
,
"/taw/h5/orderStatus接口失败"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"/taw/h5/orderStatus接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"/taw/h5/orderStatus接口失败,返回信息:"
+
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