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
22d3525f
Commit
22d3525f
authored
Apr 04, 2019
by
吕雯燕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lv
parent
4010541c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
336 additions
and
0 deletions
+336
-0
新商品_编辑_DuibaTest.java
...t/java/http/cases/SaasDeveloperTest/新商品_编辑_DuibaTest.java
+123
-0
活动管理_DuibaTest.java
...est/java/http/cases/SaasDeveloperTest/活动管理_DuibaTest.java
+52
-0
DevItemNewService.java
src/test/java/http/service/hd/DevItemNewService.java
+106
-0
VisualEditorService.java
src/test/java/http/service/hd/VisualEditorService.java
+55
-0
No files found.
src/test/java/http/cases/SaasDeveloperTest/新商品_编辑_DuibaTest.java
0 → 100644
View file @
22d3525f
package
http
.
cases
.
SaasDeveloperTest
;
import
base.Config
;
import
base.DuibaLog
;
import
base.DuibaTestBase
;
import
http.cases.ExchangeTest.Database
;
import
http.service.hd.DevItemNewService
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
import
utils.PublicMethod
;
import
java.util.Map
;
import
http.service.Authorization
;
/**
* created by lvwenyan 2019/4/4
*/
public
class
新商品
_
编辑
_DuibaTest
extends
DuibaTestBase
{
@Autowired
DevItemNewService
devItemNewService
;
@Autowired
Authorization
authorization
;
@Test
(
description
=
"保存实物商品修改状态"
)
public
void
保存实物修改状态
()
throws
Exception
{
Map
cookies
=
authorization
.
hdLoginCommonNew
(
"15855555555"
);
String
appId
=
"22561"
;
String
appItemId
=
"195026"
;
String
skuId
=
"101"
;
try
{
Map
<
String
,
Object
>
mapAppItem
=
jdbc
.
findSimpleResult
(
"SELECT * FROM goods.app_item WHERE id = "
+
appItemId
);
String
status
=
String
.
valueOf
(
mapAppItem
.
get
(
"status"
));
logger
.
info
(
"商品当前状态:"
+
status
);
Assert
.
assertEquals
(
status
,
"on"
,
"校验商品上架状态失败"
);
//修改实物状态--仓库中,onsale=false
Response
response
=
devItemNewService
.
doUpdateCredits
(
cookies
,
appId
,
appItemId
,
skuId
,
"false"
);
response
.
prettyPrint
();
mapAppItem
=
jdbc
.
findSimpleResult
(
"SELECT * FROM goods.app_item WHERE id = "
+
appItemId
);
status
=
String
.
valueOf
(
mapAppItem
.
get
(
"status"
));
logger
.
info
(
"商品修改后状态:"
+
status
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
,
"校验商品保存失败"
);
Assert
.
assertEquals
(
status
,
"off"
,
"校验商品下架状态失败"
);
logger
.
info
(
"校验实物保存修改状态成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"异常信息打印:"
+
e
);
}
finally
{
//修改实物状态--在售,onsale=true
Response
response
=
devItemNewService
.
doUpdateCredits
(
cookies
,
appId
,
appItemId
,
skuId
,
"true"
);
response
.
prettyPrint
();
}
}
@Test
(
description
=
"修改优惠券商品上架、下架状态"
)
public
void
商品上架与下架
()
throws
Exception
{
Map
cookies
=
authorization
.
hdLoginCommonNew
(
"15855555555"
);
String
appId
=
"22561"
;
String
appItemIds
=
"195027"
;
try
{
Map
<
String
,
Object
>
mapAppItem
=
jdbc
.
findSimpleResult
(
"SELECT * FROM goods.app_item WHERE id = "
+
appItemIds
);
String
status
=
String
.
valueOf
(
mapAppItem
.
get
(
"status"
));
logger
.
info
(
"商品当前状态:"
+
status
);
Assert
.
assertEquals
(
status
,
"on"
,
"校验商品上架状态失败"
);
//修改状态--下架,status = off
Response
response
=
devItemNewService
.
batchStandUpOrDown
(
cookies
,
appId
,
appItemIds
,
"off"
);
response
.
prettyPrint
();
mapAppItem
=
jdbc
.
findSimpleResult
(
"SELECT * FROM goods.app_item WHERE id = "
+
appItemIds
);
status
=
String
.
valueOf
(
mapAppItem
.
get
(
"status"
));
logger
.
info
(
"商品修改后状态:"
+
status
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
,
"校验商品保存失败"
);
Assert
.
assertEquals
(
status
,
"off"
,
"校验商品下架状态失败"
);
logger
.
info
(
"校验优惠券修改下架状态成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"异常信息打印:"
+
e
);
}
finally
{
//修改状态--上架,status= on
Response
response
=
devItemNewService
.
batchStandUpOrDown
(
cookies
,
appId
,
appItemIds
,
"on"
);
response
.
prettyPrint
();
}
}
}
src/test/java/http/cases/SaasDeveloperTest/活动管理_DuibaTest.java
0 → 100644
View file @
22d3525f
package
http
.
cases
.
SaasDeveloperTest
;
import
base.Config
;
import
base.DuibaLog
;
import
base.DuibaTestBase
;
import
http.service.hd.VisualEditorService
;
import
http.service.Authorization
;
import
http.cases.ExchangeTest.Database
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
import
utils.PublicMethod
;
import
java.util.Map
;
import
http.service.Authorization
;
/**
* Created by lvwenyan on 2019/4/4
*/
public
class
活动管理
_DuibaTest
extends
DuibaTestBase
{
@Autowired
Authorization
authorization
;
@Autowired
VisualEditorService
visualEditorService
;
@Test
(
description
=
"活动管理-活动列表数据"
)
public
void
活动列表
()
throws
Exception
{
Map
cookies
=
authorization
.
hdLoginCommonNew
(
"15855555555"
);
String
appId
=
"22561"
;
Response
response
=
visualEditorService
.
activityList
(
cookies
,
"1"
,
appId
);
response
.
prettyPrint
();
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.result[0].activityId"
),
"511"
,
"校验PK赛活动id失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.result[0].title"
),
"lv测试PK赛1"
,
"校验PK赛活动title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.result[0].typeName"
),
"组件-pk赛"
,
"校验PK赛活动typeName失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.result[0].status"
),
"2"
,
"校验PK赛活动status失败"
);
logger
.
info
(
"校验活动列表-PK赛成功"
);
}
}
src/test/java/http/service/hd/DevItemNewService.java
0 → 100644
View file @
22d3525f
package
http
.
service
.
hd
;
import
base.DuibaLog
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.testng.Assert
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
static
io
.
restassured
.
RestAssured
.
given
;
/**
* Created by lvwenyan on 2019/4/4
*/
@Service
public
class
DevItemNewService
{
@Value
(
"${hdserver.host}"
)
private
String
hdserverHost
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//保存商品
public
Response
doUpdateCredits
(
Map
cookies
,
String
appId
,
String
appItemId
,
String
skuId
,
String
onSale
)
throws
Exception
{
String
url
=
hdserverHost
+
"/devItemNew/doUpdateCredits"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
mapList
=
new
HashMap
<>();
List
<
Map
>
list
=
new
ArrayList
<>();
mapList
.
put
(
"skuId"
,
skuId
);
list
.
add
(
mapList
);
map
.
put
(
"appId"
,
appId
);
map
.
put
(
"appItemId"
,
appItemId
);
map
.
put
(
"buttonText"
,
""
);
map
.
put
(
"creditsInfos"
,
list
.
toArray
());
map
.
put
(
"dateRage"
,
"[]"
);
map
.
put
(
"exchangeType"
,
"1"
);
map
.
put
(
"indexHidden"
,
"false"
);
map
.
put
(
"isOwner"
,
"true"
);
map
.
put
(
"limitDate"
,
""
);
map
.
put
(
"limitEverydayQuantity"
,
""
);
map
.
put
(
"lockTypeList"
,
"[]"
);
map
.
put
(
"multiSku"
,
"false"
);
map
.
put
(
"onSale"
,
onSale
);
map
.
put
(
"originalPriceBuy"
,
"false"
);
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
logger
.
info
(
"请求商品保存接口:"
+
"/devItemNew/doUpdateCredits"
);
Response
response
=
given
().
contentType
(
"application/json; charset=UTF-8"
).
cookies
(
cookies
).
body
(
jsonParam
).
post
(
"http://"
+
url
);
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"/devItemNew/doUpdateCredits接口返回异常,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"/devItemNew/doUpdateCredits接口返回异常,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//商品上架、下架
public
Response
batchStandUpOrDown
(
Map
cookies
,
String
appId
,
String
appItemIds
,
String
status
)
throws
Exception
{
String
url
=
hdserverHost
+
"/devItemNew/batchStandUpOrDown"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId
);
map
.
put
(
"appItemIds"
,
appItemIds
);
map
.
put
(
"status"
,
status
);
logger
.
info
(
"请求商品上架下架接口:"
+
"/devItemNew/batchStandUpOrDown"
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded"
).
cookies
(
cookies
).
params
(
map
).
post
(
"http://"
+
url
);
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"/devItemNew/batchStandUpOrDown接口返回异常,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"/devItemNew/batchStandUpOrDown接口返回异常,返回信息:"
+
response
.
asString
());
}
return
response
;
}
}
src/test/java/http/service/hd/VisualEditorService.java
0 → 100644
View file @
22d3525f
package
http
.
service
.
hd
;
import
base.DuibaLog
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.testng.Assert
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
static
io
.
restassured
.
RestAssured
.
given
;
/**
* Created by lvwenyan on 2019/4/4
*/
@Service
public
class
VisualEditorService
{
@Value
(
"${hdserver.host}"
)
private
String
hdserverHost
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//活动管理列表
public
Response
activityList
(
Map
cookies
,
String
pageNo
,
String
appId
)
throws
Exception
{
String
url
=
hdserverHost
+
"/visual-editor/activity/list"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"pageNo"
,
pageNo
);
map
.
put
(
"pageSize"
,
"10"
);
map
.
put
(
"appId"
,
appId
);
logger
.
info
(
"请求活动列表接口:"
+
"/visual-editor/activity/list"
);
Response
response
=
given
().
contentType
(
"application/json; charset=UTF-8"
).
cookies
(
cookies
).
params
(
map
).
get
(
"http://"
+
url
);
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"/visual-editor/activity/list接口返回异常,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"/visual-editor/activity/list接口返回异常,返回信息:"
+
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