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
4de4f50e
Commit
4de4f50e
authored
Nov 19, 2018
by
赵然
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of gitlab2.dui88.com:mabo/test-platform into develop
parents
c73bf836
bb911049
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
713 additions
and
0 deletions
+713
-0
修改兑吧商品.java
src/test/java/http/cases/SaasDeveloperTest/修改兑吧商品.java
+79
-0
补给站.java
src/test/java/http/cases/SaasDeveloperTest/补给站.java
+86
-0
DeveloperBJZ.java
src/test/java/http/service/Saas/DeveloperBJZ.java
+182
-0
DoUpdateAppItemService.java
src/test/java/http/service/Saas/DoUpdateAppItemService.java
+366
-0
No files found.
src/test/java/http/cases/SaasDeveloperTest/修改兑吧商品.java
0 → 100644
View file @
4de4f50e
package
http
.
cases
.
SaasDeveloperTest
;
import
base.Config
;
import
base.DuibaTestBase
;
import
base.DuibaLog
;
import
http.service.Saas.DeveloperCouponService
;
import
http.service.Saas.DeveloperObjectService
;
import
http.service.Saas.DoUpdateAppItemService
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.testng.AbstractTestNGSpringContextTests
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
@ContextConfiguration
(
classes
=
Config
.
class
)
public
class
修改兑吧商品
extends
DuibaTestBase
{
@Autowired
DoUpdateAppItemService
doUpdateAppItemService
;
@Autowired
DeveloperObjectService
developerObjectService
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//修改兑吧实物
@Test
public
void
a_
修改兑吧实物
()
throws
Exception
{
String
appId
=
"19515"
;
String
rowId
=
"1"
;
String
itemTyp
=
""
;
String
status
=
""
;
String
itemName
=
"【SaaS-自动化测试】实物勿动"
;
String
belong
=
""
;
String
priceType
=
""
;
//查询商品,获取商品ID
Response
response
=
doUpdateAppItemService
.
appItems
(
appId
,
rowId
,
itemTyp
,
status
,
itemName
,
belong
,
priceType
);
//获取商品ID
String
appItemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
));
String
title
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].title"
));
String
type
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].type"
));
// logger.info("获取appitermid=="+appItemId+"title=="+title+"type=="+type);
//编辑
Response
response2
=
developerObjectService
.
editAppItem2
(
appItemId
);
//保存
doUpdateAppItemService
.
doUpdateAppItem
(
appId
,
appItemId
,
title
,
"38"
,
type
,
"31654"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.title"
),
"【SaaS-自动化测试】实物勿动"
,
"校验兑吧商品标题失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.credits"
),
"38"
,
"校验兑吧商品失败"
);
logger
.
info
(
"校验title,belong成功"
);
}
//修改兑吧优惠券
@Test
public
void
b_
修改兑吧优惠券
()
throws
Exception
{
String
appId
=
"19515"
;
String
rowId
=
"1"
;
String
itemTyp
=
""
;
String
status
=
""
;
String
itemName
=
"【SaaS-自动化测试】优惠券勿动"
;
String
belong
=
""
;
String
priceType
=
""
;
Response
response
=
doUpdateAppItemService
.
appItems
(
appId
,
rowId
,
itemTyp
,
status
,
itemName
,
belong
,
priceType
);
//获取商品ID
String
appItemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
));
String
title
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].title"
));
String
type
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].type"
));
// logger.info("获取appitermid=="+appItemId+"title=="+title+"type=="+type);
//编辑
doUpdateAppItemService
.
doUpdateAppItem
(
appId
,
appItemId
,
title
,
"10"
,
"coupon"
,
"31658"
);
Response
response2
=
developerObjectService
.
editAppItem2
(
appItemId
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.title"
),
"【SaaS-自动化测试】优惠券勿动"
,
"校验兑吧优惠券商品标题失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.credits"
),
"10"
,
"校验兑吧优惠券商品失败"
);
logger
.
info
(
"校验title,belong成功"
);
}
}
src/test/java/http/cases/SaasDeveloperTest/补给站.java
0 → 100644
View file @
4de4f50e
package
http
.
cases
.
SaasDeveloperTest
;
import
base.Config
;
import
base.DuibaTestBase
;
import
http.service.Saas.DeveloperBJZ
;
import
base.DuibaLog
;
import
http.service.Saas.DeveloperObjectService
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.testng.AbstractTestNGSpringContextTests
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
@ContextConfiguration
(
classes
=
Config
.
class
)
public
class
补给站
extends
DuibaTestBase
{
@Autowired
DeveloperBJZ
developerBJZ
;
@Autowired
DeveloperObjectService
developerObjectService
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
String
appId
=
"19515"
;
//添加、上架至尊版实物
@Test
public
void
a_
添加至尊版实物
()
throws
Exception
{
//查询列表,获取ID
Response
response
=
developerBJZ
.
item
(
"2"
);
String
id
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
));
String
title
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].title"
));
//添加
developerBJZ
.
ajaxAddRepo
(
appId
,
id
);
//上架
developerBJZ
.
ajaxDirectUp
(
appId
,
id
);
//查询商品列表,验证商品是否上架成功
Response
response2
=
developerObjectService
.
appItems
(
appId
,
title
);
String
appItemId
=
String
.
valueOf
(
response2
.
jsonPath
().
getString
(
"data.list[0].id"
));
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].title"
),
"测试至尊享版-实物3"
,
"校验实物标题失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].status"
),
"1"
,
"校验实物状态失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].type"
),
"object"
,
"校验实物类型失败"
);
logger
.
info
(
"校验title,status成功"
);
//删除添加的商品
developerObjectService
.
ajaxDel
(
appItemId
);
}
//添加、上架优惠券
@Test
public
void
b_
添加至尊版优惠券
()
throws
Exception
{
//查询列表,获取ID
Response
response
=
developerBJZ
.
coupons
(
appId
,
"2"
);
String
id
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
));
String
title
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].title"
));
//添加
developerBJZ
.
ajaxAddRepo
(
appId
,
id
);
//上架
developerBJZ
.
ajaxDirectUp
(
appId
,
id
);
//查询商品列表,验证商品是否上架成功
Response
response2
=
developerObjectService
.
appItems
(
appId
,
title
);
String
appItemId
=
String
.
valueOf
(
response2
.
jsonPath
().
getString
(
"data.list[0].id"
));
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].title"
),
"测试至尊享版-优惠券"
,
"校验优惠券标题名称失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].status"
),
"1"
,
"校验优惠券状态失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].type"
),
"coupon"
,
"校验优惠券类型失败"
);
logger
.
info
(
"校验title,status成功"
);
//删除添加的商品
developerObjectService
.
ajaxDel
(
appItemId
);
}
//添加活动
@Test
public
void
c_
添加活动
()
throws
Exception
{
//查询热门活动-活动列表,获取商品ID
Response
response
=
developerBJZ
.
saasActivitys
(
"3"
);
String
goodItemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.saasActivitys[0].id"
));
//获取商品ID,进入商品订购页面,获取SKU
Response
response2
=
developerBJZ
.
itemOrderDetail
(
goodItemId
);
String
skuId
=
String
.
valueOf
(
response2
.
jsonPath
().
getString
(
"data.goodsItemSku[0].skuId"
));
//点击订购,传入SKU创建订单
logger
.
info
(
"kuid==="
+
skuId
);
Response
response3
=
developerBJZ
.
createAutomationOrderNew
(
skuId
);
String
orderid
=
String
.
valueOf
(
response3
.
jsonPath
().
getString
(
"data"
));
logger
.
info
(
"kuid==="
+
orderid
);
//下单购买
Response
response4
=
developerBJZ
.
orderAccountPay
(
orderid
);
}
}
src/test/java/http/service/Saas/DeveloperBJZ.java
0 → 100644
View file @
4de4f50e
package
http
.
service
.
Saas
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
http.service.Authorization
;
import
base.DuibaLog
;
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
DeveloperBJZ
{
@Value
(
"${hdserver.host}"
)
String
hdHost
;
@Autowired
Authorization
authorization
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//优质好货--查询至尊版特权TAB
public
Response
item
(
String
type
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/saasitem/items"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"type"
,
type
);
map
.
put
(
"rowId"
,
"1"
);
map
.
put
(
"itemName"
,
""
);
map
.
put
(
"max"
,
"20"
);
// logger.info("********"+url);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
get
(
url
);
// response.prettyPrint();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口1失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建接口2失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//至尊特权添加商品
public
Response
ajaxAddRepo
(
String
appId
,
String
itemId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/devRepo/ajaxAddRepo"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId
);
map
.
put
(
"itemId"
,
itemId
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
post
(
url
);
// response.prettyPrint();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口1失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建接口2失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//至尊特权上架商品
public
Response
ajaxDirectUp
(
String
appId
,
String
itemIds
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/devRepo/ajaxDirectUp"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId
);
map
.
put
(
"itemIds"
,
itemIds
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
post
(
url
);
response
.
prettyPrint
();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"直接上架成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口1失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建接口2失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//大牌好券--查询至尊版特权TAB
public
Response
coupons
(
String
appId
,
String
type
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/saasitem/coupons"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId
);
map
.
put
(
"type"
,
type
);
map
.
put
(
"rowId"
,
"1"
);
map
.
put
(
"subType"
,
""
);
map
.
put
(
"max"
,
"12"
);
// logger.info("********"+url);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
get
(
url
);
// response.prettyPrint();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口1失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建接口2失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//热门活动--查询活动
public
Response
saasActivitys
(
String
categoryId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/saasitem/saasActivitys"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"attrIds"
,
""
);
map
.
put
(
"rowId"
,
"1"
);
map
.
put
(
"max"
,
"25"
);
map
.
put
(
"categoryId"
,
categoryId
);
logger
.
info
(
"********"
+
url
);
//json 格式转成form表单
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
Response
response
=
given
().
contentType
(
"application/json;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
(
"19515"
)).
body
(
jsonParam
).
post
(
url
);
// response.prettyPrint();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口1失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建接口2失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//选中活动
public
Response
itemOrderDetail
(
String
goodItemId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/saasitem/itemOrderDetail"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"goodItemId"
,
goodItemId
);
// logger.info("********"+url);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
get
(
url
);
// response.prettyPrint();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口1失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建接口2失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//订购活动--创建订单
public
Response
createAutomationOrderNew
(
String
skuId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/saas/createAutomationOrderNew"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"skuId"
,
skuId
);
// logger.info("********"+url);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
(
"19515"
)).
params
(
map
).
post
(
url
);
// response.prettyPrint();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口1失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建接口2失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//订购--账户余额付款
public
Response
orderAccountPay
(
String
orderId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/saas/orderAccountPay"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"orderId"
,
orderId
);
// logger.info("********"+url);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
get
(
url
);
// response.prettyPrint();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口1失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建接口2失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
}
src/test/java/http/service/Saas/DoUpdateAppItemService.java
0 → 100644
View file @
4de4f50e
This diff is collapsed.
Click to expand it.
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