SpreadJS visual report automation testing method and device

By using the SpreadJS visual report automation testing method based on the pytest automation testing framework and cell indexing technology, the problems of high cost and inaccurate positioning of manual testing are solved, and efficient test coverage and report generation are achieved.

CN115757111BActive Publication Date: 2026-06-19AISINO CORPORATION

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
AISINO CORPORATION
Filing Date
2022-11-11
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

Testing SpreadJS visual reports suffers from high manual costs, high error rates, incomplete test scenario coverage, inaccurate cell positioning and high failure rates in traditional automated testing, and difficulties in troubleshooting.

Method used

Using scripts based on the pytest automated testing framework, combined with Selenium/webDriver drivers, data adapters, and cell indexing and positioning technology, automated test scripts are written to achieve structured management of test data and rapid positioning of cell positions, generating test reports.

Benefits of technology

It reduced labor costs and operational error rates, improved testing efficiency, achieved uninterrupted test coverage, and enhanced the automation level of testing work.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115757111B_ABST
    Figure CN115757111B_ABST
Patent Text Reader

Abstract

The application discloses a SpreadJS visual report automatic testing method and device. The method comprises the following steps: S1, writing a test case of a SpreadJS visual report; S2, writing an automatic testing script based on a pytest testing framework; S3, executing the test case through the automatic testing script to generate a test report; through a data adapter, mapping relationships are established between data of different data sources of the SpreadJS visual report, corresponding reports and report cells according to certain levels and orders, and a cell index positioning method is used to quickly locate a cell position. The application can reduce labor cost and operation error rate, realize uninterrupted testing, improve testing efficiency, and solve the problems of inaccurate positioning of report cells, high failure rate of execution and the like in a traditional automatic testing scheme.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of software testing, and more specifically, relates to a SpreadJS visual report automated testing method and apparatus. Background Technology

[0002] SpreadJS visual reports are highly similar to Excel in terms of interface and functionality, with flexible report formats and support for reports with large data volumes and complex business rules.

[0003] Report testers need to be familiar with the business, including business processes, rules, and data storage, when testing reports. They also need to understand the algorithm and data source of each metric, as well as the relationship between specific business actions and metrics. Finally, they need to prepare test data and verify its correctness. During requirement changes or daily version iterations, if report testing is conducted manually, regression testing costs are high and it is difficult to maximize the coverage of test scenarios. Therefore, current testing of SpreadJS visual reports suffers from problems such as high manual costs and error rates, inability to maximize test scenario coverage, inaccurate cell positioning in traditional automated testing solutions, high failure rates, and difficulty in troubleshooting failed test cases. Summary of the Invention

[0004] The purpose of this invention is to propose an automated testing method and device for SpreadJS visual reports, which enables uninterrupted testing, improves testing efficiency, and reduces labor costs and operational error rates.

[0005] In a first aspect, this invention proposes an automated testing method for SpreadJS visual reports, including:

[0006] S1: Write test cases for SpreadJS visualization reports;

[0007] The test cases include test data for the SpreadJS visualization report. The test data is structured, categorized according to different data sources, and stored in corresponding databases and configuration files.

[0008] S2: Write automated test scripts based on the pytest testing framework;

[0009] The automated test script is configured as follows:

[0010] After logging into the user system, the user is taken to the SpreadJS visualization report page, where the SpreadJS plugin is loaded and the test data for the test cases is obtained.

[0011] The test data is calculated to generate a visual report;

[0012] Obtain the expected data corresponding to the actual output data of the visualization report through the data adapter;

[0013] The actual output data is compared with the expected data;

[0014] Once the comparison results are satisfactory, a test report will be generated.

[0015] S3: Execute the automated test script to test the SpreadJS visualization report and generate a test report.

[0016] Optionally, in S1, the test data includes:

[0017] The data includes the backend database, interface calculations, inter-table and intra-table formula calculations, and data manually adjusted by the user.

[0018] Optionally, in S2, writing automated test scripts based on the pytest testing framework includes:

