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
f2f23b45
Commit
f2f23b45
authored
Dec 21, 2019
by
panyuli
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'pyl'
parents
47be2a10
f12851d3
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
126 additions
and
12 deletions
+126
-12
权益一期线上用户核销中匹配兑换码兑换_DuibaTest.java
...cases/equitySubjectTest/权益一期线上用户核销中匹配兑换码兑换_DuibaTest.java
+18
-10
权益二期线上用户核销匹配权益及兑换码兑换_DuibaTest.java
...ses/equitySubjectTest/权益二期线上用户核销匹配权益及兑换码兑换_DuibaTest.java
+0
-0
equityPrizeService.java
src/test/java/http/service/Activity/equityPrizeService.java
+108
-2
No files found.
src/test/java/http/cases/equitySubjectTest/权益一期线上用户核销中匹配兑换码兑换_DuibaTest.java
View file @
f2f23b45
...
@@ -44,6 +44,7 @@ public class 权益一期线上用户核销中匹配兑换码兑换_DuibaTest ex
...
@@ -44,6 +44,7 @@ public class 权益一期线上用户核销中匹配兑换码兑换_DuibaTest ex
Response
response
=
equityPrizeService
.
exchange
(
authorization
.
dafuwengLogin
(
uid
),
exc_code
,
null
);
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"
);
Map
<
String
,
Object
>
ChangeStock
=
jdbc
.
findSimpleResult
(
"SELECT * FROM stock.tb_stock WHERE stock_id =1173112680215170105"
);
String
exchanggeStock
=
String
.
valueOf
(
ChangeStock
.
get
(
"stock"
));
String
exchanggeStock
=
String
.
valueOf
(
ChangeStock
.
get
(
"stock"
));
...
@@ -66,9 +67,11 @@ public class 权益一期线上用户核销中匹配兑换码兑换_DuibaTest ex
...
@@ -66,9 +67,11 @@ public class 权益一期线上用户核销中匹配兑换码兑换_DuibaTest ex
throw
new
Exception
(
"异常信息打印:"
+
e
);
throw
new
Exception
(
"异常信息打印:"
+
e
);
}
}
finally
{
jdbc
.
update
(
"update goods.tb_equity_goods_record set consumer_id=null ,partner_user_id=null"
+
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
+
"'"
);
" ,app_item_id=null ,verification_time=null ,order_num=null where exc_code = '"
+
exc_code
+
"'"
);
}
}
}
@Test
@Test
...
@@ -266,6 +269,7 @@ public class 权益一期线上用户核销中匹配兑换码兑换_DuibaTest ex
...
@@ -266,6 +269,7 @@ public class 权益一期线上用户核销中匹配兑换码兑换_DuibaTest ex
//第一次核销
//第一次核销
logger
.
info
(
"用户第一次核销"
);
logger
.
info
(
"用户第一次核销"
);
Response
response
=
equityPrizeService
.
exchange
(
authorization
.
dafuwengLogin
(
uid
),
exc_code
,
null
);
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"
);
Map
<
String
,
Object
>
ChangeStock
=
jdbc
.
findSimpleResult
(
"SELECT * FROM stock.tb_stock WHERE stock_id =1178701910023420109"
);
//第一次兑换之后的商品的库存成功
//第一次兑换之后的商品的库存成功
String
exchanggeStock
=
String
.
valueOf
(
ChangeStock
.
get
(
"stock"
));
String
exchanggeStock
=
String
.
valueOf
(
ChangeStock
.
get
(
"stock"
));
...
@@ -284,8 +288,10 @@ public class 权益一期线上用户核销中匹配兑换码兑换_DuibaTest ex
...
@@ -284,8 +288,10 @@ public class 权益一期线上用户核销中匹配兑换码兑换_DuibaTest ex
logger
.
info
(
"进行第二次核销"
);
logger
.
info
(
"进行第二次核销"
);
response
=
equityPrizeService
.
exchange
(
authorization
.
dafuwengLogin
(
uid
),
exc_code1
,
null
);
response
=
equityPrizeService
.
exchange
(
authorization
.
dafuwengLogin
(
uid
),
exc_code1
,
null
);
ChangeStock
=
jdbc
.
findSimpleResult
(
"SELECT * FROM stock.tb_stock WHERE stock_id =1178701910023420109"
);
Thread
.
sleep
(
2000
);
exchanggeStock
=
String
.
valueOf
(
ChangeStock
.
get
(
"stock"
));
ChangeStock
=
jdbc
.
findSimpleResult
(
"SELECT * FROM stock.tb_stock WHERE stock_id =1178701910023420109"
);
exchanggeStock
=
String
.
valueOf
(
ChangeStock
.
get
(
"stock"
));
//response.prettyPrint();
//response.prettyPrint();
//获取到 code 数据
//获取到 code 数据
code
=
response
.
jsonPath
().
getString
(
"code"
);
code
=
response
.
jsonPath
().
getString
(
"code"
);
...
@@ -315,12 +321,14 @@ public class 权益一期线上用户核销中匹配兑换码兑换_DuibaTest ex
...
@@ -315,12 +321,14 @@ public class 权益一期线上用户核销中匹配兑换码兑换_DuibaTest ex
throw
new
Exception
(
"异常信息打印:"
+
e
);
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"
+
" ,app_item_id=null ,verification_time=null ,order_num=null where exc_code = '"
+
exc_code1
+
"'"
);
jdbc
.
update
(
"DELETE FROM goods.tb_everyday_limit where app_item_id ='199280 '"
);
}
}
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"
+
" ,app_item_id=null ,verification_time=null ,order_num=null where exc_code = '"
+
exc_code1
+
"'"
);
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 @
f2f23b45
This diff is collapsed.
Click to expand it.
src/test/java/http/service/Activity/equityPrizeService.java
View file @
f2f23b45
package
http
.
service
.
Activity
;
package
http
.
service
.
Activity
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
http.service.Authorization
;
import
http.service.Authorization
;
import
io.restassured.http.Cookies
;
import
io.restassured.http.Cookies
;
import
io.restassured.response.Response
;
import
io.restassured.response.Response
;
...
@@ -7,10 +9,11 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -7,10 +9,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.testng.Assert
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
import
java.util.HashMap
;
import
java.util.*
;
import
java.util.Map
;
import
static
base
.
Postman
.
logger
;
import
static
io
.
restassured
.
RestAssured
.
given
;
import
static
io
.
restassured
.
RestAssured
.
given
;
@Service
@Service
...
@@ -22,6 +25,7 @@ public class equityPrizeService {
...
@@ -22,6 +25,7 @@ public class equityPrizeService {
/**
/**
* 核销一期 /aaw/equityPrize/exchange
* 核销一期 /aaw/equityPrize/exchange
* 匹配兑换码兑换 一期-线上核销
* Request Method: POST
* Request Method: POST
*
*
* @param excCode 兑换码
* @param excCode 兑换码
...
@@ -46,6 +50,108 @@ public class equityPrizeService {
...
@@ -46,6 +50,108 @@ public class equityPrizeService {
return
response
;
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
,
List
<
Integer
>
array
)
throws
Exception
{
// JSONObject json = new JSONObject();
// json.put("equityIds", array);
Map
<
String
,
List
<
Integer
>>
map
=
new
HashMap
<>();
map
.
put
(
"equityIds"
,
array
);
Response
response
=
given
().
contentType
(
"application/json;charset=UTF-8"
).
cookies
(
cookies
).
body
(
map
).
post
(
activityHost
+
"/chw/visual-editor/findEquityListByIds"
);
//Response response = given().contentType("application/json;charset=UTF-8").body("{\"equityIds\":[25,24]}").cookies(cookies).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