Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xm-sportstest
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiamai-test
xm-sportstest
Commits
b2ec91b7
Commit
b2ec91b7
authored
Dec 31, 2024
by
yangfangfang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
物品
parent
65288473
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
222 additions
and
22 deletions
+222
-22
module/polar/通用设置.xml
+2
-2
src/main/java/com/xiaomai/cases/lunar/goods/GoodCTools.java
+28
-6
src/main/java/com/xiaomai/cases/lunar/goods/testLlistXcxGoodsGroup.java
+147
-1
src/main/java/com/xiaomai/cases/polar/goods/Tools/GoodTools.java
+0
-0
src/main/java/com/xiaomai/cases/polar/goods/createGoods.java
+0
-0
src/main/java/com/xiaomai/cases/polar/goods/createGoodsGroup.java
+2
-2
src/main/java/com/xiaomai/cases/polar/goods/deleteGood.java
+39
-10
src/main/java/com/xiaomai/enums/ApiModule.java
+2
-1
src/main/java/com/xiaomai/enums/LoginAccount.java
+2
-0
No files found.
module/polar/通用设置.xml
View file @
b2ec91b7
<?xml
version="1.0" encoding="UTF-8"?>
<?xml
version="1.0" encoding="UTF-8"?>
...
...
@@ -4,7 +4,7 @@
<test
name=
"通用设置模块测试"
preserve-order=
"true"
verbose=
"3"
>
<!-- 再起一个听且唯一的名字 -->
<packages>
<package
name=
"com.xiaomai.cases.polar.setting.*"
></package>
<!-- 添加自己想要集成测试的
case
范围自己定 -->
<package
name=
"com.xiaomai.cases.polar.setting.*"
></package>
<!-- 添加自己想要集成测试的范围自己定 -->
</packages>
</test>
<listeners>
...
...
src/main/java/com/xiaomai/cases/lunar/goods/GoodCTools.java
View file @
b2ec91b7
...
...
@@ -16,9 +16,9 @@ public class GoodCTools extends XMBaseTest {
* @author: yff
**/
public
JSONObject
pageXcxHomeGoods
_
C
(
DataUserInfo
...
userInfos
){
public
JSONObject
pageXcxHomeGoodsC
(
DataUserInfo
...
userInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Lunar_Goods
)
.
setApiName
(
"API_pageXcxHomeGoods
_
C"
)
.
setApiName
(
"API_pageXcxHomeGoodsC"
)
.
setTerminal
(
Terminal
.
C
);
super
.
beforeDataRequest
(
userInfos
);
...
...
@@ -26,10 +26,10 @@ public class GoodCTools extends XMBaseTest {
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"current"
,
0
);
jsonObject
.
put
(
"size"
,
20
);
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
());
JSONArray
jsonArray
=
new
JSONArray
();
jsonObject
.
put
(
"ids"
,
jsonArray
);
jsonObject
.
put
(
"size"
,
20
);
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
());
JSONArray
ids
=
new
JSONArray
();
jsonObject
.
put
(
"ids"
,
ids
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toString
(),
dataheadrs
).
assetsSuccess
(
true
);
return
dataApi
.
getBodyInJSON
();
...
...
@@ -57,4 +57,26 @@ public class GoodCTools extends XMBaseTest {
return
dataApi
.
getBodyInJSON
();
}
/**
* @param
* @description:拉取C端小程序物品组列表
* @author: yff
**/
public
JSONObject
listXcxGoodsGroup
(
DataUserInfo
...
userInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Lunar_Goods
)
.
setApiName
(
"API_listXcxGoodsGroup"
)
.
setTerminal
(
Terminal
.
C
);
super
.
beforeDataRequest
(
userInfos
);
JSONObject
listXcxGoodsGroup
=
new
JSONObject
();
listXcxGoodsGroup
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
());
JSONArray
ids
=
new
JSONArray
();
listXcxGoodsGroup
.
put
(
"ids"
,
ids
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
listXcxGoodsGroup
.
toString
(),
dataheadrs
).
assetsSuccess
(
true
);
return
dataApi
.
getBodyInJSON
();
}
}
src/main/java/com/xiaomai/cases/lunar/goods/testLlistXcxGoodsGroup.java
View file @
b2ec91b7
package
com
.
xiaomai
.
cases
.
lunar
.
goods
;
public
class
testLlistXcxGoodsGroup
{
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.xiaomai.basetest.BaseTestImpl
;
import
com.xiaomai.cases.polar.goods.Tools.GoodTools
;
import
com.xiaomai.client.DataUserInfo
;
import
com.xiaomai.enums.ApiModule
;
import
com.xiaomai.enums.LoginAccount
;
import
com.xiaomai.enums.Terminal
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeMethod
;
import
org.testng.annotations.Test
;
public
class
testLlistXcxGoodsGroup
extends
BaseTestImpl
{
GoodCTools
goodCTools
=
new
GoodCTools
();
GoodTools
goodTools
=
new
GoodTools
();
String
createGoodsId
;
DataUserInfo
info
=
new
DataUserInfo
();
@BeforeMethod
@Override
public
void
beforeTest
(){
setTestInfo
(
ApiModule
.
Lunar_Goods
,
"API_listXcxGoodsGroup"
,
LoginAccount
.
GYM_MINIAPPC
,
Terminal
.
minApp
,
"yff"
);
super
.
beforeTest
();
}
@Test
(
description
=
"拉取C端小程序物品组列表"
)
public
void
testListXcxGoodsGroup
()
{
//切换端位
info
.
setTerminal
(
Terminal
.
B
);
info
.
setLoginUser
(
LoginAccount
.
GYM_PROD
);
//存量分组:"id": "1873903771989471234","name": "自动化分组勿动勿用"
String
id
=
"1873903771989471234"
;
//case1:获取小程序物品分组列表:没有这个分组数据,因为没任何物品
JSONObject
listXcxGoodsGroup
=
goodCTools
.
listXcxGoodsGroup
();
JSONArray
result
=
listXcxGoodsGroup
.
getJSONArray
(
"result"
);
boolean
success
=
false
;
for
(
int
i
=
0
;
i
<
result
.
size
();
i
++){
if
(
!
result
.
getJSONObject
(
i
).
getString
(
"id"
).
equals
(
id
)){
success
=
true
;
}
Assert
.
assertEquals
(
success
,
true
,
"分组里没有一个物品,这个分组不应该在小程序物品组列表展示"
);
}
//case2:获取小程序物品分组列表:有这个分组数据,因为创建了一个单规格&启用&开启小程序售卖的物品
//新建物品
//创建了一个单规格&启用&开启小程序售卖
JSONObject
createGoods
=
goodTools
.
testCreateGoods_single
(
"YES"
,
"0.01"
,
10
,
info
);
createGoodsId
=
createGoods
.
getString
(
"result"
);
//移动至这个分组
JSONObject
batchModifyGoodsBelongGroup
=
goodTools
.
batchModifyGoodsBelongGroup
(
"1873903771989471234"
,
createGoodsId
,
info
);
try
{
Thread
.
sleep
(
3000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
//获取小程序物品分组列表:有该分组
JSONObject
listXcxGoodsGroup1
=
goodCTools
.
listXcxGoodsGroup
();
JSONArray
result1
=
listXcxGoodsGroup1
.
getJSONArray
(
"result"
);
boolean
success1
=
false
;
for
(
int
i
=
0
;
i
<
result1
.
size
();
i
++){
if
(
result1
.
getJSONObject
(
i
).
getString
(
"id"
).
equals
(
id
)){
success1
=
true
;
}
Assert
.
assertEquals
(
success1
,
true
,
"分组的物品是启用且开启小程序售卖的,这个分组应该在小程序物品组列表展示"
);
}
//case3:获取小程序物品分组列表:没有这个分组数据,因为分组内的物品为启用&关闭小程序售卖
//修改上个物品为启用&关闭小程序售卖
JSONObject
modifyGoodsXcxSaleState
=
goodTools
.
modifyGoodsXcxSaleState
(
createGoodsId
,
"NO"
,
info
);
try
{
Thread
.
sleep
(
3000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
//修改校验1:获取B端物品详情
JSONObject
getDetail
=
goodTools
.
getDetail_goods
(
createGoodsId
,
info
);
String
xcxSaleState
=
getDetail
.
getJSONObject
(
"result"
).
getString
(
"xcxSaleState"
);
Assert
.
assertEquals
(
xcxSaleState
,
"NO"
,
"修改物品的小程序售卖为关闭失败"
);
//获取小程序物品分组列表:没有该分组
JSONObject
listXcxGoodsGroup2
=
goodCTools
.
listXcxGoodsGroup
();
JSONArray
result2
=
listXcxGoodsGroup2
.
getJSONArray
(
"result"
);
boolean
success2
=
false
;
for
(
int
i
=
0
;
i
<
result2
.
size
();
i
++){
if
(
!
result2
.
getJSONObject
(
i
).
getString
(
"id"
).
equals
(
id
)){
success2
=
true
;
}
Assert
.
assertEquals
(
success2
,
true
,
"分组的物品是启用且关闭小程序售卖的,这个分组应该不在小程序物品组列表展示"
);
}
//case4:获取小程序物品分组列表:没有这个分组数据,因为分组内的物品为停用&关闭小程序售卖
//修改上个物品为停用&关闭小程序售卖
JSONObject
modifyGoodsState
=
goodTools
.
modifyGoodsState
(
createGoodsId
,
"NO"
,
info
);
try
{
Thread
.
sleep
(
3000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
//修改校验1:获取B端物品详情
JSONObject
getDetail1
=
goodTools
.
getDetail_goods
(
createGoodsId
,
info
);
String
state
=
getDetail1
.
getJSONObject
(
"result"
).
getString
(
"state"
);
Assert
.
assertEquals
(
state
,
"NO"
,
"修改物品的状态为停用失败"
);
//获取小程序物品分组列表:没有该分组
JSONObject
listXcxGoodsGroup3
=
goodCTools
.
listXcxGoodsGroup
();
JSONArray
result3
=
listXcxGoodsGroup3
.
getJSONArray
(
"result"
);
boolean
success3
=
false
;
for
(
int
i
=
0
;
i
<
result3
.
size
();
i
++){
if
(
!
result3
.
getJSONObject
(
i
).
getString
(
"id"
).
equals
(
id
)){
success3
=
true
;
}
Assert
.
assertEquals
(
success3
,
true
,
"分组的物品是停用且关闭小程序售卖的,这个分组应该不在小程序物品组列表展示"
);
}
}
@Test
(
description
=
"清理物品数据"
,
priority
=
1
)
public
void
delete
()
{
goodTools
.
deleteGoods
(
createGoodsId
,
info
);
}
}
src/main/java/com/xiaomai/cases/polar/goods/Tools/GoodTools.java
View file @
b2ec91b7
This diff is collapsed.
Click to expand it.
src/main/java/com/xiaomai/cases/polar/goods/createGoods.java
View file @
b2ec91b7
This diff is collapsed.
Click to expand it.
src/main/java/com/xiaomai/cases/polar/goods/createGoodsGroup.java
View file @
b2ec91b7
...
...
@@ -27,7 +27,7 @@ public class createGoodsGroup extends XMBaseTest {
public
void
beforeTest
()
{
xmAppApi
.
setApiModule
(
ApiModule
.
Polar_Goods
)
.
setApiName
(
"API_createGoodsGroup"
)
.
setLoginUser
(
LoginAccount
.
YFF_RC
)
.
setLoginUser
(
LoginAccount
.
GYM_PROD
)
.
setTerminal
(
Terminal
.
B
);
dal
.
setCase_owner
(
"yff"
)
...
...
@@ -77,7 +77,7 @@ public class createGoodsGroup extends XMBaseTest {
}
//新建一个物品
JSONObject
create
=
goodTools
.
testCreateGoods
(
true
);
JSONObject
create
=
goodTools
.
testCreateGoods
_multiple
(
"YES"
,
"0.01"
,
10
);
createId
=
create
.
getString
(
"result"
);
//新建分组成功后,批量移动物品至其分组
...
...
src/main/java/com/xiaomai/cases/polar/goods/deleteGood.java
View file @
b2ec91b7
package
com
.
xiaomai
.
cases
.
polar
.
goods
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.xiaomai.cases.polar.goods.Tools.GoodTools
;
import
com.xiaomai.enums.ApiModule
;
...
...
@@ -7,6 +8,7 @@ import com.xiaomai.enums.LoginAccount;
import
com.xiaomai.enums.RequestType
;
import
com.xiaomai.enums.Terminal
;
import
com.xiaomai.utils.XMBaseTest
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeMethod
;
import
org.testng.annotations.Test
;
...
...
@@ -18,7 +20,7 @@ public class deleteGood extends XMBaseTest {
public
void
beforeTest
()
{
xmAppApi
.
setApiModule
(
ApiModule
.
Polar_Goods
)
.
setApiName
(
"API_delete"
)
.
setLoginUser
(
LoginAccount
.
YFF_RC
)
.
setLoginUser
(
LoginAccount
.
GYM_PROD
)
.
setTerminal
(
Terminal
.
B
);
dal
.
setCase_owner
(
"yff"
)
...
...
@@ -30,12 +32,24 @@ public class deleteGood extends XMBaseTest {
@Test
(
description
=
"删除物品"
)
public
void
testCreateGoods
()
{
// JSONObject jsonObject=goodTools.testCreateGoods(true);
//新建物品
JSONObject
createGoods
=
goodTools
.
testCreateGoods_multiple
(
"YES"
,
"0.01"
,
10
);
String
id
=
createGoods
.
getString
(
"result"
);
//获取物品列表
JSONObject
studioGoods
=
goodTools
.
studioGoods
();
String
id
=
studioGoods
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"id"
);
JSONArray
records
=
studioGoods
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
);
boolean
success
=
false
;
for
(
int
i
=
0
;
i
<
records
.
size
();
i
++){
if
(
records
.
getJSONObject
(
i
).
getString
(
"id"
).
equals
(
id
)){
success
=
true
;
}
Assert
.
assertEquals
(
success
,
true
,
"新建物品成功,但物品列表没有新增此条数据"
);
}
//删除物品
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"id"
,
id
);
...
...
@@ -45,18 +59,32 @@ public class deleteGood extends XMBaseTest {
xmAppApi
.
doRequest
(
RequestType
.
JSON
,
params
,
jsonObject
.
toJSONString
(),
headers
).
assetsSuccess
(
true
);
try
{
Thread
.
sleep
(
5
000
);
Thread
.
sleep
(
3
000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
@Test
public
void
xun
(){
for
(
int
i
=
0
;
i
<
46
;
i
++){
testCreateGoods
();
//校验1:物品列表中没有此数据
JSONObject
afterStudioGoods
=
goodTools
.
studioGoods
();
JSONArray
afterRecords
=
afterStudioGoods
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
);
boolean
afterSuccess
=
false
;
for
(
int
i
=
0
;
i
<
afterRecords
.
size
();
i
++){
if
(
!
afterRecords
.
getJSONObject
(
i
).
getString
(
"id"
).
equals
(
id
)){
afterSuccess
=
true
;
}
Assert
.
assertEquals
(
afterSuccess
,
true
,
"删除物品成功,但物品列表还有此条数据"
);
}
}
// @Test
// public void xun(){
// for(int i=0;i<20;i++){
// testCreateGoods();
// }
// }
}
\ No newline at end of file
src/main/java/com/xiaomai/enums/ApiModule.java
View file @
b2ec91b7
...
...
@@ -49,7 +49,7 @@ public class ApiModule {
public
static
String
Lunar_Training
=
"lunar_training"
;
//训练
public
static
String
Lunar_Share
=
"lunar_share"
;
//分享
public
static
String
Lunar_VenueArea
=
"lunar_venueArea"
;
//场地
public
static
String
Lunar_Goods
=
"lunar_
G
oods"
;
//物品
public
static
String
Lunar_Goods
=
"lunar_
g
oods"
;
//物品
}
\ No newline at end of file
src/main/java/com/xiaomai/enums/LoginAccount.java
View file @
b2ec91b7
...
...
@@ -24,4 +24,6 @@ public class LoginAccount {
public
static
String
YFF_RC
=
"yff_rc"
;
public
static
String
YFF_GRAY
=
"yff_gray"
;
//芳芳场馆
}
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