[0019] Based on the pytest testing framework, the Selenium / webDriver driver, logging, caching, data extraction and transformation, configuration file reading and writing, data adapter, simulated keyboard and mouse operations, image recognition, and test report generation are encapsulated to obtain the automated test script.

[0020] Optionally, in step S2, the automated test script's calculation of the test data specifically includes:

[0021] The test data is obtained and displayed through the SpreadJS plugin, and the test data is automatically calculated using report formulas.

[0022] When the test data includes data that the user manually adjusts, the GC.Spread.Sheets.findControl() method is used to obtain a SpreadJS object. The cell index is used to quickly locate the position of each cell containing the data that the user needs to manually adjust, and the data in each cell is manually adjusted. After the manual adjustment is completed, the data in the cells that are not manually adjusted is recalculated.

[0023] Optionally, in step S2, the automated test script comparing the actual data with the expected data specifically includes:

[0024] The SpreadJS object is obtained through the GC.Spread.Sheets.findControl() method, and each cell is located by its cell index to obtain the actual output data for each cell.

[0025] The test data is extracted and transformed by the data adapter to obtain the expected data, and then transformed into the specified format of the pytest testing framework. The expected data of each cell is obtained by establishing a mapping relationship between the expected data and each cell in the corresponding report page.

[0026] By asserting that the actual output data of each cell is compared with the expected data, it can be determined that the test case has been successfully executed.

[0027] In a second aspect, the present invention provides an electronic device comprising:

[0028] At least one processor; and,

[0029] A memory communicatively connected to the at least one processor; wherein,

[0030] The memory stores instructions that can be executed by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform any of the SpreadJS visual report automation testing methods described in the first aspect.

[0031] Thirdly, the present invention provides a non-transitory computer-readable storage medium that stores computer instructions for causing a computer to execute the SpreadJS visual report automation testing method as described in any of the first aspects of the invention.

[0032] Fourthly, this invention proposes an automated testing device for SpreadJS visual reports, comprising: a test case writing module for writing test cases for SpreadJS visual reports;

[0033] The test cases include test data for the SpreadJS visualization report. The test data is structured, categorized according to different data sources, and stored in corresponding databases and configuration files.

[0034] The test script creation module is used to write automated test scripts based on the pytest testing framework;

[0035] The automated test script is configured as follows:

[0036] After logging into the user system, the user is taken to the SpreadJS visualization report page, where the SpreadJS plugin is loaded and the test data for the test cases is obtained.

[0037] The test data is calculated to generate a visual report;

[0038] Obtain the expected data corresponding to the actual output data of the visualization report through the data adapter;

[0039] The actual output data is compared with the expected data;

[0040] Once the comparison results are satisfactory, a test report will be generated.

[0041] The automated testing module is used to execute the automated test scripts to test the SpreadJS visualization report and generate a test report.

[0042] Optionally, the test data includes:

[0043] The data includes the backend database, interface calculations, inter-table and intra-table formula calculations, and data manually adjusted by the user.

[0044] Optionally, the method for the test script creation module to write automated test scripts based on the pytest testing framework includes:

[0045] Based on the pytest testing framework, the Selenium / webDriver driver, logging, caching, data extraction and transformation, configuration file reading and writing, data adapter, simulated keyboard and mouse operations, image recognition, and test report generation are encapsulated to obtain the automated test script.

[0046] Other features and advantages of the present invention will be described in detail in the following detailed description section.

[0047] The beneficial effects of this invention are as follows: This invention establishes a mapping relationship between data from different data sources in the SpreadJS visualization report and their corresponding reports and report cells according to a certain hierarchy and order through a data adapter. Then, it quickly locates the cell position using cell indexing, thereby solving the problems of repetitive work and errors during manual report testing, as well as inaccurate cell positioning, high failure rates, and difficulty in troubleshooting failed test cases in traditional automated testing solutions. The script of this invention is based on the pytest automated testing framework. On this framework, common components such as Selenium / webDriver drivers, data extraction and transformation, and data adapters are encapsulated, making it easy for testers to write and maintain scripts, greatly reducing labor costs and operational error rates, and solving the problem of high labor costs. The testing method of this invention can achieve uninterrupted operation, improving testing efficiency.

