Commit e6ceac59 authored by lanjiali's avatar lanjiali

校区收入查询

parent 386fc4c7
...@@ -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
...@@ -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_student_income.py", "-s", "./script/ji_yun_ying_pc/lanjiali_report/test_school_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",
......
...@@ -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
...@@ -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,
......
# 报表-校区收入查询
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
...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment