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
871f2ba4
Commit
871f2ba4
authored
Dec 25, 2018
by
wangxiaoshuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wxs
parent
66b83e56
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
228 additions
and
2 deletions
+228
-2
自有卡券库.java
src/test/java/http/cases/GoodsAndTradeTest/自有卡券库.java
+6
-0
DevCards.java
src/test/java/http/service/goods/DevCards.java
+0
-2
DevCardsKaquanDetails.java
src/test/java/http/service/goods/DevCardsKaquanDetails.java
+138
-0
DuibaCards.java
src/test/java/http/service/goods/DuibaCards.java
+84
-0
No files found.
src/test/java/http/cases/GoodsAndTradeTest/自有卡券库.java
View file @
871f2ba4
package
http
.
cases
.
GoodsAndTradeTest
;
import
base.Config
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.testng.AbstractTestNGSpringContextTests
;
import
org.testng.annotations.Test
;
...
...
@@ -10,6 +11,11 @@ import java.util.Date;
@ContextConfiguration
(
classes
=
Config
.
class
)
public
class
自有卡券库
extends
AbstractTestNGSpringContextTests
{
@Value
(
"${hdserver.host}"
)
String
hdHost
;
@Test
public
void
t333
(){
Date
date
=
new
Date
();
...
...
src/test/java/http/service/goods/DevCards.java
View file @
871f2ba4
...
...
@@ -63,7 +63,6 @@ public class DevCards {
}
return
response
;
}
//导入批次
//删除
public
Response
delete
(
String
appId
,
String
id
)
throws
Exception
{
...
...
@@ -82,5 +81,4 @@ public class DevCards {
return
response
;
}
}
src/test/java/http/service/goods/DevCardsKaquanDetails.java
0 → 100644
View file @
871f2ba4
package
http
.
service
.
goods
;
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
DevCardsKaquanDetails
{
@Value
(
"${hdserver.host}"
)
String
hdHost
;
@Autowired
Authorization
authorization
;
//查询指定卡券库批次列表信息
public
Response
getBatchList
(
String
id
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/cardLibrary/getBatchList"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"id"
,
id
);
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
getDetail
(
String
appId
,
String
id
,
String
batchId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/cardLibrary/getDetail"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId
);
map
.
put
(
"id"
,
id
);
//卡券库ID
map
.
put
(
"pageNo"
,
"1"
);
map
.
put
(
"pageSize"
,
"15"
);
map
.
put
(
"status"
,
""
);
map
.
put
(
"batchId"
,
batchId
);
//批次ID
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
deleteCouponBatch
(
String
appId
,
String
batchId
,
String
cardLibraryId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/cardLibrary/deleteCouponBatch"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId
);
map
.
put
(
"batchId"
,
batchId
);
//批次ID
map
.
put
(
"cardLibraryId"
,
cardLibraryId
);
//卡券库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
;
}
//删除卡券
public
Response
deleteCoupon
(
String
appId
,
String
id
,
String
batchId
,
String
cardLibraryId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/cardLibrary/deleteCoupon"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId
);
map
.
put
(
"id"
,
id
);
//卡券ID
map
.
put
(
"pageNo"
,
"1"
);
map
.
put
(
"pageSize"
,
"15"
);
map
.
put
(
"status"
,
""
);
map
.
put
(
"batchId"
,
batchId
);
//批次ID
map
.
put
(
"cardLibraryId"
,
cardLibraryId
);
//卡券库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
;
}
//导入券码
public
Response
importCoupon
(
String
appId
,
String
id
,
String
batchId
,
String
cardLibraryId
,
String
type
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/cardLibrary/importCoupon"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId
);
map
.
put
(
"id"
,
id
);
map
.
put
(
"status"
,
""
);
map
.
put
(
"batchId"
,
batchId
);
//批次ID
map
.
put
(
"cardLibraryId"
,
cardLibraryId
);
//卡券库ID
map
.
put
(
"type"
,
type
);
map
.
put
(
"fileUrl"
,
"http://yun.dui88.com/coupons/1545731089854.txt"
);
map
.
put
(
"startDay"
,
"2019-12-26"
);
map
.
put
(
"endDay"
,
"2044-12-26"
);
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
getImportStatus
(
String
appId
,
String
importId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/cardLibrary/getImportStatus"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId
);
map
.
put
(
"importId"
,
importId
);
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
;
}
}
src/test/java/http/service/goods/DuibaCards.java
0 → 100644
View file @
871f2ba4
package
http
.
service
.
goods
;
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
DuibaCards
{
@Value
(
"${manager.host}"
)
String
ManagerHost
;
//ManagerHost = mng.duibatest.com.cn
@Autowired
Authorization
authorization
;
//添加券码
public
Response
cardsSave
(
String
appId
,
String
type
,
String
name
)
throws
Exception
{
String
url
=
"http://"
+
ManagerHost
+
"/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
.
ssoLogin
()).
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
,
String
type
,
String
excludeRelated
)
throws
Exception
{
String
url
=
"http://"
+
ManagerHost
+
"/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"
,
type
);
//类型:0:券码 1:链接 2:重复 3:卡密
map
.
put
(
"excludeRelated"
,
excludeRelated
);
//true:排查已关联的 false:不排除
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
;
}
//导入批次
//删除
public
Response
delete
(
String
appId
,
String
id
)
throws
Exception
{
String
url
=
"http://"
+
ManagerHost
+
"/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
.
ssoLogin
()).
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