[0048] The system of the present invention has other features and advantages that will be apparent from or will be set forth in detail in the accompanying drawings and following detailed description, which together serve to explain the particular principles of the invention. Attached Figure Description

[0049] The above and other objects, features and advantages of the present invention will become more apparent from the more detailed description of exemplary embodiments of the invention in conjunction with the accompanying drawings, wherein the same reference numerals generally represent the same components in the exemplary embodiments of the invention.

[0050] Figure 1 A flowchart illustrating the steps of the SpreadJS visual report automation testing method according to Embodiment 1 of the present invention is shown.

[0051] Figure 2 A test flowchart of an automated test script based on the pytest testing framework according to Embodiment 1 of the present invention is shown. Detailed Implementation

[0052] Preferred embodiments of the invention will now be described in more detail. While preferred embodiments of the invention are described below, it should be understood that the invention can be implemented in various forms and should not be limited to the embodiments set forth herein.

[0053] Example 1

[0054] like Figure 1 As shown, this embodiment proposes an automated testing method for SpreadJS visual reports, including:

[0055] S1: Write test cases for SpreadJS visualization reports;

[0056] The test cases include test data for SpreadJS visualization reports. The test data is structured, categorized according to different data sources, and stored in the corresponding database and configuration files.

[0057] Specifically, in this step, the test case data comes from the data in the SpreadJS visualization report. Since the data in the SpreadJS visualization report mainly comes from the backend database, interface calculations, inter-table and intra-table formula calculations, and data manually adjusted by the user, in order to ensure that the test data covers all dimensions and all indicators of the report, we classify the automated test data in a structured manner according to different data sources and store it in a relational database and configuration file.

[0058] S2: Write automated test scripts based on the pytest testing framework;

[0059] like Figure 2 As shown, the automated test script is configured as follows:

[0060] Log in to the system using an automated test script and access the report page, then load the SpreadJS plugin to retrieve test data;

[0061] Calculate the test data, generate a visual report, and obtain the actual output data of the visual report;

[0062] Obtain the expected data corresponding to the actual output data of the visualization report through the data adapter;

[0063] Compare the actual output data with the expected data;

[0064] Once the comparison results are satisfactory, a test report will be generated.

[0065] Specifically, in this step, the SpreadJS visual report automated test script is written based on the pytest automated test framework. On this test framework, common content such as Selenium / webDriver driver, logging, caching, data extraction and transformation, configuration file reading and writing, data adapter, simulated keyboard and mouse operation, image recognition, and test report generation are encapsulated, which makes it easier for testers to write and maintain scripts and greatly improves the efficiency of testing work.

[0066] Specifically, in this step, the automated test script is configured to log in to the user system via the script, enter the report page, load the SpreadJS plugin, obtain and display test data through the SpreadJS plugin, and automatically calculate the test data through the report formula to obtain the actual output data;

[0067] When the test data includes data that the user manually adjusts, the GC.Spread.Sheets.findControl() method is used to obtain a SpreadJS object. The cell index is then used to quickly locate the position of each cell containing the data that the user needs to manually adjust. This allows for the setting of each cell. Then, the data in each cell is manually adjusted. After the manual adjustment is complete, the data in the cells that were not manually adjusted is recalculated to obtain accurate actual output data. Using the cell index positioning method to quickly locate cell positions avoids the difficulty and inaccuracy of traditional coordinate positioning methods, which can lead to test failures.

[0068] Specifically, in this step, the automated test script is configured to obtain a SpreadJS object through the GC.Spread.Sheets.findControl() method, locate each cell by cell index, and obtain the actual output data of each cell;

[0069] The test data is extracted and transformed using a data adapter to obtain the expected data, which is then converted into the specified format of the pytest testing framework. By establishing a mapping relationship between the expected data and each cell in its corresponding report page, the expected data for each cell is obtained. SpreadJS visualization reports are complex, with many reports and diverse data sources. The data adapter establishes a mapping relationship between the data from different data sources in SpreadJS visualization reports and their corresponding reports and report cells in a certain hierarchy and order, reducing the complexity of script writing and making it easier to maintain.

