Test for KPIs
Last updated
Last updated
By using Pytest Framework : we followed to get the output data from the database and implemented the business logic, and verifying the final result matched to the expected outcome
Step 1: Prepare input JSON files for each program(student_attendance, teacher_attendance, etc..) which have all the dimensions needed for a particular program along with its values and along with its metric with min and max values.
Step 2: Use the grammar file required for the program (student_attendance, teacher_attendance, etc..) in order to extract the time dimension, dimensions, and metrics.
Step 3: Get the required time dimension and dimensions from the grammar file
Step 4: Get the required metrics from the config file
Step 5: For each metric in the program, generate the test data along with the required dimension columns specified in the config file.
Step 6: Split the generated test data of each metric according to different time_lines (daily, weekly, monthly, yearly) for each dimension key-metric aggregate value combination, to use it as the expected data (which should be filled up through manual calculation).
Step 7: Ingest the test data into the cube server and get the processed data in the database, which is the actual data file.
Step 8: Fill in the aggregate values for expected data manually.
Step 9: Compare the actual data with the expected data and generate the HTML test results.