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
d87ca606
Commit
d87ca606
authored
Jul 24, 2024
by
xuyamei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增case
parent
42613838
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
159 additions
and
1 deletions
+159
-1
module/lunar/整个模块.xml
+17
-0
src/main/java/com/xiaomai/cases/polar/reserve/personal/TestCreateSpecialDate.java
+1
-1
src/main/java/com/xiaomai/cases/polar/reserve/personal/TestGetCoachHistorySpecialDate.java
+139
-0
testng.xml
+2
-0
No files found.
module/lunar/整个模块.xml
0 → 100644
View file @
d87ca606
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite
name=
"小程序整个模块case"
>
<!-- 起一个好听且唯一的名字-->
<test
name=
"小程序整个模块测试"
preserve-order=
"true"
verbose=
"3"
>
<!-- 再起一个听且唯一的名字 -->
<packages>
<package
name=
"com.xiaomai.cases.lunar.*"
></package>
<!-- 添加自己想要集成测试的case 范围自己定 -->
</packages>
</test>
<listeners>
<listener
class-name=
"com.xiaomai.client.RetryListener"
/>
<listener
class-name=
"com.xiaomai.client.TestListener"
/>
<listener
class-name=
"com.xiaomai.client.ExtentTestNGIReporterListener"
/>
</listeners>
</suite>
\ No newline at end of file
src/main/java/com/xiaomai/cases/polar/reserve/personal/TestCreateSpecialDate.java
View file @
d87ca606
...
@@ -109,7 +109,7 @@ public class TestCreateSpecialDate extends BaseTestImpl {
...
@@ -109,7 +109,7 @@ public class TestCreateSpecialDate extends BaseTestImpl {
}
}
}
}
Assert
.
assertTrue
(
flag
,
"设置特殊日期
全天休息
后没有找到相关数据"
);
Assert
.
assertTrue
(
flag
,
"设置特殊日期后没有找到相关数据"
);
}
}
@Test
(
description
=
"删除特殊日期"
,
priority
=
2
)
@Test
(
description
=
"删除特殊日期"
,
priority
=
2
)
...
...
src/main/java/com/xiaomai/cases/polar/reserve/personal/TestGetCoachHistorySpecialDate.java
0 → 100644
View file @
d87ca606
package
com
.
xiaomai
.
cases
.
polar
.
reserve
.
personal
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.xiaomai.basetest.BaseTestImpl
;
import
com.xiaomai.cases.polar.reserve.ReserveTools
;
import
com.xiaomai.enums.ApiModule
;
import
com.xiaomai.enums.LoginAccount
;
import
com.xiaomai.enums.Terminal
;
import
com.xiaomai.utils.TimeUtils
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
import
javax.annotation.Resource
;
import
java.util.Random
;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.reserve.personal
* @Author: xuyamei
* @CreateTime: 2024-07-24 16:18
* @Description: 获取教练的历史特殊日期
* @Version: 1.0
*/
public
class
TestGetCoachHistorySpecialDate
extends
BaseTestImpl
{
@Resource
(
name
=
"reserveTools"
)
ReserveTools
reserveTools
;
private
String
coachedId
;
@BeforeClass
public
void
beforeTest
(){
setTestInfo
(
ApiModule
.
Polar_Reserve
,
"API_getCoachHistorySpecialDate"
,
LoginAccount
.
GYM_PROD
,
Terminal
.
B
,
"xym"
);
super
.
beforeTest
();
}
@Test
(
description
=
"设置全天休息-->获取时间"
)
public
void
testGetCoachHistorySpecialDate
()
{
// 获取教练列表
JSONObject
pageStudioPersonalCoach
=
reserveTools
.
pageStudioPersonalCoach
(
""
);
int
total
=
pageStudioPersonalCoach
.
getInteger
(
"total"
);
Random
rand
=
new
Random
();
// 随机取两个教练
coachedId
=
pageStudioPersonalCoach
.
getJSONArray
(
"records"
).
getJSONObject
(
rand
.
nextInt
(
total
>
10
?
10
:
total
)).
getString
(
"id"
);
Long
date
=
TimeUtils
.
getBeforeDayDate
(
1
);
JSONObject
body
=
new
JSONObject
();
body
.
put
(
"brandId"
,
xmAppApi
.
getLoginInfo
().
getBrandId
());
body
.
put
(
"studioId"
,
xmAppApi
.
getLoginInfo
().
getStudioId
());
body
.
put
(
"coachId"
,
coachedId
);
// 可约时间类型
JSONObject
specialTimeInfoRequest
=
new
JSONObject
();
specialTimeInfoRequest
.
put
(
"dutyType"
,
"OFF_DUTY"
);
// 全天休息
// 设置特定日期
JSONArray
specialTimeInfoRequestArray
=
new
JSONArray
();
specialTimeInfoRequestArray
.
add
(
date
);
specialTimeInfoRequest
.
put
(
"selectedDates"
,
specialTimeInfoRequestArray
);
body
.
put
(
"specialTimeInfoRequest"
,
specialTimeInfoRequest
);
reserveTools
.
createSpecialDate
(
coachedId
,
"OFF_DUTY"
,
specialTimeInfoRequest
);
// 设置全天休息完成后检查个人时间是否有这条数据
JSONArray
specialTimeVOS
=
reserveTools
.
getCoachHistorySpecialDate
(
coachedId
);
boolean
flag
=
false
;
for
(
int
i
=
0
;
i
<
specialTimeVOS
.
size
();
i
++){
JSONObject
specialTimeVO
=
specialTimeVOS
.
getJSONObject
(
i
);
if
(
date
.
toString
().
equals
(
specialTimeVO
.
getString
(
"dutyDate"
))){
flag
=
true
;
Assert
.
assertEquals
(
specialTimeVO
.
getString
(
"dutyType"
),
"-1"
,
"特殊日期类型错误"
);
}
}
Assert
.
assertTrue
(
flag
,
"设置特殊日期全天休息后在历史特定日期可约时间列表没有找到相关数据"
);
}
@Test
(
description
=
"设置特定日期可约"
,
priority
=
1
)
public
void
testCreateSpecialDate_ON
()
{
Long
date
=
TimeUtils
.
getBeforeDayDate
(
2
);
JSONObject
specialTimeInfoRequest
=
new
JSONObject
();
// 可约时间类型
specialTimeInfoRequest
.
put
(
"dutyType"
,
"ON_DUTY"
);
// 设置特定日期
JSONArray
selectedDates
=
new
JSONArray
();
selectedDates
.
add
(
date
);
specialTimeInfoRequest
.
put
(
"selectedDates"
,
selectedDates
);
// 如果是可约时间非全天休息,则传可约时间段
// 时间段 00:00 ~ 23:59
JSONArray
timePeriodInfos
=
new
JSONArray
();
JSONObject
timeInfo
=
new
JSONObject
();
timeInfo
.
put
(
"minuteOffset"
,
0
);
timeInfo
.
put
(
"spanMinutes"
,
1380
);
timePeriodInfos
.
add
(
timeInfo
);
specialTimeInfoRequest
.
put
(
"timePeriodInfos"
,
timePeriodInfos
);
reserveTools
.
createSpecialDate
(
coachedId
,
"ON_DUTY"
,
specialTimeInfoRequest
);
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
// 设置特殊可约时间后检查个人私教时间是否有这条数据
JSONArray
specialTimeVOS
=
reserveTools
.
getCoachHistorySpecialDate
(
coachedId
);
boolean
flag
=
false
;
for
(
int
i
=
0
;
i
<
specialTimeVOS
.
size
();
i
++){
JSONObject
specialTimeVO
=
specialTimeVOS
.
getJSONObject
(
i
);
if
(
selectedDates
.
getString
(
0
).
equals
(
specialTimeVO
.
getString
(
"dutyDate"
))){
flag
=
true
;
Assert
.
assertEquals
(
specialTimeVO
.
getString
(
"dutyType"
),
"1"
,
"特殊日期类型错误"
);
Assert
.
assertTrue
(
specialTimeVO
.
getString
(
"timePeriodInfos"
).
equals
(
timePeriodInfos
.
toString
()),
"特殊日期可约时间段"
);
}
}
Assert
.
assertTrue
(
flag
,
"设置特殊日期在历史特定日期可约时间列表没有找到相关数据"
);
}
@Test
(
description
=
"删除特殊日期"
,
priority
=
2
)
public
void
testDeleteSpecialDate
()
{
// 查询特殊可约时间列表
JSONArray
specialTimeVOS
=
reserveTools
.
getCoachHistorySpecialDate
(
coachedId
);
for
(
int
i
=
0
;
i
<
specialTimeVOS
.
size
();
i
++){
String
id
=
specialTimeVOS
.
getJSONObject
(
i
).
getJSONArray
(
"recordIds"
).
getString
(
0
);
// 删除查询到的特殊可约时间
reserveTools
.
deleteSpecialDate
(
id
);
}
specialTimeVOS
=
reserveTools
.
getCoachHistorySpecialDate
(
coachedId
);
Assert
.
assertEquals
(
specialTimeVOS
.
size
(),
0
,
"删除特殊日期后,特殊日期列表不为空"
);
}
}
testng.xml
View file @
d87ca606
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
<suite-files
>
<suite-files
>
<suite-file
path=
"module/polar/整个模块.xml"
></suite-file>
<suite-file
path=
"module/polar/整个模块.xml"
></suite-file>
<suite-file
path=
"module/lunar/整个模块.xml"
></suite-file>
</suite-files>
</suite-files>
</suite>
</suite>
\ No newline at end of file
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