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
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
246 additions
and
14 deletions
+246
-14
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
+12
-2
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
-0
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 @@
<select
/>
</component>
<component
name=
"ChangeListManager"
>
<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"
/>
<list
default=
"true"
id=
"54f4d37d-1724-4813-a1e2-24e200088c5f"
name=
"Default Changelist"
comment=
"学生收入查询"
>
<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$/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_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>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
...
...
@@ -272,7 +272,14 @@
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1619776864150
</updated>
</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
/>
</component>
<component
name=
"Vcs.Log.Tabs.Properties"
>
...
...
@@ -297,6 +304,7 @@
<MESSAGE
value=
"校区费用预警查询"
/>
<MESSAGE
value=
"学生费用预警查询-分页"
/>
<MESSAGE
value=
"校区费用预警-查询"
/>
<option
name=
"LAST_COMMIT_MESSAGE"
value=
"校区费用预警-查询"
/>
<MESSAGE
value=
"学生收入查询"
/>
<option
name=
"LAST_COMMIT_MESSAGE"
value=
"学生收入查询"
/>
</component>
</project>
\ No newline at end of file
run.py
View file @
e6ceac59
...
...
@@ -3,7 +3,7 @@ import os
if
__name__
==
'__main__'
:
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"
,
"--host"
,
"http://192.168.32.31"
,
"--account"
,
"b"
,
...
...
script/ji_yun_ying_pc/lanjiali_report/data_config/report_config.py
View file @
e6ceac59
...
...
@@ -143,4 +143,14 @@ income_student_status = [
"statu"
:
3
,
"statu_type"
:
[
'结业'
]
}
]
\ No newline at end of file
]
#校区搜索
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:
result
=
public_asserts
.
assert_res_field_equal_value
(
studentphone_list
,
keyword_value
)
pytest
.
assume
(
result
)
@allure.story
(
"学生费用预警查询-年份筛选"
)
@pytest.mark.parametrize
(
"year"
,
[
select_year
()]
)
@allure.story
(
"学生费用预警查询-
不同
年份筛选"
)
@pytest.mark.parametrize
(
"year"
,
select_years
()
)
def
test_year_screen
(
self
,
year
):
data
=
{
"pageNum"
:
1
,
...
...
script/ji_yun_ying_pc/lanjiali_report/test_school_expense.py
deleted
100644 → 0
View file @
386fc4c7
This diff is collapsed.
Click to expand it.
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():
@pytest.mark.parametrize
(
"keyword"
,
keywords
)
def
test_keywords_select
(
self
,
keyword
):
keyword_value
=
keyword
.
get
(
"keyword"
)
print
(
keyword_value
)
keyword_type
=
keyword
.
get
(
"keyword_type"
)
data
=
{
"keyword"
:
keyword_value
,
...
...
@@ -49,8 +48,8 @@ class Test_student_income():
result
=
public_asserts
.
assert_res_field_equal_value
(
studentphone_list
,
keyword_value
)
pytest
.
assume
(
result
)
@allure.story
(
"学生收入-年份查询"
)
@pytest.mark.parametrize
(
"year"
,
[
select_year
()]
)
@allure.story
(
"学生收入-
不同
年份查询"
)
@pytest.mark.parametrize
(
"year"
,
select_years
()
)
def
test_select_year
(
self
,
year
):
data
=
{
"keyword"
:
"蓝"
,
...
...
@@ -65,6 +64,9 @@ class Test_student_income():
"schoolArea"
:
school_areas
[
0
:
30
]
}
res
=
report_finance_student_income_list_post
(
header
=
jyy_header
,
body
=
data
)
assert
res
[
'msg'
]
==
'成功'
assert
res
[
'code'
]
==
0
@allure.story
(
"学生收入-期段查询"
)
@pytest.mark.parametrize
(
"term"
,[
select_term
()])
...
...
@@ -167,6 +169,32 @@ class Test_student_income():
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