Disclosure of Invention
Aiming at the defects of the prior art, the invention provides a method and a system for testing the report data statistical function, which finish the comparison of report data by AI image recognition, thereby quickly finishing the complex report statistical function test and saving a large amount of labor cost and time cost.
In order to achieve the purpose, the invention provides the following technical scheme:
on one hand, the report data statistical function test method is provided, and comprises the following steps:
s1, the production environment periodically backs up the incremental business data to generate an incremental business data report, and a snapshot generating script of the incremental business data report is executed to generate a production environment snapshot of the incremental business data report;
s2, the incremental business data report, the snapshot generating script thereof and the production environment snapshot are automatically deployed to the UAT environment specially used for the report data statistical function test at regular intervals;
s3, running and executing the snapshot generating script of the incremental business data report in the UAT environment to generate the UAT environment snapshot of the incremental business data report;
and S4, comparing the similarity of the production environment snapshot and the UAT environment snapshot of the incremental business data report, and outputting a comparison result.
Preferably, step S1 further includes: naming the production environment snapshot.
Preferably, step S2 further includes: and deploying the latest version and configuration of the BI system in the UAT environment.
Preferably, step S4 further includes: and when the comparison result shows that the similarity between the production environment snapshot and the UAT environment snapshot is more than or equal to 95%, the report data in the incremental business data report obtained through statistics is verified to be passed.
Preferably, in step S4, the AI image comparison tool is used to compare the similarity between the production environment snapshot of the incremental business data report and the UAT environment snapshot.
On the other hand, the report data statistical function testing system for realizing the report data statistical function testing method comprises the following steps:
the production environment database is used for periodically backing up the incremental business data and generating an incremental business data report;
the production environment snapshot generating unit is used for executing the snapshot generating script of the incremental business data report to generate the production environment snapshot of the incremental business data report and naming the production environment snapshot;
the UTA environment database is used for periodically receiving the incremental business data report and the snapshot generating script and the production environment snapshot thereof;
the UTA environment snapshot generating unit is used for running in the UAT environment and executing a snapshot generating script of the incremental business data report so as to generate the UAT environment snapshot of the incremental business data report;
and the snapshot comparison unit is used for carrying out similarity comparison on the production environment snapshot and the UAT environment snapshot of the incremental business data report and outputting a comparison result.
Preferably, the report data statistics function test system further includes: and the evaluation unit is used for indicating that the report data in the incremental business data report obtained by statistics passes verification when the comparison result shows that the similarity between the production environment snapshot and the UAT environment snapshot is more than or equal to 95%.
Compared with the prior art, the invention has the following beneficial effects:
according to the method, the similarity comparison is carried out on the production environment snapshot and the UAT environment snapshot of the incremental business data report in the UAT environment through the AIAI picture comparison tool, the report correctness comparison result can be rapidly obtained, whether the report data statistical function is good or not is judged, and the time and labor for testing the report data statistical function are greatly saved.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example 1:
as shown in fig. 1, the method for testing statistical function of report data in this embodiment includes the following steps:
s1, backing up incremental business data at regular intervals (such as every morning) by a production environment, generating an incremental business data report, executing a snapshot generating script of the incremental business data report through a BI system to generate production environment snapshots of the incremental business data report shown in FIG. 2, and naming the production environment snapshots, wherein each report corresponds to each other according to Pageid, so that a production environment snapshot naming rule is named according to PageidX _ table name _ date;
s2, the incremental business data report, the snapshot generating script thereof and the production environment snapshot are automatically deployed to the UAT environment specially used for the report data statistical function test at regular intervals;
meanwhile, as shown in fig. 3, a tester manually triggers the automatic issue script of the UAT environment through Jenkins automatic continuous integration to deploy the latest version and configuration of the BI system in the UAT environment;
s3, running and executing the snapshot generating script of the incremental business data report through a BI system in the UAT environment to generate the UAT environment snapshot of the incremental business data report;
s4, as shown in FIG. 4, comparing the similarity of the production environment snapshot of the incremental business data report and the UAT environment snapshot by an AI image comparison tool, and outputting a comparison result; for example, the colluding relationship of the incremental business data in the incremental business data report is verified and compared by using open-source python + pytest + alure + selenium and other languages;
and when the comparison result shows that the similarity between the production environment snapshot and the UAT environment snapshot is greater than or equal to 95 percent (preferably greater than or equal to 98 percent), the report data in the incremental business data report obtained by statistics is verified to be passed; for example, fig. 5 shows the similarity comparison results of three groups (i.e., ID1, ID2, and ID3) of production environment snapshots and UAT environment snapshots, which may be output in the form of charts such as bar charts, line charts, etc., where the similarities of ID1 to ID3 groups are 0.926, 0.975, and 0.824, respectively, and the Pass part represents the similarity, which indicates that the report data in the statistically obtained incremental business data report corresponding to ID1 and ID3 is not verified, the data correctness is poor, and further adjustment and processing are required, and the similarity of ID2 group is equal to about 98%, which indicates that the corresponding report data is verified, and the report data statistics function is good.
In this embodiment, because the UTA environment is completely consistent with the production environment and completely isolated from the production environment, after the incremental business data report is deployed in the UAT environment, the actual situation of report data can be reflected more truly, further, the production environment snapshot of the incremental business data report and the UAT environment snapshot are compared in similarity through an AIAI image comparison tool, and a comparison result of report correctness can be obtained quickly, so that whether the report data statistical function is good or not is judged, and time and labor for testing the report data statistical function are saved greatly.
Example 2:
this embodiment provides a report data statistics function test system for implementing the report data statistics function test method inembodiment 1, as shown in fig. 6, the report data statistics function test system includes:
aproduction environment database 1 configured in a production environment and used for backing up incremental business data periodically (such as every morning) and generating an incremental business data report;
a production environment snapshot generating unit 2 (such as a BI system) for executing a snapshot generating script of the incremental business data report to generate a production environment snapshot of the incremental business data report, and naming the production environment snapshot;
the UTAenvironment database 3 is configured in the UTA environment and is used for periodically receiving the incremental business data report and the snapshot generating script and the production environment snapshot thereof;
the UTA environment snapshot generating unit 4 (such as a BI system) is configured to run in a UAT environment and execute a snapshot generating script of the incremental business data report to generate a UAT environment snapshot of the incremental business data report;
asnapshot comparison unit 5, configured to perform similarity comparison on the production environment snapshot of the incremental business data report and the UAT environment snapshot, and output a comparison result;
and theevaluation unit 6 is used for indicating that report data in the incremental business data report obtained by statistics passes verification when the comparison result shows that the similarity between the production environment snapshot and the UAT environment snapshot is greater than or equal to 95% (preferably greater than or equal to 98%).
In summary, after the incremental business data report is deployed in the UAT environment, the similarity comparison between the production environment snapshot of the incremental business data report and the UAT environment snapshot is further performed by the AIAI picture comparison tool, so that the comparison result of the correctness of the report can be quickly obtained, whether the statistical function of the report data is good or not is judged, and the time and labor for testing the statistical function of the report data are greatly saved.
It should be noted that the technical features of theabove embodiments 1 to 3 can be arbitrarily combined, and the technical solutions obtained by combining the technical features belong to the scope of the present application. And in this document, terms such as "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that changes, modifications, substitutions and alterations can be made in these embodiments without departing from the principles and spirit of the invention, the scope of which is defined in the appended claims and their equivalents.