Automatic testing method and system based on data warehouse quality
Through the automated testing system in the field of smart home appliances, using unique identification tags and automated scripts, the problem of establishing and comparing the corresponding relationships between massive equipment raw data and data warehouse data has been solved, and efficient data quality monitoring and coverage improvement have been achieved.
Patent Information
- Application Number
- CN202410754371.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-12
- Publication Date
- 2024-10-08
AI Technical Summary
In the field of smart home appliances, there are currently challenges in how to establish a one-to-one correspondence between massive device raw data and data warehouse data, and complete comparisons through automated methods to ensure data quality.
Design an automated testing system based on data warehouse quality, including smart device MCU electronic control module, WiFi module, cloud platform, data platform and host computer testing software. The data is calibrated through unique identification and automated scripts are used to simulate manual operations. , to achieve data comparison and judgment of stored data quality.
It improves test coverage and efficiency, realizes automated testing of massive data, reduces manpower investment, and ensures data quality in the data warehouse.
Smart Images

Figure CN118747150A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of big data technology, and in particular to an automated testing method and system based on data warehouse quality. Background Art
[0002] Smart home appliances are becoming more and more popular among users. Based on the massive data of smart home appliance status, algorithm models are established to achieve intelligent frost, intelligent noise reduction, AI control, etc. The application of big data technology in the field of smart home appliances is becoming more and more extensive. Smart home appliances are no longer just using mobile phones to replace remote controls for remote control, but will integrate intelligent technology with basic fields to be more energy-efficient, environmentally friendly and comfortable. Therefore, the data quality in the data warehouse is particularly important. The original data of the equipment must be completely consistent with the data stored in the data warehouse. How to establish a one-to-one correspondence between massive original data of equipment and data warehouse data, and complete the comparison in an automated way, is the key problem to be solved at this stage. Summary of the invention
[0003] The purpose of the present invention is to provide an automated testing method and system based on data warehouse quality in order to solve the above problems. The present invention defines that some states need to be reported immediately and some states need to be reported at preset times for different business application scenarios of big data, so the number of data items in each data packet is different. The data is calibrated by a unique identification mark to obtain a one-to-one correspondence between the local parsing results and the data stored on the data platform; by comparing the parsing results at both ends, a conclusion is obtained as to whether the data is correct. At the same time, the automated script can automatically complete the entire process, improving test coverage and efficiency.
[0004] The present invention achieves the above-mentioned purpose through the following technical solutions:
[0005] An automated testing system based on data warehouse quality, including an intelligent device MCU electronic control module, a WiFi module, a cloud platform, a data platform, a host computer testing software, and an automated script;
[0006] The smart device MCU electronic control module is used to report device status data to the WiFi module in real time;
[0007] The WiFi module packages the received status data into data packet 1, data packet 2 ... data packet N according to the rule, and reports it to the cloud platform;
[0008] The cloud platform receives data packet 1, data packet 2, ... data packet N, splits and analyzes them, and pushes them to the data platform as a data source for big data applications;
[0009] The host computer test software monitors the key log text of the WiFi module, intercepts the original data reported by the WiFi module, stores it in a local file, and performs local analysis and interface presentation according to the communication protocol between the electronic control and the WiFi module;
[0010] The automation script is used to simulate the click function of manual operation in the host computer test software, obtain the comparison result by grabbing the key text information, record the execution result in the log file, and determine the quality of the data stored in the data warehouse by analyzing the log file.
[0011] A further solution is that data packet 1 contains data 11, data 12, data 13...data 1N, data packet 2 contains data 21, data 22, data 23...data 2N, ..., and data packet N contains data N1, data N2, data N3...data NN.
[0012] A further solution is that the MCU electronic control module of the smart device is connected to the WiFi module and remains online to ensure normal data transmission; the WiFi module reports the received hexadecimal electronic control status data to the cloud platform, and the cloud platform parses the hexadecimal electronic control status data into a readable json format, and pushes it to the data platform, and stores it in the data warehouse as a data source for big data business applications.
[0013] A further solution is that after receiving the data reported by the electronic control, the WiFi module adds a millisecond timestamp uid to each piece of data as a unique identifier for each piece of data to obtain a one-to-one correspondence with the data in the data warehouse.
[0014] A further solution is that the host computer test software makes an interface request to the data platform through the unique identifier uid, obtains the storage data corresponding to the data warehouse, compares the data warehouse storage data with the local data, and displays the comparison results visually.
[0015] A further solution is that the host computer test software functional module includes:
[0016] A: WiFi module data acquisition module, obtains complete device data packets by monitoring keywords in the print log;
[0017] B: storage module, used to store the collected data packets in local files;
[0018] C: Local parsing module, used to split the data packets stored in the local file according to the packet grouping rules, and parse each one into JSON format;
[0019] D: Data platform acquisition module, which sends a request to the data platform through the unique identifier uid of each data piece to obtain the storage result of the corresponding uid of the data platform;
[0020] E: Comparison module, which compares the data of modules C and D for consistency;
[0021] F: Display module, used to display the comparison results and give the judgment results of "pass" or "fail".
[0022] A further solution is that the log file of the automation script records the total amount of compared data N1, the total amount of consistent data N2, and the total amount of inconsistent data N3, and the data consistency rate is obtained by N2 / N1, and the data inconsistency rate is obtained by N3 / N1.
[0023] A further solution is to capture interface images and logs when data comparison is inconsistent for later analysis; configure the startup frequency of the automated test script, and obtain the data quality of all data in the preset time period by setting the startup frequency.
[0024] Another aspect of the present invention further provides an automated testing method based on data warehouse quality, comprising the following steps:
[0025] Step 1: Connect the smart device to the WiFi module and be online to ensure that data can be transmitted normally;
[0026] Step 2: The computer where the host test software is installed has a script running environment;
[0027] Step 3: Write the airtest script for web automated testing;
[0028] Step 4: Set up scheduled tasks, such as running an automated script every 2 hours to test the data packets collected during the 2-hour process; if you set the script to start at 2 o'clock, 4 o'clock, etc., then at 2 o'clock all data packets collected from 0 to 2 o'clock will be tested, and at 4 o'clock all data packets collected from 2 to 4 o'clock will be tested;
[0029] Step 5: Execute the automation script and write the running log to the log file;
[0030] Step 6: Automatically analyze the log file to obtain the data consistency test results.
[0031] A further solution is a test method for a scheduled task, comprising the following steps:
[0032] S1: When the scheduled task time arrives, the automation script is automatically started; the automation script simulates the human click operation and opens the host computer test software;
[0033] S2: Click data packet 1, click a piece of data, click the local analysis button, click the platform query button, and obtain whether the data has passed the identification through the key text on the interface;
[0034] S3: After obtaining the pass mark, click on the next piece of data for analysis and comparison;
[0035] S4: After getting the failed mark, take a screenshot of the failed page status and record the reason, then click on the next data.
[0036] S5: After all data in data package 1 have completed the comparison test, click data package 2 and cycle through the operations of S2-S4;
[0037] S6: When all data packets included in this scheduled task are verified, the test ends.
[0038] The beneficial effects of the present invention are:
[0039] The present invention provides an automated testing method and system based on data warehouse quality. By writing automated testing scripts, the click function of manual operation in the host computer testing software is simulated, key text information is captured to obtain comparison results, the execution results are recorded in a log file, and the quality of data stored in the data warehouse is determined by analyzing the log file. The present invention can be used for daily monitoring of data warehouse quality without human input, and mass data testing is realized, which not only improves testing efficiency, but also improves test coverage. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0041] Figure 1 This is a schematic diagram of the data reporting link of the present invention.
[0042] Figure 2 It is a principle diagram of data correspondence of the present invention.
[0043] Figure 3 This is a schematic diagram of data analysis principle of the host computer test software of the present invention.
[0044] Figure 4 It is a schematic diagram of the functional modules of the host computer test software of the present invention.
[0045] Figure 5 This is the schematic diagram of the automated testing principle of the present invention.
[0046] Figure 6 This is a flow chart of the automated testing of the present invention.
[0047] Figure 7 This is an automated test analysis diagram of the present invention. DETAILED DESCRIPTION
[0048] To make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be described in detail below. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other implementation methods obtained by ordinary technicians in this field without creative work belong to the scope of protection of the present invention.
[0049] In any embodiment, an automated testing system based on data warehouse quality of the present invention includes an intelligent device MCU electronic control module, a WiFi module, a cloud platform, a data platform, a host computer testing software, and an automated script;
[0050] like Figure 1 As shown, the MCU electronic control module of the smart device reports the device status data to the WiFi module in real time. The WiFi module packages the received status data into data packet 1, data packet 2...data packet N according to certain rules and reports them to the cloud platform. The cloud platform splits and parses the received data packets 1, data packet 2...data packet N and pushes them to the data platform as the data source for big data applications. According to different business application scenarios of big data, it is defined that some statuses need to be reported immediately and some statuses are reported at preset times, so the number of data in each data packet is different. Data packet 1 contains data 11, data 12, data 13...data 1N, data packet 2 contains data 21, data 22, data 23...data 2N, and data packet N contains data N1, data N2, data N3...data NN.
[0051] After the WiFi module receives the data reported by the electronic control, it adds a millisecond timestamp uid to each piece of data as the unique identifier of each piece of data to obtain a one-to-one correspondence with the data in the data warehouse; the host computer test software, on the one hand, monitors the key log text of the WiFi module, intercepts the original data reported by the WiFi module and stores it in a local file, and performs local parsing and interface presentation according to the communication protocol between the electronic control and the WiFi module; on the other hand, it makes an interface request to the data platform through the unique identifier uid to obtain the storage data corresponding to the data warehouse, and compares the data warehouse storage data with the local data. The comparison result is the key indicator of the data quality of the data warehouse. The automated script simulates the manual click function in the host computer test software, obtains the comparison result by grabbing the key text information, records the execution result in the log file, and determines the quality of the massive data warehouse storage data by analyzing the log file. It not only improves the test efficiency, but also improves the test coverage.
[0052] like Figure 2As shown, when the WiFi module packages and reports the data reported by the MCU, an identifier uid is added to each piece of data in the reported content as the unique identifier of this piece of data. Each piece of data in each data packet carries this non-repeating uid unique identifier; each piece of data pushed to the data platform after cloud parsing also carries this uid identifier.
[0053] The uid is a millisecond timestamp to ensure the uniqueness of the uid. At the same time, this uid is the network time to avoid the error of the local timing of the WiFi module and ensure the accuracy of the timestamp.
[0054] like Figure 3 As shown, the content of data packet 1 reported by the WiFi module includes a start identifier + uid11' data 11 + uid12' data 12 ... + uid1N' data 1N + end identifier, the content of data packet 2 includes a start identifier + uid21' data 21 + uid22' data 22 ... + uid data 2N + end identifier, and the content of data packet N includes a start identifier + uidN1' data N1 + uidN2' data N2 ... + uidNN' data NN + end identifier. The PC-side host computer test software establishes a connection with the WiFi module through the serial port, monitors the WiFi module to print logs, and when the key text (start identifier + end identifier) is monitored to be printed, the log segment is intercepted and saved in a local file. The local file names are data packet 1, data packet 2 ... data packet N.
[0055] The main page of the host computer test software displays the original data of the selected data packet. For example, the original data of data packet 1 is start identifier + uid11' data 11 + uid12' data 12… + uid1N' data 1N + end identifier. According to the packet grouping rule, the original data is split into uid11' data 11 + uid12' data 12… + uid1N' data 1N. Select one of the data, such as uid11' data 11, and click the "Local Parse" button. According to the communication protocol between the electronic control and the WiFi module, the hexadecimal data is parsed into a readable json format and presented in the "Local Data Parsing Results" page.
[0056] The data platform provides a query interface for stored data. The main page of the host computer test software includes an entry button "Platform Query" for obtaining data stored on the data platform. Click "Platform Query" to query the storage results of data 11 on the data platform through the unique identifier uid11'. And it is presented in the page "Platform Data Analysis Results".
[0057] The host computer test software compares each field in the "local data analysis results" and "platform data analysis results" and marks the comparison results, "consistent" and "inconsistent". When at least one field comparison result in a piece of data is "inconsistent", the interface gives a "failed" mark; when all field comparison results in a piece of data are consistent, the interface gives a "passed" mark.
[0058] like Figure 4 As shown in the figure, the upper computer test software functional module diagram includes:
[0059] A: The WiFi module data acquisition module mainly obtains the complete device data packet by monitoring the keywords in the print log.
[0060] B: Storage module, mainly used to store the collected data packets in local files.
[0061] C: Local parsing module, used to split the data packets stored in the local file according to the packet grouping rules and parse each one into JSON format.
[0062] D: Data platform acquisition module, mainly sends requests to the data platform through the unique identifier uid of each data, and obtains the storage results of the data platform corresponding to the uid.
[0063] E: Comparison module, which compares the data of modules C and D for consistency.
[0064] F: Display module, used to display the comparison results and give the judgment results of "pass" or "fail".
[0065] The above host computer test software can test the correctness of the data stored in the data platform. Due to the large amount of data, manually clicking each piece of data in each data packet to obtain the test results is undoubtedly a huge workload, so an automated testing method is bound to be needed to replace human operations.
[0066] like Figure 5 As shown, automated testing includes:
[0067] Step 1: Connect the smart device to the WiFi module and be online to ensure that data can be transmitted normally.
[0068] Step 2: The computer where the host test software is installed has a script running environment.
[0069] Step 3: Write the airtest script for web automated testing.
[0070] Step 4: Set up a scheduled task, such as running an automated script every 2 hours to test the data packets collected during the 2-hour period. If you set the script to start running at 2 o'clock, 4 o'clock, etc., then at 2 o'clock all data packets collected from 0 to 2 o'clock will be tested, and at 4 o'clock all data packets collected from 2 to 4 o'clock will be tested.
[0071] Step 5: Execute the automation script and write the running log to the log file.
[0072] Step 6: Automatically analyze the log file to obtain the data consistency test results.
[0073] like Figure 6 As shown, the automated testing process includes:
[0074] S1: When the scheduled task time arrives, the automation script is automatically started. The automation script simulates human click operation and opens the host computer test software.
[0075] S2: Click data packet 1, click a piece of data, click the local analysis button, click the platform query button, and obtain whether the data has passed the identification through the key text on the interface.
[0076] S3: After obtaining the pass mark, click on the next piece of data for analysis and comparison;
[0077] S4: After getting the failed mark, take a screenshot of the failed page status and record the reason, then click on the next data.
[0078] S5: When all data in data package 1 have completed the comparison test, click data package 2 and cycle through the operations of S2-S4.
[0079] S6: When all data packets included in this scheduled task are verified, the test ends.
[0080] like Figure 7 As shown, the automated test analysis process includes:
[0081] First: Set up a scheduled task, and set the start frequency to custom data. Testers can define different start frequencies based on different needs. For example, run an automated script every 2 hours to test the data packets collected during the 2-hour process. If you set the script to start at 2 o'clock, 4 o'clock, etc., then at 2 o'clock, all data packets collected from 0 to 2 o'clock will be tested, and at 4 o'clock, all data packets collected from 2 to 4 o'clock will be tested.
[0082] Secondly: Run and complete the automated script. After completing a data comparison, the total number of comparisons N1 will be recorded in the log file. Each time a data comparison is completed, the total number will increase by 1. Consistency and inconsistency are judged by matching the key text content. If the data is consistent, the number of consistent data N2 will be recorded in the log file. Each time a consistent data comparison is completed, the number of consistent data N2 will increase by 1; if the data is inconsistent, the number of inconsistent data N3 will be recorded in the log file. Each time a inconsistent data comparison is completed, the number of inconsistent data N3 will increase by 1.
[0083] Finally: Analyze the data quality of the data warehouse based on the data recorded in the log file. Consistency rate = N2 / N1, inconsistency rate = N3 / N1. For inconsistent data, we will analyze it based on each inconsistent screenshot and log to find out the cause of the inconsistency, and optimize or improve the data flow, parsing method, etc.
[0084] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or replacements within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims. It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present invention will not further explain various possible combinations. In addition, the various different embodiments of the present invention can also be combined arbitrarily, as long as they do not violate the concept of the present invention, they should also be regarded as the contents disclosed by the present invention.
Claims
1. An automated testing system based on data warehouse quality, characterized in that: Including smart device MCU electronic control module, WiFi module, cloud platform, data platform, host computer test software, and automation script; The smart device MCU electronic control module is used to report device status data to the WiFi module in real time; The WiFi module packages the received status data into data packet 1, data packet 2 ... data packet N according to the rule, and reports it to the cloud platform; The cloud platform receives data packet 1, data packet 2, ... data packet N, splits and analyzes them, and pushes them to the data platform as a data source for big data applications; The host computer test software monitors the key log text of the WiFi module, intercepts the original data reported by the WiFi module, stores it in a local file, and performs local analysis and interface presentation according to the communication protocol between the electronic control and the WiFi module; The automation script is used to simulate the click function of manual operation in the host computer test software, obtain the comparison result by grabbing the key text information, record the execution result in the log file, and determine the quality of the data stored in the data warehouse by analyzing the log file.
2. The automated testing system based on data warehouse quality as claimed in claim 1, characterized in that: The data packet 1 contains data 11, data 12, data 13 ... data 1N, the data packet 2 contains data 21, data 22, data 23 ... data 2N, ..., and the data packet N contains data N1, data N2, data N3 ... data NN.
3. The automated testing system based on data warehouse quality as claimed in claim 1, characterized in that: The MCU electronic control module of the smart device is connected to the WiFi module and remains online to ensure normal data transmission; the WiFi module reports the received hexadecimal electronic control status data to the cloud platform, and the cloud platform parses the hexadecimal electronic control status data into a readable json format, pushes it to the data platform, and stores it in the data warehouse as a data source for big data business applications.
4. The automated testing system based on data warehouse quality as claimed in claim 1, characterized in that: After receiving the data reported by the electronic control, the WiFi module adds a millisecond timestamp uid to each piece of data as a unique identifier for each piece of data to obtain a one-to-one correspondence with the data in the data warehouse.
5. The automated testing system based on data warehouse quality as claimed in claim 1, characterized in that: The host computer test software makes an interface request to the data platform through the unique identifier UID, obtains the storage data corresponding to the data warehouse, compares the data warehouse storage data with the local data, and visualizes the comparison results.
6. The automated testing system based on data warehouse quality as claimed in claim 1, characterized in that: The host computer test software functional modules include: A: WiFi module data acquisition module, obtains complete device data packets by monitoring keywords in the print log; B: storage module, used to store the collected data packets in local files; C: Local parsing module, used to split the data packets stored in the local file according to the packet grouping rules, and parse each one into JSON format; D: Data platform acquisition module, which sends a request to the data platform through the unique identifier uid of each data piece, and obtains the storage result of the corresponding uid of the data platform; E: Comparison module, which compares the data of modules C and D for consistency; F: Display module, used to display the comparison results and give the judgment results of "pass" or "fail".
7. The automated testing system based on data warehouse quality as claimed in claim 1, characterized in that: The log file of the automation script records the total amount of compared data N1, the total amount of consistent data N2, and the total amount of inconsistent data N3. The data consistency rate is obtained by N2 / N1, and the data inconsistency rate is obtained by N3 / N1.
8. The automated testing system based on data warehouse quality as claimed in claim 7, characterized in that: When data comparison is inconsistent, capture interface images and logs for later analysis; configure the startup frequency of the automated test script to obtain the data quality of all data in the preset time period by setting the startup frequency.
9. An automated testing method based on data warehouse quality, characterized in that: The following steps are involved: Step 1: Connect the smart device to the WiFi module and be online to ensure that data can be transmitted normally; Step 2: The computer where the host test software is installed has a script running environment; Step 3: Write the airtest script for web automated testing; Step 4: Set up a scheduled task and test the data packets collected during the scheduled task; Step 5: Execute the automation script and write the running log to the log file; Step 6: Automatically analyze the log file to obtain the data consistency test results.
10. The automated testing method based on data warehouse quality according to claim 9, characterized in that: The test method of the scheduled task includes the following steps: S1: When the scheduled task time arrives, the automation script is automatically started; the automation script simulates the human click operation and opens the host computer test software; S2: Click data packet 1, click a piece of data, click the local analysis button, click the platform query button, and obtain whether the data has passed the identification through the key text on the interface; S3: After obtaining the pass mark, click on the next piece of data for analysis and comparison; S4: After getting the failed mark, take a screenshot of the failed page status and record the reason, then click on the next data. S5: After all data in data package 1 have completed the comparison test, click data package 2 and cycle through the operations of S2-S4; S6: When all data packets included in this scheduled task are verified, the test ends.