[0070] Finally, by comparing the actual output data of each cell with the expected data using assertions, it can be determined that the test case was successfully executed.

[0071] S3: Execute the test cases using the automated test script to generate a test report.

[0072] Example 2

[0073] This disclosure also provides an electronic device, which includes:

[0074] At least one processor; and,

[0075] A memory communicatively connected to the at least one processor; wherein,

[0076] The memory stores instructions that can be executed by the at least one processor, which enables the at least one processor to execute the SpreadJS visual report automation testing method described in Embodiment 1.

[0077] An electronic device according to embodiments of the present disclosure includes a memory and a processor. The memory is used to store non-transitory computer-readable instructions. Specifically, the memory may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may, for example, include random access memory (RAM) and / or cache memory. The non-volatile memory may, for example, include read-only memory (ROM), hard disk, flash memory, etc.

[0078] The processor may be a central processing unit (CPU) or other form of processing unit with data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device to perform desired functions. In one embodiment of this disclosure, the processor is used to execute computer-readable instructions stored in the memory.

[0079] Those skilled in the art will understand that, in order to solve the technical problem of how to achieve a good user experience, this embodiment may also include well-known structures such as communication buses and interfaces, and these well-known structures should also be included within the protection scope of this disclosure.

[0080] For a detailed description of this embodiment, please refer to the corresponding descriptions in the foregoing embodiments, which will not be repeated here.

[0081] Example 3

[0082] This disclosure provides a non-transitory computer-readable storage medium that stores computer instructions for causing a computer to execute the SpreadJS visual report automation testing method in Embodiment 1.

[0083] A computer-readable storage medium according to embodiments of the present disclosure stores non-transitory computer-readable instructions. When these non-transitory computer-readable instructions are executed by a processor, all or part of the steps of the methods described in the foregoing embodiments of the present disclosure are performed.

[0084] The aforementioned computer-readable storage media include, but are not limited to: optical storage media (e.g., CD-ROM and DVD), magneto-optical storage media (e.g., MO), magnetic storage media (e.g., magnetic tape or portable hard drive), media with built-in rewritable non-volatile memory (e.g., memory card), and media with built-in ROM (e.g., ROM cartridge).

[0085] Example 4

[0086] This invention proposes an automated testing device for SpreadJS visual reports, comprising:

[0087] The test case writing module is used to write test cases for SpreadJS visual reports;

[0088] The test cases include test data for SpreadJS visualization reports. To ensure that the test data covers all dimensions and all metrics of the report, the test data is structured, classified according to different data sources, and stored in the corresponding database and configuration files.

[0089] The test script creation module is used to write automated test scripts based on the pytest testing framework;

[0090] The automated test script is configured as follows:

[0091] After logging into the user system via the automated test script, the user is taken to the SpreadJS visualization report page, where the SpreadJS plugin is loaded and test data for the test cases is obtained.

[0092] Calculate the test data, generate a visual report, and obtain the actual output data of the visual report;

[0093] Obtain the expected data corresponding to the actual output data of the visualization report through the data adapter;

[0094] The actual output data is compared with the expected data by assertion;

[0095] Once the comparison results are satisfactory, a test report will be generated.

[0096] The automated testing module is used to execute automated test scripts to test SpreadJS visual reports and generate test reports.

[0097] Specifically, the test data includes:

[0098] The data includes the backend database, interface calculations, inter-table and intra-table formula calculations, and data manually adjusted by the user.

[0099] Specifically, the methods for writing automated test scripts based on the pytest testing framework in the test script creation module include:

[0100] Based on the pytest testing framework, the Selenium / webDriver driver, logging, caching, data extraction and transformation, configuration file reading and writing, data adapter, simulated keyboard and mouse operations, image recognition, and test report generation are encapsulated to obtain automated test scripts.

[0101] The various embodiments of the present invention have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments.

Claims

