Application program testing method and device, electronic equipment, controller and medium
By receiving and processing page screenshots of the application, detecting the matching with historical data, supplementing the data, and calculating the page coverage data, solving the problem that the existing technology cannot respond to the coverage from a visual perspective, and achieving more accurate and comprehensive testing Coverage assessment.
Patent Information
- Application Number
- CN202411527864.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-29
- Publication Date
- 2025-02-11
AI Technical Summary
The prior art cannot effectively reflect the coverage of program tests from a visual perspective in application testing, and the traversal tool needs to add custom automation scripts when increasing coverage, which may miss core scenarios.
By receiving the test information of the program to be tested and the page screenshot, data processing is performed to obtain the test page data, and the matching with the historical page data is detected. If it does not match, the data will be supplemented and the page coverage data will be calculated.
It realizes the calculation of test coverage from a visual perspective and automatically obtains page screenshots, which improves the comprehensiveness of data coverage and the accuracy of test coverage.
Smart Images

Figure CN119415394A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of software testing, and in particular relates to a testing method for an application program, a testing device for an application program, an electronic device and a controller, and a computer-readable storage medium. Background Art
[0002] In the prior art, the statistical method of the coverage of an application program is to implant a code into the code to scan and calculate the workflow (activity), or to use a traversal tool to perform random operations to calculate the workflow (activity).
[0003] However, the disadvantage of code scanning is that it can only target the code level and cannot reflect the user's visual level. Traversal tools generally use a few fixed devices to perform random traversal operations, but the scenes and operations are random. If you need to improve the coverage of the traversal tool, you need to add custom automation scripts. Another obvious disadvantage of the traversal tool is that some core scenarios may be missed if the traversal tool does not have a custom script. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide an application testing method, an application testing device, an electronic device and a controller, and a computer-readable storage medium, so that during the testing process, page coverage can be calculated by taking page screenshots, thereby reflecting the coverage of the program test from a visual perspective.
[0005] In order to solve or improve the above technical problems to a certain extent, according to one aspect of the present invention, a method for testing an application is provided, comprising:
[0006] Receiving first test information of the tested program and first page screenshots of each page during the program testing process;
[0007] Performing data processing on each of the first page screenshots to obtain test page data corresponding to each of the first page screenshots;
[0008] Detecting whether the plurality of test page data all match the pre-stored historical page data;
[0009] If all of them match, determining the page coverage data of the program test based on the plurality of test page data and the historical page data;
[0010] If not all of them match, the unmatched test page data is supplemented to the historical page data, and the page coverage data of the program test is determined based on the multiple test page data and the updated historical page data.
[0011] In some implementations, the step of determining page coverage data for program testing based on the plurality of test page data and the historical page data or the updated historical page data includes:
[0012] The test page data is used as a coverage ratio numerator, the historical page data or the updated historical page data is used as a coverage ratio denominator, and the page coverage data is determined based on the coverage ratio numerator and the coverage ratio denominator.
[0013] In some embodiments, the first test information includes a version number of the program under test to determine the version of the program under test, and the page coverage data includes page coverage, covered pages, uncovered pages of each version of the program under test, and the differences between the test page data of each version of the program under test.
[0014] In some implementations, the step of pre-storing the historical page data includes:
[0015] Receiving second test information of the tested program and second page screenshots of each page during at least one full-function regression test;
[0016] Data processing is performed on each of the second page screenshots to obtain the historical page data corresponding to each of the second page screenshots, and the historical page data is stored.
[0017] In some implementations, the step of performing data processing on each of the first page screenshots to obtain test page data corresponding to each of the first page screenshots includes:
[0018] Performing structural splitting on the first page screenshot based on page elements of the first page screenshot;
[0019] Generating a page fingerprint of the first page screenshot;
[0020] A corresponding relationship between the page element and the page fingerprint is constructed.
[0021] In some implementations, the step of generating a page fingerprint of the first page screenshot includes:
[0022] Performing grayscale processing on the first page screenshot to obtain a grayscale image of the first screenshot page;
[0023] Binarizing the grayscale image to generate a black-and-white image;
[0024] Using an edge detection algorithm to extract the edge of the black and white image to form an edge image;
[0025] The edge image is divided into grids of a preset size, and a feature value of each grid is calculated, and a plurality of the feature values are combined to obtain a page fingerprint of the first page screenshot.
[0026] According to an embodiment of the present invention, there is provided a testing device for an application program, comprising:
[0027] A data receiving module, configured to receive first test information of a program under test and first page screenshots of each page during a program test;
[0028] A page processing module, configured to perform data processing on each of the first page screenshots to obtain test page data corresponding to each of the first page screenshots;
[0029] A data matching module configured to detect whether all of the test page data match the pre-stored historical page data;
[0030] A data generation module is configured to determine page coverage data of the program test based on the plurality of test page data and the historical page data when all matches are found, or
[0031] If all the data are not matched, the unmatched test page data are supplemented to the historical page data, and the page coverage data of the program test is determined based on the plurality of test page data and the updated historical page data.
[0032] In some embodiments, the data generation module is configured to: use the test page data as a coverage numerator, use the historical page data or the updated historical page data as a coverage denominator, and determine the page coverage data based on the coverage numerator and the coverage denominator.
[0033] In some embodiments, the first test information includes a version number of the program under test to determine the version of the program under test, and the page coverage data includes page coverage, covered pages, uncovered pages of each version of the program under test, and the differences between the test page data of each version of the program under test.
[0034] In some embodiments, it also includes a data storage module, which is configured to receive second test information of the program under test and second page screenshots of each page during at least one full-function regression test; perform data processing on each of the second page screenshots to obtain the historical page data corresponding to each of the second page screenshots, and store the historical page data.
[0035] In some embodiments, the page processing module includes a page structuring unit, a page fingerprint generating unit, and a correspondence building unit;
[0036] The page structuring unit is configured to structurally split the first page screenshot based on page elements of the first page screenshot;
[0037] The page fingerprint generating unit is configured to generate a page fingerprint of the first page screenshot;
[0038] The correspondence building unit is configured to build a correspondence between the page element and the page fingerprint.
[0039] In some embodiments, the page fingerprint generation unit is configured to perform image grayscale processing on the first page screenshot to obtain a grayscale image of the first screenshot page; perform binarization processing on the grayscale image to generate a black and white image; use an edge detection algorithm to extract the edges of the black and white image to form an edge image; divide the edge image into grids of a preset size, and calculate the eigenvalue of each grid, and combine multiple eigenvalues to obtain the page fingerprint of the first page screenshot.
[0040] According to an embodiment of the present invention, there is provided an electronic device for loading a program under test, configured to generate page screenshots of each page of the program under test during a test of the program under test, and send the page screenshots to a server.
[0041] According to an embodiment of the present invention, a controller is provided, which includes a memory and a processor, wherein the memory stores a computer program, and when the program is executed by the processor, the steps of the application program testing method described in any of the above embodiments can be implemented.
[0042] According to an embodiment of the present invention, a computer-readable storage medium is provided for storing a computer program, wherein when the program is executed by a computer or a processor, the program implements the steps of the method for testing an application program described in any of the above embodiments.
[0043] Compared with the prior art, the present invention has obvious advantages and beneficial effects. By means of the above technical solution, the application testing method, application testing device, electronic device and controller, and computer-readable storage medium of the present invention can achieve considerable technical advancement and practicality, and have wide industrial utilization value, and have at least the following advantages:
[0044] The present invention automatically obtains page screenshots of pages in the test process during the functional verification and regression testing of the tested program, and then calculates the test coverage in the test process based on the obtained page screenshots, without the need for the tester to perform additional operations. At the same time, the obtained page screenshots are matched with the pre-stored historical page data. When there is no data matching the page screenshots in the historical page data, the unmatched page data is automatically added to the historical page data, thereby effectively ensuring the comprehensiveness of data coverage and improving the accuracy of calculating test coverage.
[0045] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the following specifically cites a preferred embodiment and describes it in detail with the accompanying drawings as follows. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 A schematic diagram of a flow chart of an application program testing method according to an embodiment of the present invention;
[0047] Figure 2 A schematic block diagram of an application testing device according to an embodiment of the present invention;
[0048] Figure 3 A schematic block diagram of an application testing device according to another embodiment of the present invention;
[0049] Figure 4 A schematic block diagram of a page processing module of an application testing device of the present invention. DETAILED DESCRIPTION
[0050] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined purpose of the invention, the specific implementation methods and effects of the application testing method, application testing device, electronic device and controller, and computer-readable storage medium proposed in the present invention are described in detail below in combination with the accompanying drawings and preferred embodiments.
[0051] The present invention can automatically capture pages in conventional manual testing by testers or UI (User Interface) automated testing and use intelligent analysis of page structures to calculate the coverage of UI pages.
[0052] The UI structure has a multi-level feature, and the page will change when you swipe up, down, left, or right. The statistics of UI structure coverage can better reflect the user's actual operation level and visual level of UI coverage. Compared with other types of coverage statistics, UI coverage is more in line with the user's actual operation scenario than embedded point coverage and code coverage, and can better reflect the visual effects that users can see with their naked eyes.
[0053] The present invention can be used to discover UI problems and crash problems at the visual level of the page. To ensure the reliability of the APP (APPlication, application) function, regression testing of the APP function is required for each release. Only by covering the APP function can the stability of the APP be guaranteed. Only by covering the function of the APP page can the completeness of the APP function test be guaranteed.
[0054] The testing method for the application of the present invention can automatically collect the UI page screenshots of the application that appear during the operation of the real device by all testers, and synchronously upload the UI page screenshots to the server, perform intelligent analysis on the uploaded data, count the page coverage of each version of the page, and output the coverage of the UI page of the specified version of the APP application in real time.
[0055] See also Figure 1 As shown, the application testing method provided by the embodiment of the present invention includes:
[0056] Step S10, receiving first test information of the program under test and first page screenshots of each page during the program testing process.
[0057] A page capture program (such as an agent program) is installed in an electronic device (such as a mobile phone, computer, etc.) that is loaded with the program under test. When the tester performs manual testing on the program under test or UI automation testing, the electronic device automatically captures each page presented by the program under test during the test through the installed page capture program, forms multiple first page screenshots, and sends the multiple screenshots of the page to the server.
[0058] At the same time, the electronic device will actively report the first test information of the electronic device and the tested program to the server. The first test information includes the application name and version number of the tested program, as well as the device information and operation location information of the electronic device.
[0059] The testing process of the program under test includes routine operation, functional testing, regression testing and functional acceptance of the program under test.
[0060] Step S20: performing data processing on each of the first page screenshots to obtain test page data corresponding to each of the first page screenshots.
[0061] After acquiring a plurality of first page screenshots uploaded by the electronic device, the first page screenshots need to be processed to obtain page test data.
[0062] In one embodiment, step S20 includes:
[0063] Step 202: Structurally split the first page screenshot based on page elements of the first page screenshot.
[0064] In this step, the first page screenshot is structurally split using a picture cutting scheme or an AI annotation recognition scheme based on the page elements of the first page screenshot. In this step, the picture cutting scheme and the AI annotation recognition scheme are prior arts and will not be described in detail here.
[0065] The page elements of the first page screenshot include, for example, a search area, a title area, a text area, an input box, a comment area, and a picture area.
[0066] Step 204: Generate a page fingerprint of the first page screenshot.
[0067] In one embodiment, step 204 includes:
[0068] Step 2041, performing grayscale processing on the first page screenshot to obtain a grayscale image of the first screenshot page.
[0069] In this step, the first page screenshot is rotated and adjusted to a picture of a preset size (such as 400×800), and then the adjusted picture is converted into a grayscale image.
[0070] Step 2042, binarize the grayscale image to generate a black and white image.
[0071] In this step, the pixels of the grayscale image obtained in step 2041 are converted into black and white to obtain a black and white image.
[0072] Step 2043: Use an edge detection algorithm to extract the edge of the black-and-white image to form an edge image.
[0073] In this step, the edge detection algorithm is a prior art and will not be described in detail here. In the process of edge extraction using the edge detection algorithm, the large area image class is set to be empty to reduce the page fingerprint noise generated by the large area image.
[0074] Step 2044, divide the edge image into grids of a preset size, calculate the eigenvalue of each grid, and combine multiple eigenvalues to obtain the page fingerprint of the first page screenshot.
[0075] In this step, the edge image is first divided into grids of a preset size (such as 64×64), and then the eigenvalues of the image in each grid are calculated. After the eigenvalues corresponding to all grids are calculated, all the eigenvalues are combined to form a unique page fingerprint.
[0076] Step 2045, after the page fingerprint of the first page screenshot is extracted, it is saved to the database for subsequent comparison and identification.
[0077] Step 206: construct a correspondence between page elements and page fingerprints to form test page data.
[0078] In this step, the formed test page data includes the page elements of the first screenshot page and its page fingerprint, as well as the corresponding relationship between the page elements and the page fingerprint.
[0079] Optionally, the page elements and the page fingerprints may form a correspondence relationship in a graph structure, and the correspondence relationship may be stored in a graph database so that the page elements may be used as index conditions and Xingning may be quickly queried later.
[0080] Step S30, detecting whether the plurality of test page data all match the pre-stored historical page data.
[0081] In this step, multiple test page data of multiple first page screenshots are matched with pre-stored historical page data. When the multiple test page data are successfully matched with the historical page data, step S40 is executed; when the multiple test page data include test page data that is not successfully matched with the historical page data, step S50 is executed.
[0082] In one embodiment, the step of preselecting and storing historical page data includes:
[0083] Step 302: Receive second test information of the tested program and second page screenshots of each page in at least one full-function regression test process.
[0084] In this step, the electronic device will actively report the second test information of the electronic device and the tested program to the server. The second test information includes the application name and version number of the tested program, as well as the device information and operation location information of the electronic device.
[0085] The tester performs at least one full-function regression test on the program under test. During the full-function regression test, the electronic device captures page screenshots (i.e., second page screenshots) of each page presented by the program under test during the test, and sends the captured multiple second page screenshots to the server.
[0086] Step 304: perform data processing on each second page screenshot to obtain historical page data corresponding to each second page screenshot, and store the historical page data.
[0087] In this step, after receiving a plurality of second page screenshots, data processing is performed on each second page screenshot respectively, and after the data processing, historical page data corresponding to each second page screenshot is obtained.
[0088] Optionally, page fingerprints of each second page screenshot are obtained through data processing, and the multiple page fingerprints are stored.
[0089] When storing the page fingerprint, a correspondence between the page fingerprint of the second page screenshot and second test data such as the application name, version number, device information of the electronic device, and operation location information of the tested program is created and stored.
[0090] Step S40, determining page coverage data of the program test based on the plurality of test page data and the historical page data.
[0091] In this step, when multiple test page data of the program under test can match the pre-stored historical page data, the multiple test page data are used as coverage numerators, and the historical page data are used as coverage denominators, and the page coverage data of the program under test is calculated based on the coverage numerator and the coverage denominator.
[0092] Optionally, the calculation of the page coverage data of the tested program is completed based on multiple test pages and historical page data of the tested program under the same version number.
[0093] The page coverage data includes the page coverage rate of each version of the tested program in the test, the coverage pages in the historical page data of each version covered by the test page data of the corresponding version, and the differences between the test page data of each version of the tested program.
[0094] Step S50 , supplementing the unmatched test page data to the historical page data, and determining page coverage data of the program test based on the plurality of test page data and the updated historical page data.
[0095] In this step, when there is test page data among multiple test page data that does not match the historical page data, it means that the pre-stored historical page data is missing. In order to further improve the accuracy of the page coverage data, the test page data that does not match the historical page data is supplemented to the historical page data to obtain updated historical page data.
[0096] The data of multiple test pages are used as the coverage numerator, and the updated historical page data is used as the coverage denominator. The page coverage data of the tested program is calculated based on the coverage numerator and the coverage denominator.
[0097] Optionally, the calculation of the page coverage data of the tested program is completed based on multiple test pages and historical page data of the tested program under the same version number.
[0098] The page coverage data includes the page coverage rate of each version of the tested program in the test, the coverage pages in the historical page data of each version covered by the test page data of the corresponding version, and the differences between the test page data of each version of the tested program.
[0099] According to another embodiment of the present invention, a testing device for an application is provided, such as Figure 2 As shown, it includes: a data receiving module 10, a page processing module 20, a data matching module 30 and a data generating module 40.
[0100] The data receiving module 10 is configured to receive first test information of the tested program and first page screenshots of each page during the program testing process.
[0101] A page capture program (such as an agent program) is installed in an electronic device (such as a mobile phone, a computer, etc.) that is loaded with the program under test. When the tester performs manual testing on the program under test or UI automation testing, the electronic device automatically captures each page presented by the program under test during the test through the installed page capture program, forms multiple first page screenshots, and sends the multiple page screenshots to the data receiving module 10.
[0102] At the same time, the electronic device will actively report the first test information of the electronic device and the tested program to the data receiving module 10. The first test information includes the application name and version number of the tested program, as well as the device information and operation location information of the electronic device.
[0103] The testing process of the program under test includes routine operation, functional testing, regression testing and functional acceptance of the program under test.
[0104] The page processing module 20 is configured to perform data processing on each first page screenshot to obtain test page data corresponding to each first page screenshot.
[0105] After acquiring a plurality of first page screenshots uploaded by the electronic device, the first page screenshots need to be processed to obtain page test data.
[0106] In one embodiment, the page processing module 20 includes: a page structuring unit 202 , a page fingerprint generating unit 204 and a corresponding relationship building unit 206 .
[0107] The page structuring unit 202 is configured to perform structural decomposition on the first page screenshot based on page elements of the first page screenshot.
[0108] The page structuring unit 202 uses an image cutting scheme or an AI annotation recognition scheme to complete structural splitting of the first page screenshot based on the page elements of the first page screenshot. The image cutting scheme and the AI annotation recognition scheme are prior arts and will not be described in detail here.
[0109] The page elements of the first page screenshot include, for example, a search area, a title area, a text area, an input box, a comment area, and a picture area.
[0110] The page fingerprint generating unit 204 is configured to generate a page fingerprint of the first page screenshot.
[0111] In one embodiment, the page fingerprint generation unit 204 is specifically configured to perform image grayscale processing on the first page screenshot to obtain a grayscale image of the first screenshot page; perform binarization processing on the grayscale image to generate a black and white image; use an edge detection algorithm to extract the edges of the black and white image to form an edge image; divide the edge image into grids of a preset size, and calculate the eigenvalue of each grid, and combine multiple eigenvalues to obtain the page fingerprint of the first page screenshot.
[0112] In this embodiment, the page fingerprint generation unit 204 rotates and adjusts the first page screenshot into a picture of a preset size (such as 400×800), and then converts the adjusted picture into a grayscale image. Then, the pixels of the obtained grayscale image are converted into black and white to obtain a black and white image.
[0113] In this embodiment, the edge detection algorithm is a prior art and will not be described in detail here. In the process of edge extraction using the edge detection algorithm, the large area image class is set to be empty to reduce the page fingerprint noise generated by the large area image.
[0114] In this embodiment, the page fingerprint generation unit 204 divides the edge image into grids of a preset size (such as 64×64), and then calculates the feature value of the image in each grid. After calculating the feature values corresponding to all grids, all feature values are combined to form a unique page fingerprint. After the page fingerprint of the first page screenshot is extracted, it is saved to the database for subsequent comparison and identification.
[0115] The correspondence building unit 206 is configured to build a correspondence between page elements and page fingerprints to form test page data.
[0116] The test page data formed by the correspondence building unit 206 includes the page elements of the first screenshot page and its page fingerprint, as well as the correspondence between the page elements and the page fingerprint.
[0117] Optionally, the page elements and the page fingerprints may form a correspondence relationship in a graph structure, and the correspondence relationship may be stored in a graph database so that the page elements may be used as index conditions for subsequent rapid query.
[0118] The data matching module 30 is configured to detect whether all of the multiple test page data match the pre-stored historical page data.
[0119] Specifically, the data matching module 30 matches the multiple test page data of the multiple first page screenshots with the pre-stored historical page data, and controls the operation of the control data generating module 40 according to the matching result.
[0120] In one embodiment, the testing device for application data also includes a data storage module 50, which is configured to receive second test information of the program under test and second page screenshots of each page during at least one full-function regression test; perform data processing on each second page screenshot to obtain historical page data corresponding to each second page screenshot, and store the historical page data.
[0121] Specifically, the electronic device will actively report the second test information of the electronic device and the tested program to the server, wherein the second test information includes the application name and version number of the tested program, as well as the device information and operation location information of the electronic device.
[0122] The tester performs at least one full-function regression test on the program under test. During the full-function regression test, the electronic device captures page screenshots (i.e., second page screenshots) of each page presented by the program under test during the test, and sends the captured multiple second page screenshots to the data storage module 50.
[0123] After receiving a plurality of second page screenshots, the data storage module 50 performs data processing on each second page screenshot respectively, and obtains the historical page data corresponding to each second page screenshot after the data processing.
[0124] Optionally, page fingerprints of each second page screenshot are obtained through data processing, and the multiple page fingerprints are stored.
[0125] When storing the page fingerprint, a correspondence between the page fingerprint of the second page screenshot and second test data such as the application name, version number, device information of the electronic device, and operation location information of the tested program is created and stored.
[0126] The data generation module 40 is configured to determine the page coverage data of the program test based on the multiple test page data and the historical page data when all the multiple test page data match, or to supplement the unmatched test page data to the historical page data when all the multiple test page data do not match, and determine the page coverage data of the program test based on the multiple test page data and the updated historical page data.
[0127] When multiple test page data of the program under test can be matched with the pre-stored historical page data, the data generation module 40 uses the multiple test page data as the coverage numerator and the historical page data as the coverage denominator, and calculates the page coverage data of the program under test based on the coverage numerator and the coverage denominator.
[0128] Optionally, the calculation of the page coverage data of the tested program is completed based on multiple test pages and historical page data of the tested program under the same version number.
[0129] The page coverage data includes the page coverage rate of each version of the tested program in the test, the coverage pages in the historical page data of each version covered by the test page data of the corresponding version, and the differences between the test page data of each version of the tested program.
[0130] When the data generation module 40 finds that there is test page data that does not match the historical page data among multiple test page data, it indicates that there is omission in the pre-stored historical page data. In order to further improve the accuracy of the page coverage data, the test page data that does not match the historical page data is supplemented into the historical page data to obtain updated historical page data.
[0131] The data of multiple test pages are used as the coverage numerator, and the updated historical page data is used as the coverage denominator. The page coverage data of the tested program is calculated based on the coverage numerator and the coverage denominator.
[0132] Optionally, the calculation of the page coverage data of the tested program is completed based on multiple test pages and historical page data of the tested program under the same version number.
[0133] The page coverage data includes the page coverage rate of each version of the tested program in the test, the coverage pages in the historical page data of each version covered by the test page data of the corresponding version, and the differences between the test page data of each version of the tested program.
[0134] According to another embodiment of the present invention, there is provided an electronic device for loading a program under test, configured to generate page screenshots of each page of the program under test during a test of the program under test, and to send the plurality of page screenshots to a server.
[0135] In one embodiment, a page capture program (such as an agent program) is pre-installed in the electronic device. During the testing process of the program under test, the page capture program will automatically capture the pages presented by the program under test during the testing process, form multiple page screenshots (i.e., the first page screenshot and the second page screenshot), and send the multiple page screenshots to the server.
[0136] Optionally, the electronic devices include mobile phones, computers, car computers, etc.
[0137] According to another embodiment of the present invention, a controller is provided, which includes a memory and a processor, wherein the memory stores a computer program, and when the program is executed by the processor, the steps of the application program testing method in any of the above-mentioned embodiments can be implemented.
[0138] According to another embodiment of the present invention, a readable storage medium is provided for storing a computer program, wherein the program, when executed by a computer or a processor, implements the steps of the application program testing method in any of the above-mentioned embodiments.
[0139] The present invention automatically obtains page screenshots of pages in the test process during the functional verification and regression testing of the tested program, and then calculates the test coverage in the test process based on the obtained page screenshots, without the need for the tester to perform additional operations. At the same time, the obtained page screenshots are matched with the pre-stored historical page data. When there is no data matching the page screenshots in the historical page data, the unmatched page data is automatically added to the historical page data, thereby effectively ensuring the comprehensiveness of data coverage and improving the accuracy of calculating test coverage.
[0140] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Although the present invention has been disclosed as a preferred embodiment as above, it is not used to limit the present invention. Any technician familiar with this profession can make some changes or modifications to equivalent embodiments of equivalent changes using the technical contents disclosed above without departing from the scope of the technical solution of the present invention. However, any simple modification, equivalent change and modification made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention still falls within the scope of the technical solution of the present invention.
Claims
1. A method for testing an application, characterized in that: include: Receiving first test information of the tested program and first page screenshots of each page during the program testing process; Performing data processing on each of the first page screenshots to obtain test page data corresponding to each of the first page screenshots; Detecting whether the plurality of test page data all match the pre-stored historical page data; If all of them match, determining the page coverage data of the program test based on the plurality of test page data and the historical page data; If not all of them match, the unmatched test page data is supplemented to the historical page data, and the page coverage data of the program test is determined based on the multiple test page data and the updated historical page data.
2. The application testing method according to claim 1, characterized in that: The step of determining page coverage data for program testing based on the plurality of test page data and the historical page data or the updated historical page data comprises: The test page data is used as a coverage ratio numerator, the historical page data or the updated historical page data is used as a coverage ratio denominator, and the page coverage data is determined based on the coverage ratio numerator and the coverage ratio denominator.
3. The application testing method according to claim 1, characterized in that: The first test information includes the version number of the program under test to determine the version of the program under test, and the page coverage data includes the page coverage, covered pages, uncovered pages of each version of the program under test, and the differences between the test page data of each version of the program under test.
4. The application testing method according to claim 1, characterized in that: The step of pre-storing the historical page data includes: Receiving second test information of the tested program and second page screenshots of each page during at least one full-function regression test; Data processing is performed on each of the second page screenshots to obtain the historical page data corresponding to each of the second page screenshots, and the historical page data is stored.
5. The application testing method according to claim 1, characterized in that: The step of performing data processing on each of the first page screenshots to obtain test page data corresponding to each of the first page screenshots comprises: Performing structural splitting on the first page screenshot based on page elements of the first page screenshot; Generating a page fingerprint of the first page screenshot; A corresponding relationship between the page elements and the page fingerprints is constructed to form the test page data.
6. The application testing method according to claim 5, characterized in that: The step of generating a page fingerprint of the first page screenshot includes: Performing grayscale processing on the first page screenshot to obtain a grayscale image of the first screenshot page; Binarizing the grayscale image to generate a black-and-white image; Using an edge detection algorithm to extract the edge of the black and white image to form an edge image; The edge image is divided into grids of a preset size, and a feature value of each grid is calculated, and a plurality of the feature values are combined to obtain a page fingerprint of the first page screenshot.
7. A testing device for an application, characterized in that: include: A data receiving module, configured to receive first test information of a program under test and first page screenshots of each page during a program test; A page processing module, configured to perform data processing on each of the first page screenshots to obtain test page data corresponding to each of the first page screenshots; A data matching module, configured to match the plurality of test page data with pre-stored historical page data; A data generation module is configured to determine page coverage data of the program test based on the plurality of test page data and the historical page data when all matches are found, or If all the data are not matched, the unmatched test page data are supplemented to the historical page data, and the page coverage data of the program test is determined based on the plurality of test page data and the updated historical page data.
8. An electronic device, characterized in that: It is used to load the program under test and is configured to generate page screenshots of each page of the program under test during the testing process of the program under test, and send the page screenshots to the server.
9. A controller comprising a memory and a processor, wherein the memory stores a computer program, and when the program is executed by the processor, the program can implement the steps of the test method of the application program according to any one of claims 1 to 6.
10. A computer-readable storage medium for storing a computer program, wherein when the program is executed by a computer or a processor, the program implements the steps of the method for testing an application program according to any one of claims 1 to 6.