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
bb0a2b6e
Commit
bb0a2b6e
authored
Dec 21, 2019
by
panyuli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
核销二期代码
parent
9b09025c
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
115 additions
and
2 deletions
+115
-2
权益一期线上用户核销中匹配兑换码兑换.java
...java/http/cases/equitySubjectTest/权益一期线上用户核销中匹配兑换码兑换.java
+10
-2
权益二期线上用户核销匹配权益及兑换码兑换_DuibaTest.java
...ses/equitySubjectTest/权益二期线上用户核销匹配权益及兑换码兑换_DuibaTest.java
+0
-0
equityPrizeService.java
src/test/java/http/service/Activity/equityPrizeService.java
+105
-0
No files found.
src/test/java/http/cases/equitySubjectTest/权益一期线上用户核销中匹配兑换码兑换.java
View file @
bb0a2b6e
...
...
@@ -44,6 +44,7 @@ public class 权益一期线上用户核销中匹配兑换码兑换 extends Che
Response
response
=
equityPrizeService
.
exchange
(
authorization
.
dafuwengLogin
(
uid
),
exc_code
,
null
);
Thread
.
sleep
(
2000
);
Map
<
String
,
Object
>
ChangeStock
=
jdbc
.
findSimpleResult
(
"SELECT * FROM stock.tb_stock WHERE stock_id =1173112680215170105"
);
String
exchanggeStock
=
String
.
valueOf
(
ChangeStock
.
get
(
"stock"
));
...
...
@@ -66,11 +67,13 @@ public class 权益一期线上用户核销中匹配兑换码兑换 extends Che
throw
new
Exception
(
"异常信息打印:"
+
e
);
}
}
finally
{
jdbc
.
update
(
"update goods.tb_equity_goods_record set consumer_id=null ,partner_user_id=null"
+
" ,app_item_id=null ,verification_time=null ,order_num=null where exc_code = '"
+
exc_code
+
"'"
);
}
}
@Test
// +(invocationCount=5)
public
void
兑换的权益码不存在
()
throws
Exception
{
...
...
@@ -266,6 +269,7 @@ public class 权益一期线上用户核销中匹配兑换码兑换 extends Che
//第一次核销
logger
.
info
(
"用户第一次核销"
);
Response
response
=
equityPrizeService
.
exchange
(
authorization
.
dafuwengLogin
(
uid
),
exc_code
,
null
);
Thread
.
sleep
(
2000
);
Map
<
String
,
Object
>
ChangeStock
=
jdbc
.
findSimpleResult
(
"SELECT * FROM stock.tb_stock WHERE stock_id =1178701910023420109"
);
//第一次兑换之后的商品的库存成功
String
exchanggeStock
=
String
.
valueOf
(
ChangeStock
.
get
(
"stock"
));
...
...
@@ -284,7 +288,9 @@ public class 权益一期线上用户核销中匹配兑换码兑换 extends Che
logger
.
info
(
"进行第二次核销"
);
response
=
equityPrizeService
.
exchange
(
authorization
.
dafuwengLogin
(
uid
),
exc_code1
,
null
);
Thread
.
sleep
(
2000
);
ChangeStock
=
jdbc
.
findSimpleResult
(
"SELECT * FROM stock.tb_stock WHERE stock_id =1178701910023420109"
);
exchanggeStock
=
String
.
valueOf
(
ChangeStock
.
get
(
"stock"
));
//response.prettyPrint();
//获取到 code 数据
...
...
@@ -315,7 +321,7 @@ public class 权益一期线上用户核销中匹配兑换码兑换 extends Che
throw
new
Exception
(
"异常信息打印:"
+
e
);
}
}
finally
{
jdbc
.
update
(
"update goods.tb_equity_goods_record set consumer_id=null ,partner_user_id=null"
+
" ,app_item_id=null ,verification_time=null ,order_num=null where exc_code = '"
+
exc_code
+
"'"
);
jdbc
.
update
(
"update goods.tb_equity_goods_record set consumer_id=null ,partner_user_id=null"
+
...
...
@@ -323,5 +329,7 @@ public class 权益一期线上用户核销中匹配兑换码兑换 extends Che
jdbc
.
update
(
"DELETE FROM goods.tb_everyday_limit where app_item_id ='199280 '"
);
}
}
}
src/test/java/http/cases/equitySubjectTest/权益二期线上用户核销匹配权益及兑换码兑换_DuibaTest.java
0 → 100644
View file @
bb0a2b6e
This diff is collapsed.
Click to expand it.
src/test/java/http/service/Activity/equityPrizeService.java
View file @
bb0a2b6e
...
...
@@ -7,10 +7,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Map
;
import
static
base
.
Postman
.
logger
;
import
static
io
.
restassured
.
RestAssured
.
given
;
@Service
...
...
@@ -22,6 +25,7 @@ public class equityPrizeService {
/**
* 核销一期 /aaw/equityPrize/exchange
* 匹配兑换码兑换 一期-线上核销
* Request Method: POST
*
* @param excCode 兑换码
...
...
@@ -46,6 +50,107 @@ public class equityPrizeService {
return
response
;
}
/**
* 核销二期匹配 权益及兑换码兑换-线上核销
* 权益商品列表
* /chw//chw/visual-editor/equityGoodsList
* Request Method: GET
*
* @param equityId 权益id
* @return
* @throws Exception
*/
public
Response
chwequityGoodsList
(
Map
cookies
,
String
equityId
)
throws
Exception
{
Response
response
=
given
().
cookies
(
cookies
).
get
(
activityHost
+
"/chw/visual-editor/equityGoodsList?equityId="
+
equityId
);
try
{
// Assert.assertEquals(response.jsonPath().getString("success"), "true", "/aaw/equityPrize/exchange接口失败");
Assert
.
assertEquals
(
String
.
valueOf
(
response
.
getStatusCode
()),
"200"
,
"/chw//chw/visual-editor/equityGoodsList接口失败"
);
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"/chw/visual-editor/equityGoodsList接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
)
{
throw
new
Exception
(
"/chw/visual-editor/equityGoodsList接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
@Test
/*
*q权益二期匹配 权益及兑换码兑换-线上核销
* 商品兑换首页
* /gaw/equityPrize/index
* * Request Method: post
* equityId 权益id , appitemid 商品id , appSkuid
* */
public
Response
gawequityPrizeindex
(
Map
cookies
,
String
equityId
,
String
appItemId
,
String
appSkuId
)
throws
Exception
{
logger
.
info
(
activityHost
+
"/gaw/equityPrize/index?equityId="
+
equityId
+
"&appItemId="
+
appItemId
+
"&appSkuId="
+
appSkuId
);
Response
response
=
given
().
cookies
(
cookies
).
get
(
activityHost
+
"/gaw/equityPrize/index?equityId="
+
equityId
+
"&appItemId="
+
appItemId
+
"&appSkuId="
+
appSkuId
);
try
{
Assert
.
assertEquals
(
String
.
valueOf
(
response
.
getStatusCode
()),
"200"
,
"/gaw/equityPrize/index接口失败"
);
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"/gaw/equityPrize/index接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
)
{
throw
new
Exception
(
"/gaw/equityPrize/index接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
/*
* 权益核销【匹配 权益及兑换码兑换-线上核销】
* 权益兑换接口sku /gaw/equityPrize/exchange
*
* */
public
Response
gawequityPrizeexchange
(
Map
cookies
,
String
excCode
,
String
appItemId
,
String
equityId
,
String
appSkuId
)
throws
Exception
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"excCode"
,
excCode
);
map
.
put
(
"appItemId"
,
appItemId
);
map
.
put
(
"equityId"
,
equityId
);
map
.
put
(
"appSkuId"
,
appSkuId
);
map
.
put
(
"validate"
,
"undefined"
);
//token 代码中写死的测试token
map
.
put
(
"token"
,
"yrJRr7Cddp2YeQd"
);
Response
response
=
given
().
cookies
(
cookies
).
params
(
map
).
post
(
activityHost
+
"/gaw/equityPrize/exchange"
);
try
{
Assert
.
assertEquals
(
String
.
valueOf
(
response
.
getStatusCode
()),
"200"
,
"/gaw/equityPrize/exchange接口失败"
);
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"/gaw/equityPrize/exchange接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
)
{
throw
new
Exception
(
"/gaw/equityPrize/exchange接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
/*
* 权益核销【匹配 权益及兑换码兑换-线上核销】
* 权益列表 /chw/visual-editor/findEquityListByIds
*
* */
public
Response
chwvisualeditorfindEquityListByIds
(
Map
cookies
,
ArrayList
array
)
throws
Exception
{
Map
<
String
,
ArrayList
>
map
=
new
HashMap
<>();
map
.
put
(
"equityIds"
,
array
);
// Response response = given().contentType("application/json;charset=UTF-8").cookies(cookies).params(map).get("http://" + url);
Response
response
=
given
().
contentType
(
"application/json;charset=UTF-8"
).
cookies
(
cookies
).
params
(
map
).
post
(
activityHost
+
"/chw/visual-editor/findEquityListByIds"
);
try
{
Assert
.
assertEquals
(
String
.
valueOf
(
response
.
getStatusCode
()),
"200"
,
" /chw/visual-editor/findEquityListByIds接口失败"
);
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"/gaw/equityPrize/exchange接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
)
{
throw
new
Exception
(
"/gaw/equityPrize/exchange接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
}
\ No newline at end of file
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