Application testing method and apparatus, electronic device, and storage medium
By combining random and traversal testing modes, the problem of low efficiency and high cost in application testing in existing technologies is solved, achieving wider test coverage and more efficient testing results, thus meeting the needs of high-quality delivery and short cycle time.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2026-03-27
AI Technical Summary
Existing application testing models are inefficient and costly, failing to meet the requirements of high-quality and short-cycle business delivery.
The random test mode is used to randomly execute control fragments in the application page until a predetermined time is reached. Then, the unexecuted fragments are identified through the graph and covered by the traversal test mode. Combining the random and traversal test modes improves the efficiency and scope of testing.
By covering more segments, the software quality of the application was improved, meeting the requirements of high delivery quality and short cycle time, and testing efficiency was increased by 6 to 10 times.
Smart Images

Figure CN119782139B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of software testing, in particular to an application program testing method and device, electronic equipment and storage medium. BACKGROUND
[0002] Testing an application program can detect whether the application program meets the requirements. In the prior art, the testing of an application program generally adopts a traversal testing mode. The traversal testing mode is a traditional automated testing mode, in which a test script is executed one by one, and the test range and the test path of each script are fixed.
[0003] In order to meet the requirement of high quality of business delivery, a larger test range needs to be covered, which makes the test more comprehensive and the software version quality more stable. However, the larger the test range is, the higher the resource and cost are. In order to have a larger range of testing, the traversal testing mode requires test engineers to write more test scripts, and the test is executed according to the test scripts, which is low in test efficiency and cannot meet the requirement of short business delivery cycle. SUMMARY
[0004] Embodiments of the present application provide an application program testing method and device, electronic equipment and storage medium, which are helpful to improve the test efficiency and the quality of the application program.
[0005] In order to solve the above problems, in a first aspect, embodiments of the present application provide an application program testing method, comprising:
[0006] obtaining a first test duration of a random testing mode;
[0007] According to the graph of the to-be-tested application program, a fragment corresponding to a control in a page of the to-be-tested application program is randomly executed through the random testing mode, and a first fragment that has been executed and a first page where the first fragment is located are recorded to obtain a test result of the first fragment, until the test duration of the random testing mode reaches the first test duration; the graph comprises a page jump relationship of the to-be-tested application program and a control to be tested in a page, and the fragment is test content corresponding to the control;
[0008] According to the graph, the first fragment and the first page, a second fragment that has not been tested and a second page where the second fragment is located are determined;
[0009] According to the second page, the second fragment is executed through the traversal testing mode to obtain a test result of the second fragment.
[0010] In a second aspect, embodiments of the present application provide an application program testing device, comprising:
[0011] a test duration acquisition module, configured to acquire a first test duration of a random test mode;
[0012] a random test module, configured to execute a first fragment corresponding to a control in a page of an application under test according to a graph of the application under test by a random test mode, and record the executed first fragment and a first page where the first fragment is located, to obtain a test result of the first fragment, until a test duration of the random test mode reaches the first test duration; the graph comprises a page jump relationship of the application under test and a control to be tested in a page, and the fragment is test content corresponding to the control;
[0013] a non-executed fragment determination module, configured to determine a second fragment not executed for test and a second page where the second fragment is located according to the graph, the first fragment and the first page;
[0014] a traversal test module, configured to execute the second fragment according to the second page by a traversal test mode, to obtain a test result of the second fragment.
[0015] In a third aspect, an electronic device is provided, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the application program test method when executing the computer program.
[0016] In a fourth aspect, a computer readable storage medium is provided, which stores a computer program, and the program implements the steps of the application program test method when executed by a processor.
[0017] The application program test method, device, electronic device and storage medium provided in the embodiments of the present application can execute a fragment corresponding to a control in a page of an application under test according to a graph of the application under test by a random test mode, record an executed first fragment and a first page where the first fragment is located, obtain a test result of the first fragment, until a test duration of the random test mode reaches a first test duration, determine a second fragment not executed for test and a second page where the second fragment is located according to the graph, the first fragment and the first page, execute the second fragment according to the second page by a traversal test mode, and obtain a test result of the second fragment. After the test duration of the random test mode reaches the first test duration, the second fragment not executed by the random test mode is executed by the traversal test mode, so that more fragments can be covered, a larger test range can be covered, the software quality of the application program is improved, and the test content is encapsulated as a fragment, so that each fragment can be randomly jumped and executed by the random test mode, without being executed according to an established test path, the test efficiency is improved, and the requirements of high delivery quality and short cycle are met. Attached Figure Description
[0018] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a flowchart of an application testing method provided in an embodiment of this application;
[0020] Figure 2 This is a diagram showing the relationship between screens, pages, controls, and fragments in the embodiments of this application;
[0021] Figure 3 This is a schematic diagram of the structure of an application testing device provided in an embodiment of this application;
[0022] Figure 4 This is a schematic diagram of the structure of a final electronic device provided in an embodiment of this application. Detailed Implementation
[0023] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0024] Figure 1 This is a flowchart illustrating an application testing method provided in an embodiment of this application. This application testing method can be applied to electronic devices such as in-vehicle terminals, mobile phones, and tablets. Figure 1 As shown, the method includes steps 110 to 140.
[0025] Step 110: Obtain the first test duration for the random test mode.
[0026] The first test duration is the execution time of the application when performing tests using a random test mode.
[0027] When testing an application, you can directly set the duration of the random testing mode as the first test duration; or you can set the total test duration of the application and use a preset percentage of the total test duration as the first test duration of the random testing model.
[0028] In an embodiment of the present application, the first test duration of the random test mode comprises: obtaining a total test duration, and determining a preset proportion of the total test duration as the first test duration.
[0029] The total test duration is an expected duration for testing the application.
[0030] The total test duration can be set when the application needs to be tested. The first test duration of the random test mode is determined as a preset proportion of the total test duration. The preset proportion is a proportion value less than 1, for example, the preset proportion can be 80%. The first test duration is less than the total test duration, so that a certain test time is reserved for testing the test segments of the traversal test mode, so that after the test of the random test mode is performed, the segments not executed by the random test mode can be executed by the traversal test mode. In fact, the test duration of the traversal test mode is not necessarily the reserved duration, and the actual test duration is used as the criterion. For example, 20% of the total test duration is reserved to execute the remaining segments. The actual test duration can be lower than, equal to, or higher than 20% of the total test duration, which is normal. The actual test duration of the segments not executed by the random test mode is used as the criterion.
[0031] In step 120, according to the graph of the application to be tested, the segments corresponding to the controls in the pages of the application to be tested are randomly executed by the random test mode, and the first segment executed and the first page where the first segment is located are recorded to obtain the test result of the first segment until the test duration of the random test mode reaches the first test duration.
[0032] The graph comprises the page jump relationship of the application to be tested and the controls in the pages to be tested, and the segment is the test content corresponding to the control. The segment is a test script written to implement the test content corresponding to the control. The graph is the page architecture in the application to be tested, and can also be understood as a mind map type of page hierarchical structure.
[0033] The control is a display button that can be clicked in any page in the software program. The segment is the control itself or a small program (also a test point) extended for the control, so that it is executable code. Figure 2 is a relationship diagram among the screen, the page, the control, and the segment in the embodiment of the present application, Figure 2 The screen in the vehicle terminal is shown, an application is opened, and one or more controls exist in the page. The control can be clicked, and the segment is a test point extended by the test operation path with the control as a necessary point. The segment can be added. One control can correspond to one or more segments.
[0034] The test of the to-be-tested application program can be performed when the to-be-tested application program meets a test condition, and in this case, the to-be-tested application program is first tested by using a random test mode to cover more fragments and thus cover a larger test range. When the test in the random test mode is performed, a fragment corresponding to a control in a page of the to-be-tested application program can be randomly performed according to the graph of the to-be-tested application program, and in the process of performing the test, a first fragment that has been executed and a first page in which the first fragment is located are recorded in real time, a test result of each first fragment is obtained after the first fragment is executed, and after one first fragment is executed, the next fragment is randomly executed until the test time length of the random test mode reaches a first test time length, the test in the random test mode is ended, and a subsequent traversal test mode can be switched.
[0035] The test condition is an environmental condition required for performing the test of the to-be-tested application program. For example, when the to-be-tested application program in a vehicle terminal is tested, the test condition can be that the vehicle is in P gear and the to-be-tested application program has been installed in the vehicle terminal.
[0036] The test result of the first fragment can be test success or test failure. After a certain operation in the first fragment is performed, if the result of the operation is the same as an expected result, the test result is test success, and if the result of the operation is different from the expected result, the test result is test failure. For example, the test content of a first fragment is to test whether a play button is normal, and in the test of the first fragment, the play button needs to be clicked. After a selected play list is executed and the play button is clicked, if the selected play list can be normally played, the test result of the first fragment is test success, and if the selected play list cannot be normally played, the test result of the first fragment is test failure.
[0037] In step 130, a second fragment that has not been tested and a second page in which the second fragment is located are determined according to the graph, the first fragment, and the first page.
[0038] Since the graph records each page in the to-be-tested application program and the controls in each page, and the fragments are corresponding to the controls, one or more second fragments that have not been tested and the second page in which each second fragment is located in the to-be-tested application program can be determined based on the recorded first fragment that has been executed and the first page.
[0039] In step 140, the second fragment is executed by using a traversal test mode according to the second page, and a test result of the second fragment is obtained.
[0040] According to the order of the second page, the second page is traversed, and each control in the second page is traversed to obtain a test result of the traversed second fragment. The test result of the second fragment can be test success or test failure. After a certain operation in the second fragment is executed, if the result of the operation is the same as the expected result, the test result is test success, and if the result of the operation is different from the expected result, the test result is test failure.
[0041] The execution process of the conventional traversal test mode is as follows: assuming that an application program has been designed with 100 scripts, each script is a manual click operation step, and the test is executed step by step through automation. Similarly, the scripts are executed one by one until the 100 scripts are executed. That is, the test path is fixed through the test script, and the test is executed step by step according to each test path until all the test scripts are executed, and the test is completed.
[0042] The execution strategy and complete execution cycle of a script in the specific implementation of the traversal test mode are as follows:
[0043] Assuming that a test point is to click a video or audio from non-playing to playing, and the page button UI (User Interface) is displayed correctly, and there is sound output.
[0044] The design premise condition is that the vehicle is in P gear, and the application program to be tested is installed in the application center.
[0045] The designed test path is written in the form of code, and the steps can be automatically run: click the desktop application icon button on the specified screen to open the application; click to enter a certain page; click to open a certain album; click to open a certain video or audio; and click the play button of the video or audio.
[0046] The designed verification point and the judgment of whether the expected result is met and the output of the test result correspond to the designed test path one by one, and the execution path is ensured to be unbiased: the tested application icon is identified to verify the expected result, the tested application is executed to open, and it is verified that the application has been opened; a certain page is opened, and the opened page is verified to be consistent with the expected result by comparing the words or pictures in the opened page; a certain album is opened, and the opened page is verified to be consistent with the expected result by comparing the words or pictures in the opened page; a certain resource is opened, and the play page is displayed to verify that it is in the play page; the UI is verified to be in the pause state, the pause button is clicked on the page, the UI is verified to be in the play state / play button, and the sound is verified to have been output; a fixed test script is executed, and if the verification point is not consistent with the expected result, the test is failed, and if all the verification points are consistent with the expected result, the test is passed; the initial environment is restored, and the desktop is returned, and each script is an independent individual.
[0047] The above is a complete cycle of the traversal test mode execution. In an embodiment of the present application, each segment is a test script, and a test corresponding to a control is completed. Thus, after the execution order of each second segment is determined based on the graph and the second page, each second segment is executed according to the traversal test mode to obtain the test result of each second segment.
[0048] In an embodiment of the present application, the test result of the second segment is obtained by executing the second segment according to the traversal test mode based on the second page, and the method comprises: determining the execution order of the second segment based on the graph and the second page; and executing the second segment according to the execution order to obtain the test result of the second segment.
[0049] The graph records the jump relationship of each page. Thus, based on the graph and the second page, the execution order of all the determined second segments can be determined according to the jump relationship of each second page. For example, control 1 in page 1 needs to open page 2, page 2 includes control 2 and control 3, control 1 corresponds to segment 1, control 2 corresponds to segment 2, and control 3 corresponds to segment 3. In this case, the execution order of segment 1, segment 2, and segment 3 can be segment 1 first, segment 2 second, and segment 3 last, or the execution order of segment 1, segment 2, and segment 3 can be segment 1 first, segment 3 second, and segment 2 last.
[0050] After the execution order of the second segment is determined, the second page where the second segment is located can be opened and the second segment can be executed according to the execution order of the second segment. The test result of the second segment is obtained after the execution of each second segment is completed.
[0051] By determining the execution order of the second segment based on the graph and the second page and executing each second segment according to the execution order, all the second segments that are not executed in the random test mode are executed according to the traversal test mode, the test range is expanded, the software quality of the application program can be improved, and the test efficiency can be further improved by executing according to the order.
[0052] It should be noted that although the latter part adopts the traversal idea of the traversal test mode, there are still jumps between the pages and multiple custom test paths (jumps and test paths in the random test mode) before the pages, which is not a complete traversal test mode.
[0053] Table 1 is a comparison result of different test modes. As shown in Table 1, the test is performed completely using the traversal test mode, the test speed is low, and the coverage is fixed, only the fixed test path in the pre-written script can be tested, and the segments outside the fixed test path cannot be covered; the test is performed completely using the random test mode, the test speed is high, and the coverage is relatively large than the traversal test mode when the test time is long, but there are still segments that are not covered; the test is performed using the combination of the random test mode and the traversal test mode in the embodiment of the application, the test speed is basically the same as that of the random test mode, and the segments that cannot be covered by the random test mode can be covered, further expanding the test coverage.
[0054] Table 1 is a comparison result of different test modes
[0055]
[0056] The application program test method provided in the embodiment of the application, by the graph of the to-be-tested application program, the segments corresponding to the controls in the page of the to-be-tested application program are randomly executed by the random test mode, and the first segment executed and the first page where the first segment is located are recorded, the test result of the first segment is obtained, until the test time of the random test mode reaches the first test time, the second segments that are not executed and the second pages where each second segment is located are determined according to the graph, the first segment and the first page, the second segments are executed by the traversal test mode according to the second pages, the test result of each second segment is obtained, after the test time of the random test mode reaches the first test time, the second segments that are not executed by the random test mode are executed by the traversal test mode, so that more segments can be covered, a larger test range can be covered, and the software quality of the application program is improved, and by encapsulating the test content as a segment, each segment can be randomly jumped and executed by the random test mode, without being executed according to the predetermined test path, the test efficiency can be improved, and the requirements of high delivery quality and short cycle can be met.
[0057] On the basis of the above technical solution, the method further comprises:
[0058] When the first segment and the first page are recorded, a first screen corresponding to the first segment and the first page is also recorded;
[0059] The second segments that are not executed and the second pages where the second segments are located are determined according to the graph, the first segment and the first page, comprising:
[0060] The second segments that are not executed, the second pages where the second segments are located and the second screens corresponding to the second segments and the second pages are determined according to the graph, the first segment, the first page and the first screen.
[0061] The first screen corresponds to a screen of a first segment executed in the random test mode, and the second screen corresponds to a screen of a second segment not executed in the random test mode. The second screen and the first screen can be the same screen or different screens.
[0062] In the vehicle terminal, there can be multiple screens, such as a central control screen, a copilot screen, a rear screen, and the like. Different pages of the application to be tested can be displayed on the corresponding screen, that is, one page can be displayed on multiple screens or on one screen. When testing, the first screen corresponding to the first segment and the first page is recorded at the same time, so as to continue subsequent traversal test mode testing for the screen not executed.
[0063] After the execution duration of the random test mode reaches the first test duration, the traversal test mode is switched. When the traversal test mode is executed, the second segment not executed is determined. According to the graph, the first segment, the first page, and the first screen, the second segment not executed in the graph, the second page where the second segment is located, and the second screen corresponding to the second segment and the second page are determined. When the second segment is executed through the traversal test mode, the second page corresponding to the second segment and the second page can be jumped to and the second segment can be executed, so as to realize the test of the application in different screens of the vehicle terminal with multiple screens.
[0064] On the basis of the above technical solution, the second segment is executed through the traversal test mode according to the second page, and a test result of the second segment is obtained.
[0065] After the execution order of each second segment is determined according to the graph, each second segment is executed in sequence according to the execution order of each second segment through the traversal test mode. When a second segment is currently traversed, the second page corresponding to the second segment is jumped to in the second screen corresponding to the second segment, and the second segment is executed under the second page. After the second segment is executed, a test result of the second segment is obtained.
[0066] When the second segment is executed through the traversal test mode, the execution screen of each second segment is fully considered, so as to ensure the test of multiple screens and further improve the coverage of the test and the quality of the application.
[0067] On the basis of the technical solution, according to the graph of the to-be-tested application program, a first fragment corresponding to a control in a first page of the to-be-tested application program is randomly executed through a random test mode, and a test result of the first fragment is obtained.
[0068] According to the graph of the to-be-tested application program, a first fragment corresponding to a control in a first page of the to-be-tested application program is randomly executed through a random test mode, and a test result of the first fragment is obtained.
[0069] The executed first fragment and the first page are recorded.
[0070] The operations of randomly jumping to the first page, randomly executing the first fragment, and recording the first fragment and the first page are cyclically executed until the test time length of the random test mode reaches the first test time length.
[0071] According to the graph of the to-be-tested application program, a first fragment corresponding to a control in a first page of the to-be-tested application program is randomly executed through a random test mode, and a test result of the first fragment is obtained.
[0072] On the basis of the technical solution, the method further comprises: when the executed first fragment and the first page where the first fragment is located are recorded, the execution times of the first fragment are recorded.
[0073] In the test of the random test mode, since the first page is randomly jumped to and the first fragment in the first page is randomly executed according to the graph, the same fragment may be executed multiple times, so after the execution of the first fragment is completed, the execution times of the first fragment are also recorded, so that the stress test of the first fragment can be simultaneously implemented, and a stress test script does not need to be additionally written.
[0074] When the test task is performed in the random test mode, a fixed first test duration (e.g., 4 hours) is set, and in the process of performing the test, the test is randomly jumped to a certain page, the control-fragment in the page is executed, and the page is jumped to execute the control-fragment, simulating the random clicking of human thinking, and the execution is a very long operation path, until the set duration is met, the execution is stopped.
[0075] The execution strategy and complete execution cycle of a script in the random test mode are as follows:
[0076] Suppose a test point is to click a video or audio from never playing to playing, and the page button UI is displayed correctly, and there is sound output.
[0077] Scene analysis: In scene management, the prerequisite condition (e.g., the vehicle is in P gear) is maintained.
[0078] The test path + test point + verification point is built according to the following steps: first, the atlas is constructed, that is, the software page architecture can be understood as a mind map type hierarchical structure; the page control element and parameters are obtained; the fragment is added, and the fragment (i.e., the test point, such as clicking the pause play button, and playing) is added based on the control; the test point script + verification point (UI display) is perfected.
[0079] The test task is performed in the random test mode according to the following steps: the screen parameter (central control screen, copilot screen, or / and rear screen) of the execution task is selected; the first test duration of the task execution is set, such as 4 hours; the test execution is randomly jumped to a certain page or / and executes any fragment in the page; the first page, the first fragment, and the execution times of each first fragment are recorded while executing; any fragment is continuously executed; until the first test duration (e.g., 4 hours) of the task setting is met, the test is automatically stopped, and the random test mode test task is ended.
[0080] The embodiment of the application is more suitable for application program testing in a vehicle terminal. Since the test of the application program of the vehicle terminal is multi-screen interaction, and the user usage scenario is also very extensive, the combination test of the random test mode and the traversal test mode can cover a larger test range, the test range can be covered by increasing the test duration of the random test mode, and the test efficiency can be improved by the test of the random test mode. Through practice, the test coverage and test efficiency can be improved by 6 to 10 times by using the application program test method provided in the embodiment of the application.
[0081] Figure 3 is a structural schematic diagram of an application program testing device provided in the embodiment of the application, as shown in Figure 3 The device comprises:
[0082] The test duration acquisition module 210 is configured to acquire a first test duration of a random test mode.
[0083] The random test module 220 is configured to execute a fragment corresponding to a control in a page of an application under test according to a graph of the application under test by a random test mode, record a first fragment that has been executed and a first page where the first fragment is located, and obtain a test result of the first fragment until a test duration of the random test mode reaches the first test duration.
[0084] The unexecuted fragment determination module 230 is configured to determine a second fragment that has not been executed and a second page where the second fragment is located according to the graph, the first fragment and the first page.
[0085] The traversal test module 240 is configured to execute the second fragment according to the second page by a traversal test mode, and obtain a test result of the second fragment.
[0086] Optionally, the traversal test module includes:
[0087] The execution order determination unit is configured to determine an execution order of the second fragment according to the graph and the second page.
[0088] The traversal test unit is configured to execute the second fragment according to the execution order, and obtain a test result of the second fragment.
[0089] Optionally, the device further includes:
[0090] The recording module is configured to record a first screen corresponding to the first fragment and the first page when recording the first fragment and the first page.
[0091] The unexecuted fragment determination module is specifically configured to:
[0092] determine a second fragment that has not been executed, a second page where the second fragment is located, and a second screen corresponding to the second fragment and the second page according to the graph, the first fragment, the first page and the first screen.
[0093] Optionally, the traversal test module is specifically configured to:
[0094] execute the second fragment under the second screen and the second page by a traversal test mode, and obtain a test result of the second fragment.
[0095] Optionally, the random test module includes:
[0096] The fragment random execution unit is used to randomly jump to the first page of the application under test according to the graph of the application under test through a random test mode, and randomly execute the first fragment corresponding to the control in the first page to obtain the test result of the first fragment.
[0097] An executed segment recording unit is used to record the executed first segment and the first page;
[0098] The random test control unit is used to repeatedly execute operations such as randomly jumping to the first page, randomly executing the first segment, and recording the first segment and the first page, until the test duration of the random test mode reaches the first test duration.
[0099] Optionally, the device further includes:
[0100] The execution count recording module is used to record the execution count of the first segment when recording the first segment that has been executed and the first page where the first segment is located.
[0101] Optionally, the test duration acquisition module is specifically used for:
[0102] Obtain the total test duration, and determine the first test duration as a preset proportion of the total test duration.
[0103] The application testing apparatus provided in this application embodiment is used to implement the steps of the application testing method described in this application embodiment. The specific implementation of each module of the apparatus is described in the corresponding steps, and will not be repeated here.
[0104] The application testing apparatus provided in this application embodiment randomly executes the fragments corresponding to controls on the page of the application under test according to the graph of the application under test in a random testing mode, and records the first fragment executed and the first page where the first fragment is located, and obtains the test result of the first fragment. This continues until the test duration of the random testing mode reaches the first test duration. Based on the graph, the first fragment, and the first page, the second fragments that have not been tested and the second page where each second fragment is located are determined. Based on the second page, the second fragments are executed by traversing the test mode to obtain the test result of each second fragment. By executing the second fragments that have not been executed by the random testing mode after the test duration of the random testing mode reaches the first test duration, the traversal test mode is used to execute the second fragments that have not been executed by the random testing mode, thereby covering more fragments and a larger test range, improving the software quality of the application. Moreover, by encapsulating the test content into fragments, it is convenient to randomly jump and execute each fragment through the random testing mode, without having to execute according to a predetermined test path, which can improve testing efficiency and meet the requirements of high delivery quality and short cycle.
[0105] Figure 4 is a structural schematic diagram of an electronic device provided by an embodiment of the present application, as shown in the figure, the electronic device 300 can include one or more processors 310 and one or more memories 320 connected with the processor 310. The electronic device 300 can also include an input interface 330 and an output interface 340 for communicating with another device or system. The program code executed by the processor 310 can be stored in the memory 320. Figure 4
[0106] The processor 310 in the electronic device 300 invokes the program code stored in the memory 320 to execute the application program test method in the above-described embodiments.
[0107] The present application also provides a computer readable storage medium, which stores a computer program, and the program is executed by a processor to implement the steps of the application program test method described in the embodiments of the present application.
[0108] The present application also provides a computer program product, which is executed by a processor to implement the steps of the application program test method described in the embodiments of the present application.
[0109] Each of the embodiments in the present specification is described in a progressive manner, and each embodiment focuses on the difference from other embodiments. The same and similar parts of each embodiment can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the part of the method embodiment.
[0110] The above describes in detail the application program test method, device, electronic device and storage medium provided by the embodiments of the present application. The principle and implementation manner of the present application are described by applying specific examples. The above embodiment is only used to help understand the method and its core idea of the present application; at the same time, for the general technical personnel in the art, according to the idea of the present application, the specific implementation manner and application range will be changed; in conclusion, the content of the present specification should not be understood as the limitation of the present application.
[0111] Those skilled in the art can clearly understand the implementation of the embodiments by the description of the above embodiments. The embodiments can be implemented by means of software and necessary universal hardware platforms, and of course can also be implemented by hardware. Based on such understanding, the above technical solutions can be embodied in the form of a software product, and the computer software product can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, etc., and includes a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in each embodiment or some parts of the embodiments.
Claims
1. An application testing method, characterized in that, include: Get the first test duration in the random test mode; Based on the graph of the application under test, the fragments corresponding to the controls on the page of the application under test are randomly executed in a random testing mode, and the first fragment executed and the first page in which the first fragment is located are recorded to obtain the test result of the first fragment, until the test duration of the random testing mode reaches the first test duration; the graph includes the page jump relationship of the application under test and the controls to be tested within the page, and the fragment is the test content corresponding to the control; Based on the graph, the first segment, and the first page, determine the second segment that was not tested and the second page where the second segment is located; Based on the second page, the second segment is executed by traversing the test mode to obtain the test result of the second segment; The step of randomly executing fragments corresponding to controls on the page of the application under test according to the graph of the application under test through a random testing mode, recording the first executed fragment and the first page where the first fragment is located, and obtaining the test result of the first fragment, until the test duration of the random testing mode reaches the first test duration, includes: Based on the graph of the application under test, the system randomly jumps to the first page of the application under test in a random test mode, and randomly executes the first segment corresponding to the control in the first page to obtain the test result of the first segment; the executed first segment and the first page are recorded; the operations of randomly jumping to the first page, randomly executing the first segment, and recording the first segment and the first page are repeatedly executed until the test duration of the random test mode reaches the first test duration; The step of executing the second segment by traversing the test mode according to the second page to obtain the test result of the second segment includes: Based on the graph and the second page, determine the execution order of the second segment; execute the second segment according to the execution order to obtain the test result of the second segment.
2. The method according to claim 1, characterized in that, Also includes: While recording the first segment and the first page, the first screen corresponding to the first segment and the first page is also recorded; The step of determining the second segment that was not tested and the second page in which the second segment is located, based on the graph, the first segment, and the first page, includes: Based on the graph, the first segment, the first page, and the first screen, determine the second segment that was not tested, the second page where the second segment is located, and the second screen corresponding to the second segment and the second page.
3. The method according to claim 2, characterized in that, The step of executing the second segment by traversing the test mode according to the second page to obtain the test result of the second segment includes: The test results for the second segment are obtained by traversing the test mode and executing the second segment under the second screen and the second page.
4. The method according to claim 1, characterized in that, Also includes: When recording the first executed segment and the first page where the first segment is located, the number of times the first segment is executed is recorded.
5. The method according to claim 1, characterized in that, The first test duration for obtaining the random test mode includes: Obtain the total test duration, and determine the first test duration as a preset proportion of the total test duration.
6. An application testing device, characterized in that, include: The test duration acquisition module is used to obtain the first test duration in random test mode; The random testing module is used to randomly execute fragments corresponding to controls on the pages of the application under test according to the graph of the application under test, and record the first fragment executed and the first page where the first fragment is located, and obtain the test result of the first fragment, until the test duration of the random testing mode reaches the first test duration; the graph includes the page jump relationship of the application under test and the controls to be tested within the page, and the fragment is the test content corresponding to the control; The unexecuted segment determination module is used to determine, based on the graph, the first segment, and the first page, the second segment that has not undergone testing and the second page where the second segment is located; The traversal test module is used to execute the second segment according to the second page through the traversal test mode and obtain the test result of the second segment; The random testing module includes: The fragment random execution unit is used to randomly jump to the first page of the application under test according to the graph of the application under test through a random test mode, and randomly execute the first fragment corresponding to the control in the first page to obtain the test result of the first fragment. An executed segment recording unit is used to record the executed first segment and the first page; The random test control unit is used to repeatedly execute the operations of randomly jumping to the first page, randomly executing the first segment, and recording the first segment and the first page until the test duration of the random test mode reaches the first test duration; The traversal test module includes: An execution order determination unit is used to determine the execution order of the second segment based on the graph and the second page; The test units are traversed to execute the second segment according to the execution order, and the test results of the second segment are obtained.
7. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the application testing method according to any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps of the application testing method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Application program stability test method and device, equipment and medium
CN113986768A
Stability testing method and device based on application program
CN114443502A