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
14f2fdab
Commit
14f2fdab
authored
Dec 12, 2018
by
wangxiaoshuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wxs
parent
f466cb4c
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
404 additions
and
28 deletions
+404
-28
自有卡券库.java
src/test/java/http/cases/GoodsAndTradeTest/自有卡券库.java
+20
-0
DevCards.java
src/test/java/http/service/goods/DevCards.java
+85
-0
DevDoUpdateCoupon.java
src/test/java/http/service/goods/DevDoUpdateCoupon.java
+227
-0
DevDoUpdateObject.java
src/test/java/http/service/goods/DevDoUpdateObject.java
+0
-28
DoUpdateCredits.java
src/test/java/http/service/goods/DoUpdateCredits.java
+72
-0
No files found.
src/test/java/http/cases/GoodsAndTradeTest/自有卡券库.java
0 → 100644
View file @
14f2fdab
package
http
.
cases
.
GoodsAndTradeTest
;
import
base.Config
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.testng.AbstractTestNGSpringContextTests
;
import
org.testng.annotations.Test
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
@ContextConfiguration
(
classes
=
Config
.
class
)
public
class
自有卡券库
extends
AbstractTestNGSpringContextTests
{
@Test
public
void
t333
(){
Date
date
=
new
Date
();
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM--dd"
);
simpleDateFormat
.
format
(
date
);
System
.
out
.
println
(
"---------"
+
simpleDateFormat
.
format
(
date
));
}
}
src/test/java/http/service/goods/DevCards.java
0 → 100644
View file @
14f2fdab
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
DevCards
{
@Value
(
"${hdserver.host}"
)
String
hdHost
;
@Autowired
Authorization
authorization
;
//添加券码
public
Response
cardsSave
(
String
appId
,
String
type
,
String
name
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/cardLibrary/save"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId
);
//应用ID
map
.
put
(
"type"
,
type
);
//类型
map
.
put
(
"name"
,
name
);
//名称
map
.
put
(
"fileUrl"
,
"http%3A%2F%2Fyun.dui88.com%2Fcoupons%2F1544497069778.txt"
);
//文件地址
map
.
put
(
"startDay"
,
""
);
//有效期--开始时间
map
.
put
(
"endDay"
,
""
);
//有效期--结束时间
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
post
(
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
;
}
//查询
public
Response
list
(
String
appId
,
String
name
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/cardLibrary/list"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"name"
,
name
);
//名称
map
.
put
(
"pageNo"
,
"1"
);
map
.
put
(
"pageSize"
,
"15"
);
map
.
put
(
"appId"
,
appId
);
map
.
put
(
"type"
,
""
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
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
;
}
//导入批次
//删除
public
Response
delete
(
String
appId
,
String
id
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/cardLibrary/delete"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId
);
map
.
put
(
"id"
,
id
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
post
(
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
;
}
}
src/test/java/http/service/goods/DevDoUpdateCoupon.java
0 → 100644
View file @
14f2fdab
This diff is collapsed.
Click to expand it.
src/test/java/http/service/goods/DevDoUpdateObject.java
View file @
14f2fdab
...
...
@@ -84,33 +84,5 @@ public class DevDoUpdateObject {
}
return
response
;
}
//保存积分配置
public
Response
doUpdateCredits
(
String
appId
,
String
appItemId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/devItemNew/doUpdateCredits"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId
);
//appid
map
.
put
(
"appItemId"
,
appItemId
);
//商品ID
map
.
put
(
"buttonText"
,
""
);
map
.
put
(
"creditsInfos"
,
"[{skuId: \"0\"}]"
);
//自定义
map
.
put
(
"dateRage"
,
"[\"2018-11-29\", \"2019-05-31\"]"
);
map
.
put
(
"exchangeType"
,
"1"
);
//兑换类型,1:自动 2:自定义
map
.
put
(
"indexHidden"
,
"true"
);
//是否在首页商品区隐藏,true:隐藏 false:显示
map
.
put
(
"limitDate"
,
"2018-11-29,2019-05-31"
);
//兑换日期限制
map
.
put
(
"limitEverydayQuantity"
,
"6"
);
//每日限量
map
.
put
(
"multiSku"
,
"false"
);
map
.
put
(
"onSale"
,
"false"
);
//是否上架 true:立即上架 false:放入仓库
map
.
put
(
"originalPriceBuy"
,
"true"
);
//是否支持原价购买 ,true:支持 false:不支持
//json 格式转成form表单
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
body
(
jsonParam
).
post
(
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
;
}
}
src/test/java/http/service/goods/DoUpdateCredits.java
0 → 100644
View file @
14f2fdab
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
DoUpdateCredits
{
@Value
(
"${hdserver.host}"
)
String
hdHost
;
@Autowired
Authorization
authorization
;
//获取商品ID
public
Response
getCreditsDetail
(
String
appId
,
String
appItemId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"devItemNew/getCreditsDetail"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId
);
//appid
map
.
put
(
"appItemId"
,
appItemId
);
//商品ID
//json 格式转成form表单
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
body
(
jsonParam
).
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
;
}
//保存积分配置
public
Response
doUpdateCredits
(
String
appId
,
String
appItemId
,
String
creditsInfos
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/devItemNew/doUpdateCredits"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId
);
//appid
map
.
put
(
"appItemId"
,
appItemId
);
//商品ID
map
.
put
(
"buttonText"
,
""
);
map
.
put
(
"creditsInfos"
,
creditsInfos
);
//自定义
map
.
put
(
"dateRage"
,
"[\"2018-11-29\", \"2019-05-31\"]"
);
map
.
put
(
"exchangeType"
,
"1"
);
//兑换类型,1:自动 2:自定义
map
.
put
(
"indexHidden"
,
"true"
);
//是否在首页商品区隐藏,true:隐藏 false:显示
map
.
put
(
"limitDate"
,
"2018-11-29,2019-05-31"
);
//兑换日期限制
map
.
put
(
"limitEverydayQuantity"
,
"6"
);
//每日限量
map
.
put
(
"multiSku"
,
"false"
);
map
.
put
(
"onSale"
,
"false"
);
//是否上架 true:立即上架 false:放入仓库
map
.
put
(
"originalPriceBuy"
,
"true"
);
//是否支持原价购买 ,true:支持 false:不支持
//json 格式转成form表单
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
body
(
jsonParam
).
post
(
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