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
497bbc74
Commit
497bbc74
authored
Dec 22, 2018
by
wangxiaoshuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wxs
parent
7b169114
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
373 additions
and
0 deletions
+373
-0
供应商优惠券.java
src/test/java/http/cases/GoodsAndTradeTest/供应商优惠券.java
+91
-0
DuibaDoUpdateCoupon.java
src/test/java/http/service/goods/DuibaDoUpdateCoupon.java
+234
-0
DuibaList.java
src/test/java/http/service/goods/DuibaList.java
+48
-0
No files found.
src/test/java/http/cases/GoodsAndTradeTest/供应商优惠券.java
0 → 100644
View file @
497bbc74
package
http
.
cases
.
GoodsAndTradeTest
;
import
base.Config
;
import
base.DuibaLog
;
import
base.DuibaTestBase
;
import
http.service.goods.DuibaDoUpdateCoupon
;
import
http.service.goods.DuibaList
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.testng.Assert
;
import
utils.PublicMethod
;
@ContextConfiguration
(
classes
=
Config
.
class
)
public
class
供应商优惠券
extends
DuibaTestBase
{
@Autowired
DuibaDoUpdateCoupon
duibaDoUpdateCoupon
;
@Autowired
DuibaList
duibaList
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
private
static
String
data
;
private
static
String
itemId
;
//新增链接券
public
void
供应商链接券
()
throws
Exception
{
data
=
PublicMethod
.
data
();
String
name
=
"[自动化]供应商链接券"
+
data
;
//添加优惠券接口
duibaDoUpdateCoupon
.
doUpdateCouponLianjie
(
name
);
//查询列表,验证是否添加成功
Response
response
=
duibaList
.
listIndex
(
"admin"
,
name
);
//获取商品ID
itemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.page.rows[0].itemDto.id"
));
//校验数据
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.page.rows[0].itemDto.name"
),
"【自动化】供应商链接券"
+
data
,
"校验优惠券name失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.page.rows[0].itemDto.type"
),
"coupon"
,
"校验优惠券类型失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.page.rows[0].itemDto.remaining"
),
"100"
,
"校验优惠券库存失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.page.rows[0].itemDto.version"
),
"1"
,
"校验优惠券版本(新版本展示1,旧版本0失败)"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.page.rows[0].itemDto.actualPrice"
),
"10000"
,
"校验优惠券供货价失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.page.rows[0].itemDto.facePrice"
),
"11000"
,
"校验优惠券版本建议零售价失败"
);
logger
.
info
(
"校验title,belong成功"
);
}
//新增重复券
public
void
供应商重复券
()
throws
Exception
{
data
=
PublicMethod
.
data
();
String
name
=
"[自动化]供应商重复券"
+
data
;
//添加优惠券接口
duibaDoUpdateCoupon
.
doUpdateCouponChongfu
(
name
);
//查询列表,验证是否添加成功
Response
response
=
duibaList
.
listIndex
(
"admin"
,
name
);
//获取商品ID
itemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.page.rows[0].itemDto.id"
));
//校验数据
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.page.rows[0].itemDto.name"
),
"【自动化】供应商重复券"
+
data
,
"校验优惠券name失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.page.rows[0].itemDto.type"
),
"coupon"
,
"校验优惠券类型失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.page.rows[0].itemDto.remaining"
),
"200"
,
"校验优惠券库存失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.page.rows[0].itemDto.version"
),
"1"
,
"校验优惠券版本(新版本展示1,旧版本0失败)"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.page.rows[0].itemDto.actualPrice"
),
"8800"
,
"校验优惠券供货价失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.page.rows[0].itemDto.facePrice"
),
"18800"
,
"校验优惠券版本建议零售价失败"
);
logger
.
info
(
"校验title,belong成功"
);
}
//新增重复券
public
void
供应商普通券
()
throws
Exception
{
data
=
PublicMethod
.
data
();
String
name
=
"[自动化]供应商普通券"
+
data
;
//添加优惠券接口
duibaDoUpdateCoupon
.
doUpdateCouponChongfu
(
name
);
//查询列表,验证是否添加成功
Response
response
=
duibaList
.
listIndex
(
"admin"
,
name
);
//获取商品ID
itemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.page.rows[0].itemDto.id"
));
//校验数据
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.page.rows[0].itemDto.name"
),
"【自动化】供应商普通券"
+
data
,
"校验优惠券name失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.page.rows[0].itemDto.type"
),
"coupon"
,
"校验优惠券类型失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.page.rows[0].itemDto.remaining"
),
"9"
,
"校验优惠券库存失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.page.rows[0].itemDto.version"
),
"1"
,
"校验优惠券版本(新版本展示1,旧版本0失败)"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.page.rows[0].itemDto.actualPrice"
),
"3600"
,
"校验优惠券供货价失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.page.rows[0].itemDto.facePrice"
),
"7200"
,
"校验优惠券版本建议零售价失败"
);
logger
.
info
(
"校验title,belong成功"
);
}
//删除链接券
public
void
删除链接券
()
throws
Exception
{
duibaDoUpdateCoupon
.
deleteItem
(
itemId
);
}
}
src/test/java/http/service/goods/DuibaDoUpdateCoupon.java
0 → 100644
View file @
497bbc74
This diff is collapsed.
Click to expand it.
src/test/java/http/service/goods/DuibaList.java
0 → 100644
View file @
497bbc74
package
http
.
service
.
goods
;
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
DuibaList
{
@Value
(
"${manager.host}"
)
String
ManagerHost
;
//ManagerHost = mng.duibatest.com.cn
@Autowired
Authorization
authorization
;
//查询列表
public
Response
listIndex
(
String
nameType
,
String
name
)
throws
Exception
{
String
url
=
"http://"
+
ManagerHost
+
"/newmanager/goods/item/index"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"status"
,
""
);
map
.
put
(
"itemType"
,
""
);
map
.
put
(
"operType"
,
""
);
map
.
put
(
"nameType"
,
nameType
);
//??
map
.
put
(
"pageSize"
,
"20"
);
map
.
put
(
"pageNo"
,
"1"
);
map
.
put
(
"itemClassifyIdObject"
,
""
);
map
.
put
(
"itemClassifyIdCoupon"
,
""
);
map
.
put
(
"itemName"
,
name
);
//商品名称
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
ssoLogin
()).
get
(
url
);
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建失败,返回信息:"
+
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