1. A method for SpreadJS visual report automation testing, the method comprising: include: S1: Write test cases for SpreadJS visualization reports; The test cases include test data for the SpreadJS visualization report. The test data is structured, categorized according to different data sources, and stored in corresponding databases and configuration files. The test data includes data from the backend database, interface calculations, inter-table and intra-table formula calculations, and data manually adjusted by the user. S2: Writing automated test scripts based on the pytest testing framework includes: on the basis of the pytest testing framework, encapsulating the Selenium / webDriver driver, logging, caching, data extraction and transformation, configuration file reading and writing, data adapter, simulated keyboard and mouse operations, image recognition and test report generation, and obtaining the automated test script; The automated test script is configured as follows: After logging into the user system, the user is taken to the SpreadJS visualization report page, where the SpreadJS plugin is loaded and the test data for the test cases is obtained. The test data is calculated to generate a visual report; Obtain the expected data corresponding to the actual output data of the visualization report through the data adapter; The actual output data is compared with the expected data; Once the comparison results are satisfactory, a test report will be generated. Specifically, the automated test script performs the following calculations on the test data: The test data is obtained and displayed through the SpreadJS plugin, and the test data is automatically calculated using report formulas. When the test data includes data that the user manually adjusts, the GC.Spread.Sheets.findControl() method is used to obtain a SpreadJS object. The cell index is used to quickly locate the cell where the data that the user needs to manually adjust is located, and the data in each cell is manually adjusted. After the manual adjustment is completed, the data in the cells that are not manually adjusted is recalculated. S3: Execute the automated test script to test the SpreadJS visualization report and generate a test report.

2. The SpreadJS visual report automation testing method of claim 1, wherein, In step S2, the automated test script compares the actual output data with the expected data, specifically including: The SpreadJS object is obtained through the GC.Spread.Sheets.findControl() method, and each cell is located by its cell index to obtain the actual output data for each cell. The test data is extracted and transformed by the data adapter to obtain the expected data, and then transformed into the specified format of the pytest testing framework. The expected data of each cell is obtained by establishing a mapping relationship between the expected data and each cell in the corresponding report page. By asserting that the actual output data of each cell is compared with the expected data, it can be determined that the test case has been successfully executed.

3. A SpreadJS visual report automation testing apparatus, characterized in that, include: The test case writing module is used to write test cases for SpreadJS visual reports; The test data includes data from the backend database, interface calculations, inter-table and intra-table formula calculations, and data manually adjusted by the user. The test cases include test data for the SpreadJS visualization report. The test data is structured, categorized according to different data sources, and stored in corresponding databases and configuration files. The test script creation module is used to write automated test scripts based on the pytest testing framework. It includes: on the basis of the pytest testing framework, encapsulating the Selenium / webDriver driver, logging, caching, data extraction and transformation, configuration file reading and writing, data adapter, simulated keyboard and mouse operation, image recognition and test report generation to obtain the automated test script; The automated test script is configured as follows: After logging into the user system, the user is taken to the SpreadJS visualization report page, where the SpreadJS plugin is loaded and the test data for the test cases is obtained. The test data is calculated to generate a visual report; Obtain the expected data corresponding to the actual output data of the visualization report through the data adapter; The actual output data is compared with the expected data; Once the comparison results are satisfactory, a test report will be generated. Specifically, the automated test script performs the following calculations on the test data: The test data is obtained and displayed through the SpreadJS plugin, and the test data is automatically calculated using report formulas. When the test data includes data that the user manually adjusts, the GC.Spread.Sheets.findControl() method is used to obtain a SpreadJS object. The cell index is used to quickly locate the cell where the data that the user needs to manually adjust is located, and the data in each cell is manually adjusted. After the manual adjustment is completed, the data in the cells that are not manually adjusted is recalculated. The automated testing module is used to execute the automated test scripts to test the SpreadJS visualization report and generate a test report.

4. An electronic device, characterized in that, The electronic device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the SpreadJS visual report automation testing method according to any one of claims 1-2.

5. A non-transitory computer-readable storage medium, comprising: The non-transitory computer-readable storage medium stores computer instructions for causing a computer to execute the SpreadJS visual report automation testing method as described in any one of claims 1-2.