Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jk_interface_test
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
huangqiang
jk_interface_test
Commits
e6ceac59
Commit
e6ceac59
authored
May 07, 2021
by
lanjiali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
校区收入查询
parent
386fc4c7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
245 additions
and
268 deletions
+245
-268
workspace.xml
.idea/workspace.xml
+15
-6
run.py
run.py
+1
-1
report_config.py
..._yun_ying_pc/lanjiali_report/data_config/report_config.py
+11
-0
test_demo.py
script/ji_yun_ying_pc/lanjiali_report/test_demo.py
+2
-2
test_school_expense.py
script/ji_yun_ying_pc/lanjiali_report/test_school_expense.py
+0
-256
test_school_income.py
script/ji_yun_ying_pc/lanjiali_report/test_school_income.py
+185
-0
test_student_income.py
script/ji_yun_ying_pc/lanjiali_report/test_student_income.py
+31
-3
No files found.
.idea/workspace.xml
View file @
e6ceac59
...
@@ -19,14 +19,14 @@
...
@@ -19,14 +19,14 @@
<select
/>
<select
/>
</component>
</component>
<component
name=
"ChangeListManager"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"54f4d37d-1724-4813-a1e2-24e200088c5f"
name=
"Default Changelist"
comment=
"校区费用预警-查询"
>
<list
default=
"true"
id=
"54f4d37d-1724-4813-a1e2-24e200088c5f"
name=
"Default Changelist"
comment=
"学生收入查询"
>
<change
afterPath=
"$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_school_income.py"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_student_income.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/run.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/run.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/run.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/run.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/data_config/report_config.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/data_config/report_config.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/data_config/report_config.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/data_config/report_config.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_demo.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_demo.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_demo.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_demo.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_school_expense.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_school_expense.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_school_expense.py"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_school_income.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_school_income.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_student_income.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_student_income.py"
afterDir=
"false"
/>
</list>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
...
@@ -272,7 +272,14 @@
...
@@ -272,7 +272,14 @@
<option
name=
"project"
value=
"LOCAL"
/>
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1619776864150
</updated>
<updated>
1619776864150
</updated>
</task>
</task>
<option
name=
"localTasksCounter"
value=
"12"
/>
<task
id=
"LOCAL-00012"
summary=
"学生收入查询"
>
<created>
1620301228395
</created>
<option
name=
"number"
value=
"00012"
/>
<option
name=
"presentableId"
value=
"LOCAL-00012"
/>
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1620301228395
</updated>
</task>
<option
name=
"localTasksCounter"
value=
"13"
/>
<servers
/>
<servers
/>
</component>
</component>
<component
name=
"Vcs.Log.Tabs.Properties"
>
<component
name=
"Vcs.Log.Tabs.Properties"
>
...
@@ -297,6 +304,7 @@
...
@@ -297,6 +304,7 @@
<MESSAGE
value=
"校区费用预警查询"
/>
<MESSAGE
value=
"校区费用预警查询"
/>
<MESSAGE
value=
"学生费用预警查询-分页"
/>
<MESSAGE
value=
"学生费用预警查询-分页"
/>
<MESSAGE
value=
"校区费用预警-查询"
/>
<MESSAGE
value=
"校区费用预警-查询"
/>
<option
name=
"LAST_COMMIT_MESSAGE"
value=
"校区费用预警-查询"
/>
<MESSAGE
value=
"学生收入查询"
/>
<option
name=
"LAST_COMMIT_MESSAGE"
value=
"学生收入查询"
/>
</component>
</component>
</project>
</project>
\ No newline at end of file
run.py
View file @
e6ceac59
...
@@ -3,7 +3,7 @@ import os
...
@@ -3,7 +3,7 @@ import os
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
run_config
=
[
run_config
=
[
"-s"
,
"./script/ji_yun_ying_pc/lanjiali_report/test_s
tudent_income.py
"
,
"-s"
,
"./script/ji_yun_ying_pc/lanjiali_report/test_s
chool_income.py::Test_school_income::test_school_income_total
"
,
"--alluredir"
,
"./report/xml"
,
"--alluredir"
,
"./report/xml"
,
"--host"
,
"http://192.168.32.31"
,
"--host"
,
"http://192.168.32.31"
,
"--account"
,
"b"
,
"--account"
,
"b"
,
...
...
script/ji_yun_ying_pc/lanjiali_report/data_config/report_config.py
View file @
e6ceac59
...
@@ -144,3 +144,13 @@ income_student_status = [
...
@@ -144,3 +144,13 @@ income_student_status = [
"statu_type"
:
[
'结业'
]
"statu_type"
:
[
'结业'
]
}
}
]
]
#校区搜索
schoolareas_keywords
=
[
'成都光华中心校'
,
'金沙'
,
'测试校区7'
]
#获取不同年份
def
select_years
():
today
=
datetime
.
datetime
.
today
()
year
=
today
.
year
years
=
[
year
-
1
,
year
]
return
years
\ No newline at end of file
script/ji_yun_ying_pc/lanjiali_report/test_demo.py
View file @
e6ceac59
...
@@ -49,8 +49,8 @@ class Test_select_student_expense:
...
@@ -49,8 +49,8 @@ class Test_select_student_expense:
result
=
public_asserts
.
assert_res_field_equal_value
(
studentphone_list
,
keyword_value
)
result
=
public_asserts
.
assert_res_field_equal_value
(
studentphone_list
,
keyword_value
)
pytest
.
assume
(
result
)
pytest
.
assume
(
result
)
@allure.story
(
"学生费用预警查询-年份筛选"
)
@allure.story
(
"学生费用预警查询-
不同
年份筛选"
)
@pytest.mark.parametrize
(
"year"
,
[
select_year
()]
)
@pytest.mark.parametrize
(
"year"
,
select_years
()
)
def
test_year_screen
(
self
,
year
):
def
test_year_screen
(
self
,
year
):
data
=
{
data
=
{
"pageNum"
:
1
,
"pageNum"
:
1
,
...
...
script/ji_yun_ying_pc/lanjiali_report/test_school_expense.py
deleted
100644 → 0
View file @
386fc4c7
# 校区费用预警
import
allure
import
pytest
import
jsonpath
from
script
import
public_asserts
from
script.base_api
import
report_finance_school_expense_warning_post
,
report_finance_student_expense_warning_post
from
script.ji_yun_ying_pc.lanjiali_report.data_config.report_config
import
*
from
script.default_header
import
jyy_header
@allure.feature
(
"预警报表-校区费用预警查询"
)
class
Test_select_school_expense_warning
():
@allure.story
(
"校区费用预警-按年份筛选"
)
@pytest.mark.parametrize
(
"year"
,[
select_year
()])
def
test_select_year
(
self
,
year
):
print
(
year
)
data
=
{
"pageNum"
:
1
,
"pageSize"
:
10
,
"year"
:
year
,
"term"
:
"春"
,
"schoolAreaIds"
:
school_areas
,
"groups"
:
[
"school_area_id"
]
}
res
=
report_finance_school_expense_warning_post
(
header
=
jyy_header
,
body
=
data
)
print
(
res
)
assert
res
[
'msg'
]
==
'成功'
assert
res
[
'code'
]
==
0
@allure.story
(
"校区费用预警-按期段筛选"
)
@pytest.mark.parametrize
(
"term"
,[
select_term
()])
def
test_select_term
(
self
,
term
):
data
=
{
"pageNum"
:
1
,
"pageSize"
:
10
,
"year"
:
select_year
(),
"term"
:
term
,
"schoolAreaIds"
:
school_areas
,
"groups"
:
[
"school_area_id"
]
}
res
=
report_finance_school_expense_warning_post
(
header
=
jyy_header
,
body
=
data
)
assert
res
[
'msg'
]
==
'成功'
assert
res
[
'code'
]
==
0
@allure.story
(
"校区费用预警-组合筛选"
)
@pytest.mark.parametrize
(
'year,term,grade,subject,classtype'
,
[
(
select_year
(),
select_term
(),
grades
[
2
],
subjects
[
3
],
'极趣班'
)
]
)
def
test_select_all
(
self
,
year
,
term
,
grade
,
subject
,
classtype
):
data
=
{
"pageNum"
:
1
,
"pageSize"
:
10
,
"year"
:
year
,
"term"
:
term
,
"subjects"
:
[
subject
],
"grades"
:
[
grade
],
"classTypes"
:
[
classtype
],
"schoolAreaIds"
:
school_areas
,
"groups"
:
[
"school_area_id"
]
}
res
=
report_finance_school_expense_warning_post
(
header
=
jyy_header
,
body
=
data
)
assert
res
[
'msg'
]
==
'成功'
assert
res
[
'code'
]
==
0
@allure.title
(
"校区费用预警-汇总数据校验"
)
@pytest.mark.parametrize
(
"year,term,subject,grade,classtype"
,
[(
select_year
(),
select_term
(),
subjects
[
4
],
grades
[
2
],
"数学"
)]
)
def
test_schoolExtend_total
(
self
,
year
,
term
,
subject
,
grade
,
classtype
):
data
=
{
"pageNum"
:
1
,
"pageSize"
:
10
,
"year"
:
year
,
"term"
:
term
,
"subjects"
:
[
subject
],
"grades"
:
[
grade
],
"classTypes"
:
[
classtype
],
"schoolAreaIds"
:
school_areas
,
"groups"
:
[
"school_area_id"
]
}
schoolexpense_res
=
report_finance_school_expense_warning_post
(
header
=
jyy_header
,
body
=
data
)
#获取学生费用预警汇总数据
student_expense_data
=
{
"pageNum"
:
1
,
"pageSize"
:
10000
,
"year"
:
year
,
"term"
:
term
,
"subjects"
:
[
subject
],
"grades"
:
[
grade
],
"classTypes"
:
[
classtype
],
"schoolAreaIds"
:
school_areas
,
"studentStatuses"
:
[
1110
,
1140
,
1150
,
1120
,
1130
,
1160
]
}
studentexpense_res
=
report_finance_student_expense_warning_post
(
header
=
jyy_header
,
body
=
student_expense_data
)
if
schoolexpense_res
[
'data'
][
'list'
]
!=
[]:
#校区汇总的预收课时总数与学生预收课时总数判断
school_prepaidNum_total
=
round
(
schoolexpense_res
[
'data'
][
'extend'
][
'prepaidNum'
],
2
)
student_prepaidNum_total
=
round
(
studentexpense_res
[
'data'
][
'extend'
][
'prepaidNum'
],
2
)
assert
school_prepaidNum_total
==
student_prepaidNum_total
print
(
school_prepaidNum_total
)
#校区汇总的预收课程净额
school_prepaidAmount_total
=
round
(
schoolexpense_res
[
'data'
][
'extend'
][
'prepaidAmount'
],
2
)
student_prepaidAmount_total
=
round
(
studentexpense_res
[
'data'
][
'extend'
][
'prepaidAmount'
],
2
)
assert
school_prepaidAmount_total
==
student_prepaidAmount_total
print
(
school_prepaidAmount_total
)
#校区汇总的课消课时数
school_attendanceNum_total
=
round
(
schoolexpense_res
[
'data'
][
'extend'
][
'attendanceNum'
],
2
)
student_attendanceNum_total
=
round
(
studentexpense_res
[
'data'
][
'extend'
][
'attendanceNum'
],
2
)
assert
school_attendanceNum_total
==
student_attendanceNum_total
print
(
school_attendanceNum_total
)
#校区汇总的溢价
school_premium_total
=
round
(
schoolexpense_res
[
'data'
][
'extend'
][
'premium'
],
2
)
student_premium_total
=
round
(
studentexpense_res
[
'data'
][
'extend'
][
'premium'
],
2
)
print
(
school_premium_total
)
assert
school_premium_total
==
student_premium_total
#校区汇总的其他抵扣
school_otherDeduction_total
=
round
(
schoolexpense_res
[
'data'
][
'extend'
][
'otherDeduction'
],
2
)
student_otherDeduction_total
=
round
(
studentexpense_res
[
'data'
][
'extend'
][
'otherDeduction'
],
2
)
print
(
school_otherDeduction_total
)
assert
school_otherDeduction_total
==
student_otherDeduction_total
#校区差异调整汇总 imbalanceAmount
school_imbalanceAmount_total
=
round
(
schoolexpense_res
[
'data'
][
'extend'
][
'imbalanceAmount'
],
2
)
student_imbalanceAmount_total
=
round
(
studentexpense_res
[
'data'
][
'extend'
][
'imbalanceAmount'
],
2
)
assert
school_imbalanceAmount_total
==
student_imbalanceAmount_total
print
(
school_imbalanceAmount_total
)
else
:
assert
schoolexpense_res
[
'msg'
]
==
'成功'
assert
schoolexpense_res
[
'code'
]
==
0
@allure.story
(
"校区费用预警-不同校区的列表数据正确"
)
@pytest.mark.parametrize
(
#[2389]:成都金沙中心校 [3063]:创意山中心校
"year,term,subject,grade,classtype,schoolarea"
,
[
(
select_year
(),
select_term
(),
subjects
[
3
],
grades
[
2
],
"极趣班"
,[
2389
]),
(
select_year
(),
select_term
(),
subjects
[
3
],
grades
[
2
],
"极趣班"
,
[
3063
])
]
)
def
test_diffient_schoolexpense_total
(
self
,
year
,
term
,
subject
,
grade
,
classtype
,
schoolarea
):
print
(
grade
,
subject
)
schoolexpense_data
=
{
"pageNum"
:
1
,
"pageSize"
:
10
,
"year"
:
year
,
"term"
:
term
,
"subjects"
:
[
subject
],
"grades"
:
[
grade
],
"classTypes"
:
[
classtype
],
"schoolAreaIds"
:
schoolarea
,
"groups"
:
[
"school_area_id"
]
}
schoolexpense_res
=
report_finance_school_expense_warning_post
(
header
=
jyy_header
,
body
=
schoolexpense_data
)
#获取对应校区学生的费用预警总额
studentexpense_data
=
{
"pageNum"
:
1
,
"pageSize"
:
10000
,
"year"
:
year
,
"term"
:
term
,
"subjects"
:
[
subject
],
"grades"
:
[
grade
],
"classTypes"
:
[
classtype
],
"schoolAreaIds"
:
schoolarea
,
"studentStatuses"
:
[
1110
,
1140
,
1150
,
1120
,
1130
,
1160
]
}
studentexpense_res
=
report_finance_student_expense_warning_post
(
header
=
jyy_header
,
body
=
studentexpense_data
)
if
schoolexpense_res
[
'data'
][
'list'
]
==
[]:
assert
schoolexpense_res
[
'code'
]
==
0
assert
schoolexpense_res
[
'msg'
]
==
'成功'
else
:
# 校区汇总的预收课时总数与学生预收课时总数判断
school_prepaidNum_total
=
round
(
schoolexpense_res
[
'data'
][
'extend'
][
'prepaidNum'
],
2
)
student_prepaidNum_total
=
round
(
studentexpense_res
[
'data'
][
'extend'
][
'prepaidNum'
],
2
)
assert
school_prepaidNum_total
==
student_prepaidNum_total
# 校区汇总的预收课程净额
school_prepaidAmount_total
=
round
(
schoolexpense_res
[
'data'
][
'extend'
][
'prepaidAmount'
],
2
)
student_prepaidAmount_total
=
round
(
studentexpense_res
[
'data'
][
'extend'
][
'prepaidAmount'
],
2
)
assert
school_prepaidAmount_total
==
student_prepaidAmount_total
# 校区汇总的课消课时数
school_attendanceNum_total
=
round
(
schoolexpense_res
[
'data'
][
'extend'
][
'attendanceNum'
],
2
)
student_attendanceNum_total
=
round
(
studentexpense_res
[
'data'
][
'extend'
][
'attendanceNum'
],
2
)
assert
school_attendanceNum_total
==
student_attendanceNum_total
# 校区汇总的溢价
school_premium_total
=
round
(
schoolexpense_res
[
'data'
][
'extend'
][
'premium'
],
2
)
student_premium_total
=
round
(
studentexpense_res
[
'data'
][
'extend'
][
'premium'
],
2
)
assert
school_premium_total
==
student_premium_total
# 校区汇总的其他抵扣
school_otherDeduction_total
=
round
(
schoolexpense_res
[
'data'
][
'extend'
][
'otherDeduction'
],
2
)
student_otherDeduction_total
=
round
(
studentexpense_res
[
'data'
][
'extend'
][
'otherDeduction'
],
2
)
assert
school_otherDeduction_total
==
student_otherDeduction_total
# 校区差异调整汇总 imbalanceAmount
school_imbalanceAmount_total
=
round
(
schoolexpense_res
[
'data'
][
'extend'
][
'imbalanceAmount'
],
2
)
student_imbalanceAmount_total
=
round
(
studentexpense_res
[
'data'
][
'extend'
][
'imbalanceAmount'
],
2
)
assert
school_imbalanceAmount_total
==
student_imbalanceAmount_total
@allure.story
(
"校区费用预警-分页"
)
@pytest.mark.parametrize
(
"year,term,subject,grade,classtype"
,
[(
select_year
(),
select_term
(),
subjects
[
3
],
grades
[
2
],
"极趣班"
)]
)
def
test_page
(
self
,
year
,
term
,
subject
,
grade
,
classtype
):
data
=
{
"pageNum"
:
1
,
"pageSize"
:
10
,
"year"
:
year
,
"term"
:
term
,
"subjects"
:
[
subject
],
"grades"
:
[
grade
],
"classTypes"
:
[
classtype
],
"schoolAreaIds"
:
school_areas
,
"groups"
:
[
"school_area_id"
]
}
res1
=
report_finance_school_expense_warning_post
(
header
=
jyy_header
,
body
=
data
)
schoolexpense_total
=
res1
[
'data'
][
'total'
]
if
schoolexpense_total
<=
10
:
assert
res1
[
'msg'
]
==
'成功'
assert
res1
[
'data'
][
'pageNum'
]
==
1
else
:
data2
=
{
"pageNum"
:
2
,
"pageSize"
:
10
,
"year"
:
year
,
"term"
:
term
,
"subjects"
:
[
subject
],
"grades"
:
[
grade
],
"classTypes"
:
[
classtype
],
"schoolAreaIds"
:
school_areas
,
"groups"
:
[
"school_area_id"
]
}
res2
=
report_finance_school_expense_warning_post
(
header
=
jyy_header
,
body
=
data2
)
assert
res2
[
'msg'
]
==
'成功'
assert
res2
[
'data'
][
'pageNum'
]
==
2
script/ji_yun_ying_pc/lanjiali_report/test_school_income.py
View file @
e6ceac59
# 报表-校区收入查询
import
pytest
import
allure
import
jsonpath
from
script.base_api
import
report_finance_school_income_list_post
,
report_finance_student_income_list_post
from
script.ji_yun_ying_pc.lanjiali_report.data_config.report_config
import
*
from
script.default_header
import
jyy_header
from
script
import
public_asserts
import
random
@allure.feature
(
"收入报表-校区收入查询"
)
class
Test_school_income
():
@allure.story
(
"校区收入-校区名字查询"
)
@pytest.mark.parametrize
(
"keyword"
,
schoolareas_keywords
)
def
test_keyword
(
self
,
keyword
):
data
=
{
"keyword"
:
keyword
,
"termStr"
:
[
"春"
],
"year"
:
[
2021
],
"pageSize"
:
10
,
"pageNum"
:
1
,
"schoolArea"
:
school_areas
[
0
:
50
]
}
res
=
report_finance_school_income_list_post
(
header
=
jyy_header
,
body
=
data
)
if
res
[
'data'
][
'list'
]
!=
[]:
schoolname_list
=
jsonpath
.
jsonpath
(
res
,
"$.data.list..schoolAreaName"
)
result
=
public_asserts
.
assert_res_field_contain_value
(
schoolname_list
,
keyword
)
pytest
.
assume
(
result
)
else
:
assert
res
[
'msg'
]
==
'成功'
assert
res
[
'code'
]
==
0
#学生收入和某校区总收入
@allure.story
(
"校区收入-当前学期查询"
)
@pytest.mark.parametrize
(
"term,school_area"
,
[(
select_term
(),
random
.
sample
(
school_areas
,
1
))]
)
def
test_select_term
(
self
,
term
,
school_area
):
school_income_data
=
{
"keyword"
:
""
,
"termStr"
:
[
term
],
"year"
:
[
select_year
()],
"pageSize"
:
10
,
"pageNum"
:
1
,
"schoolArea"
:
school_area
}
school_income_res
=
report_finance_school_income_list_post
(
body
=
school_income_data
,
header
=
jyy_header
)
# print(f"该校区收入",school_total_income)
if
school_income_res
[
'data'
][
'list'
]
==
[]:
assert
school_income_res
[
'msg'
]
==
'成功'
assert
school_income_res
[
'code'
]
==
0
else
:
school_total_income
=
school_income_res
[
'data'
][
'list'
][
0
][
'totalIncome'
]
student_income_data
=
{
"keyword"
:
""
,
"studentStatus"
:
[
0
],
"classType"
:
[],
"grade"
:
[],
"subject"
:
[],
"termStr"
:
[
term
],
"year"
:
[
select_year
()],
"pageSize"
:
10000
,
"pageNum"
:
1
,
"schoolArea"
:
school_area
}
stuincome_res
=
report_finance_student_income_list_post
(
header
=
jyy_header
,
body
=
student_income_data
)
student_totalincome_list
=
jsonpath
.
jsonpath
(
stuincome_res
,
"$.data.list..totalIncome"
)
total_student_income
=
round
(
sum
(
student_totalincome_list
),
2
)
# print(f"学生收入总和",total_student_income)
assert
school_total_income
==
total_student_income
@allure.story
(
"校区收入-查询不同年份的校区收入"
)
@pytest.mark.parametrize
(
"year"
,[
select_year
()])
def
test_select_year
(
self
,
year
):
school_area
=
random
.
sample
(
school_areas
,
1
)
school_income_data
=
{
"keyword"
:
""
,
"termStr"
:
[
select_term
()],
"year"
:
[
year
],
"pageSize"
:
10
,
"pageNum"
:
1
,
"schoolArea"
:
school_area
}
school_income_res
=
report_finance_school_income_list_post
(
body
=
school_income_data
,
header
=
jyy_header
)
if
school_income_res
[
'data'
][
'list'
]
==
[]:
assert
school_income_res
[
'msg'
]
==
'成功'
assert
school_income_res
[
'code'
]
==
0
else
:
school_total_income
=
school_income_res
[
'data'
][
'list'
][
0
][
'totalIncome'
]
student_income_data
=
{
"keyword"
:
""
,
"studentStatus"
:
[
0
],
"classType"
:
[],
"grade"
:
[],
"subject"
:
[],
"termStr"
:
[
select_term
()],
"year"
:
[
year
],
"pageSize"
:
10000
,
"pageNum"
:
1
,
"schoolArea"
:
school_area
}
stuincome_res
=
report_finance_student_income_list_post
(
header
=
jyy_header
,
body
=
student_income_data
)
student_totalincome_list
=
jsonpath
.
jsonpath
(
stuincome_res
,
"$.data.list..totalIncome"
)
total_student_income
=
round
(
sum
(
student_totalincome_list
),
2
)
assert
school_total_income
==
total_student_income
@allure.story
(
"校区收入-不同校区收入查询"
)
@pytest.mark.parametrize
(
"school_area"
,
random
.
sample
(
school_areas
,
3
))
def
test_diffient_schoolarea_income
(
self
,
school_area
):
school_income_data
=
{
"keyword"
:
""
,
"termStr"
:
[
select_term
()],
"year"
:
[
select_year
()],
"pageSize"
:
10
,
"pageNum"
:
1
,
"schoolArea"
:
[
school_area
]
}
school_income_res
=
report_finance_school_income_list_post
(
body
=
school_income_data
,
header
=
jyy_header
)
if
school_income_res
[
'data'
][
'list'
]
==
[]:
assert
school_income_res
[
'msg'
]
==
'成功'
assert
school_income_res
[
'code'
]
==
0
else
:
school_total_income
=
school_income_res
[
'data'
][
'list'
][
0
][
'totalIncome'
]
student_income_data
=
{
"keyword"
:
""
,
"studentStatus"
:
[
0
],
"classType"
:
[],
"grade"
:
[],
"subject"
:
[],
"termStr"
:
[
select_term
()],
"year"
:
[
select_year
()],
"pageSize"
:
10000
,
"pageNum"
:
1
,
"schoolArea"
:
[
school_area
]
}
stuincome_res
=
report_finance_student_income_list_post
(
header
=
jyy_header
,
body
=
student_income_data
)
student_totalincome_list
=
jsonpath
.
jsonpath
(
stuincome_res
,
"$.data.list..totalIncome"
)
total_student_income
=
round
(
sum
(
student_totalincome_list
),
2
)
assert
school_total_income
==
total_student_income
@allure.story
(
"校区收入-列表数据汇总"
)
def
test_school_income_total
(
self
):
#随机选择两个校区
school_area
=
random
.
sample
(
school_areas
,
1
)
school_income_data
=
{
"keyword"
:
""
,
"termStr"
:
[
select_term
()],
"year"
:
[
select_year
()],
"pageSize"
:
10
,
"pageNum"
:
1
,
"schoolArea"
:
school_area
}
school_income_res
=
report_finance_school_income_list_post
(
body
=
school_income_data
,
header
=
jyy_header
)
print
(
school_income_res
)
if
school_income_res
[
'data'
][
'list'
]
==
[]:
assert
school_income_res
[
'msg'
]
==
'成功'
assert
school_income_res
[
'code'
]
==
0
else
:
school_total_income
=
jsonpath
.
jsonpath
(
school_income_res
,
"$.data.list..totalIncome"
)
total_school_income
=
round
(
sum
(
school_total_income
,
2
))
print
(
total_school_income
)
student_income_data
=
{
"keyword"
:
""
,
"studentStatus"
:
[
0
],
"classType"
:
[],
"grade"
:
[],
"subject"
:
[],
"termStr"
:
[
select_term
()],
"year"
:
[
select_year
()],
"pageSize"
:
100000
,
"pageNum"
:
1
,
"schoolArea"
:
school_area
}
stuincome_res
=
report_finance_student_income_list_post
(
header
=
jyy_header
,
body
=
student_income_data
)
print
(
stuincome_res
)
student_totalincome_list
=
jsonpath
.
jsonpath
(
stuincome_res
,
"$.data.list..totalIncome"
)
total_student_income
=
round
(
sum
(
student_totalincome_list
),
2
)
print
(
total_student_income
)
assert
total_school_income
==
total_student_income
script/ji_yun_ying_pc/lanjiali_report/test_student_income.py
View file @
e6ceac59
...
@@ -15,7 +15,6 @@ class Test_student_income():
...
@@ -15,7 +15,6 @@ class Test_student_income():
@pytest.mark.parametrize
(
"keyword"
,
keywords
)
@pytest.mark.parametrize
(
"keyword"
,
keywords
)
def
test_keywords_select
(
self
,
keyword
):
def
test_keywords_select
(
self
,
keyword
):
keyword_value
=
keyword
.
get
(
"keyword"
)
keyword_value
=
keyword
.
get
(
"keyword"
)
print
(
keyword_value
)
keyword_type
=
keyword
.
get
(
"keyword_type"
)
keyword_type
=
keyword
.
get
(
"keyword_type"
)
data
=
{
data
=
{
"keyword"
:
keyword_value
,
"keyword"
:
keyword_value
,
...
@@ -49,8 +48,8 @@ class Test_student_income():
...
@@ -49,8 +48,8 @@ class Test_student_income():
result
=
public_asserts
.
assert_res_field_equal_value
(
studentphone_list
,
keyword_value
)
result
=
public_asserts
.
assert_res_field_equal_value
(
studentphone_list
,
keyword_value
)
pytest
.
assume
(
result
)
pytest
.
assume
(
result
)
@allure.story
(
"学生收入-年份查询"
)
@allure.story
(
"学生收入-
不同
年份查询"
)
@pytest.mark.parametrize
(
"year"
,
[
select_year
()]
)
@pytest.mark.parametrize
(
"year"
,
select_years
()
)
def
test_select_year
(
self
,
year
):
def
test_select_year
(
self
,
year
):
data
=
{
data
=
{
"keyword"
:
"蓝"
,
"keyword"
:
"蓝"
,
...
@@ -65,6 +64,9 @@ class Test_student_income():
...
@@ -65,6 +64,9 @@ class Test_student_income():
"schoolArea"
:
school_areas
[
0
:
30
]
"schoolArea"
:
school_areas
[
0
:
30
]
}
}
res
=
report_finance_student_income_list_post
(
header
=
jyy_header
,
body
=
data
)
res
=
report_finance_student_income_list_post
(
header
=
jyy_header
,
body
=
data
)
assert
res
[
'msg'
]
==
'成功'
assert
res
[
'code'
]
==
0
@allure.story
(
"学生收入-期段查询"
)
@allure.story
(
"学生收入-期段查询"
)
@pytest.mark.parametrize
(
"term"
,[
select_term
()])
@pytest.mark.parametrize
(
"term"
,[
select_term
()])
...
@@ -167,6 +169,32 @@ class Test_student_income():
...
@@ -167,6 +169,32 @@ class Test_student_income():
assert
res2
[
'data'
][
'pageNum'
]
==
2
assert
res2
[
'data'
][
'pageNum'
]
==
2
@allure.story
(
"学生收入-年级、学科、课型组合筛选"
)
@pytest.mark.parametrize
(
"keyword,student_statu,class_type,grade,subject,term,year"
,
[
(
"蓝"
,[
0
],
"极趣班"
,
grades
[
2
],
subjects
[
3
],
select_term
(),
select_year
()
)
]
)
def
test_all_selection
(
self
,
keyword
,
student_statu
,
class_type
,
grade
,
subject
,
term
,
year
):
data
=
{
"keyword"
:
keyword
,
"studentStatus"
:
student_statu
,
"classType"
:
[
class_type
],
"grade"
:
[
grade
],
"subject"
:
[
subject
],
"termStr"
:
[
term
],
"year"
:
[
year
],
"pageSize"
:
10
,
"pageNum"
:
1
,
"schoolArea"
:
school_areas
[
0
:
50
]
}
res
=
report_finance_student_income_list_post
(
header
=
jyy_header
,
body
=
data
)
assert
res
[
'msg'
]
==
'成功'
assert
res
[
'code'
]
==
0
...
...
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