Application program testing method and device, electronic equipment and storage medium
By combining random test mode and traversal test mode, randomly executing application fragments with graphs and completing tests through traversal mode after a predetermined time period is reached, the problem of inefficient testing in the prior art is solved, and wider test coverage and higher software quality are achieved.
Patent Information
- Application Number
- CN202411347061.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2044-09-25
AI Technical Summary
In the prior art, application testing is inefficient and cannot meet the requirements of short business delivery cycles and high quality. Especially when the test scope is expanded, it requires a lot of resources and costs.
Using a combination of random test mode and traversal test mode, the fragment corresponding to the controls in the application page to be tested is randomly executed through the graph until the predetermined test time is reached, and then the unexecuted fragment is executed through traversal test mode.
It improves testing efficiency, covers a larger test range, improves the software quality of the application, and can meet the requirements of high delivery quality and short cycle.
Smart Images

Figure CN119782139A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of software testing technology, and in particular, to an application testing method, device, electronic device, and storage medium. Background Art
[0002] Testing an application can detect whether the application meets the requirements. In the prior art, the application is generally tested in a traversal test mode. The traversal test mode is a traditional automated test mode, where one test script is executed at a time, and the test scope and test path of each script are fixed.
[0003] In order to meet the high quality requirements of business delivery, a larger test scope needs to be covered, which will make the test more comprehensive and the software version quality more stable. However, the larger the test scope, the higher the resources and costs invested. If you want to have a larger range of tests in the traversal test mode, test engineers need to write more test scripts, and execute them according to the test scripts. The test efficiency is low and cannot meet the requirements of a short business delivery cycle. Summary of the invention
[0004] The embodiments of the present application provide an application testing method, device, electronic device, and storage medium, which are helpful to improve testing efficiency and application quality.
[0005] In order to solve the above problems, in a first aspect, an embodiment of the present application provides an application testing method, including:
[0006] Get the first test duration of the random test mode;
[0007] According to the graph of the application to be tested, randomly executing the fragments corresponding to the controls in the page of the application to be tested through a random test mode, and recording the executed first 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 test mode reaches the first test duration; the graph includes the page jump relationship of the application to be tested and the controls to be tested in the page, and the fragments are the test contents corresponding to the controls;
[0008] Determine, according to the graph, the first segment and the first page, a second segment on which the test is not performed and a second page on which the second segment is located;
[0009] According to the second page, the second segment is executed by traversing the test mode to obtain a test result of the second segment.
[0010] In a second aspect, an embodiment of the present application provides an application testing device, including:
[0011] A test duration acquisition module, used to acquire a first test duration of a random test mode;
[0012] A random test module, configured to randomly execute the fragments corresponding to the controls in the page of the application to be tested through a random test mode according to the graph of the application to be tested, and record the first fragment that has been 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 test mode reaches the first test duration; the graph includes the page jump relationship of the application to be tested and the controls to be tested in the page, and the fragments are the test contents corresponding to the controls;
[0013] an unexecuted segment determination module, configured to determine, according to the graph, the first segment and the first page, a second segment that has not been tested and a second page where the second segment is located;
[0014] The traversal test module is used to execute the second fragment through the traversal test mode according to the second page to obtain the test result of the second fragment.
[0015] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the application testing method described in the embodiment of the present application when executing the computer program.
[0016] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the steps of the application program testing method disclosed in the embodiment of the present application.
[0017] The application testing method, device, electronic device and storage medium provided in the embodiments of the present application randomly execute the fragments corresponding to the controls in the page of the application to be tested using a random test mode according to the graph of the application to be tested, and record the executed first fragment and the first page where the first fragment is located to obtain the test result of the first fragment until the test duration of the random test mode reaches the first test duration, determine the second fragment that has not been tested and the 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 through a traversal test mode to obtain the test result of the second fragment, and after the test duration of the random test mode reaches the first test duration, use the traversal test mode to execute the second fragment that has not been executed by the random test mode, so that more fragments can be covered, a larger test range can be covered, and the software quality of the application can be improved. Moreover, by encapsulating the test content into fragments, it is convenient to randomly jump and execute each fragment through the random test mode without executing it according to the established test path, which can improve the test efficiency and meet the requirements of high delivery quality and short cycle. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0019] Figure 1 is a flow chart of an application testing method provided by an embodiment of the present application;
[0020] Figure 2 is a diagram showing the relationship between screens, pages, controls, and fragments in an embodiment of the present application;
[0021] Figure 3 is a structural diagram of an application testing device provided in an embodiment of the present application;
[0022] Figure 4 It is a schematic diagram of the structure of a terminal electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0023] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0024] Figure 1 is a flowchart of an application testing method provided in an embodiment of the present application. The application testing method can be applied to electronic devices such as vehicle terminals, mobile phones, and tablet computers. Figure 1 As shown, the method includes: step 110 to step 140.
[0025] Step 110, obtaining a first test duration of a random test mode.
[0026] The first test duration is the execution duration of the test in a random test mode when the application is tested.
[0027] When it is necessary to test an application, you can directly set the testing duration of the application using a random testing mode as the first test duration; or, you can set the total test duration for the application, and use a preset proportion of the total test duration as the first test duration of the random testing model.
[0028] In one embodiment of the present application, obtaining the first test duration of the random test mode includes: obtaining the total test duration, and determining a preset proportion of the total test duration as the first test duration.
[0029] The total test duration is the expected duration of executing the test on the application.
[0030] When the application needs to be tested, the total test duration can be set. The preset ratio of the total test duration is determined as the first test duration of the random test mode. The preset ratio is a ratio value less than 1, for example, the preset ratio can be 80%. The first test duration is less than the total test duration, so a certain test time is reserved to perform the test of the traversal test mode, so that after the test of the random test mode is executed, the traversal test mode can be used to execute the fragments that are not executed by the random test mode. In fact, the test duration of the traversal test mode is not necessarily the reserved duration, and the actual execution time of the test shall prevail. For example, 20% of the total test duration is reserved to execute the remaining fragments. The actual test execution time may be less than 20% of the total test duration, equal to 20% of the total test duration, and higher than 20% of the total test duration. This is normal, mainly based on the actual time of executing the fragments that are not executed in the random test mode.
[0031] Step 120, according to the graph of the application to be tested, randomly execute the fragments corresponding to the controls in the page of the application to be tested through a random test mode, and record the executed first fragment and the first page where the first fragment is located, to obtain the test result of the first fragment, until the test duration of the random test mode reaches the first test duration.
[0032] The graph includes the page jump relationship of the application to be tested and the controls to be tested in the page, and the fragment is the test content corresponding to the control. The fragment is a written test script that implements the test content corresponding to the control. The graph is the page architecture in the application to be tested, which can also be understood as a mind map-style hierarchical structure of each page.
[0033] A control is a clickable display button in any page of a software program. A snippet is the control itself or a small program (also a test point) that extends the control to make it executable code. Figure 2 is a diagram showing the relationship between screens, pages, controls, and fragments in an embodiment of the present application. Figure 2 The figure shows a screen in a vehicle terminal, a page of an application is opened, one or more controls exist in the page, the controls are clickable, and the fragment is a test point extended by the test operation path with the control as the necessary point. Several fragments can be added. One control can correspond to one or more fragments.
[0034] The test of the application to be tested can be performed when the application to be tested meets the test conditions. At this time, the random test mode is first used to test the application to be tested to cover more fragments, thereby covering a larger test range. When performing the test in the random test mode, the fragments corresponding to the controls in a certain page of the application to be tested can be randomly executed according to the map of the application to be tested. In the process of executing the test, the first executed fragment and the first page where the first fragment is located are recorded in real time. After each first fragment is executed, the test result of the first fragment is obtained. After a first fragment is executed, the next fragment is randomly executed until the test duration of the random test mode reaches the first test duration, and the test of the random test mode is ended. The test can be switched to the traversal test mode later.
[0035] Among them, the test conditions are the environmental conditions required to execute the test of the application to be tested. For example, when testing the application to be tested in the vehicle terminal, the test conditions may be that the vehicle is in P gear and the application to be tested has been installed in the vehicle terminal.
[0036] The test result of the first segment can be a test success or a test failure. After executing a certain operation in the first segment, if the result of the operation is the same as the expected result, the test result is a test success. If the result of the operation is different from the expected result, the test result is a test failure. For example, the test content of a first segment is to test whether the play button is normal. When executing the test of the first segment, you need to click the play button. After selecting the track to play and clicking the play button, if the selected track can be played normally, the test result of the first segment is a test success. If the selected track cannot be played normally, the test result of the first segment is a test failure.
[0037] Step 130: Determine, based on the graph, the first segment and the first page, a second segment on which the test is not performed and a second page where the second segment is located.
[0038] Since the graph records each page in the application to be tested and the controls in each page, and the fragments correspond to the controls, based on the recorded executed first fragments and first page, one or more second fragments that have not been tested in the application to be tested and the second page where each second fragment is located can be determined.
[0039] Step 140: According to the second page, execute the second fragment by traversing the test mode to obtain a test result of the second fragment.
[0040] According to the order of the second page, the second page is traversed, and the second segment corresponding to each control in the second page is traversed, and the traversed second segment is executed to obtain the test result of the second segment. The test result of the second segment can be a test success or a test failure. After executing a certain operation in the second segment, if the result of the operation is the same as the expected result, the test result is a test success, and if the result of the operation is different from the expected result, the test result is a test failure.
[0041] The execution process of the traditional traversal test mode is as follows: suppose an application has designed 100 scripts, each script contains manual click operation steps, and the test execution of a script is completed step by step through automation. Similarly, the scripts are executed one by one until all 100 scripts are executed. In other words, the test path is fixed through the test script, and each test path is executed step by step until all the test scripts are executed and the test is completed.
[0042] The specific implementation plan of the traversal test mode, the execution strategy of a script and the complete execution cycle are as follows:
[0043] Suppose a test point is to click a video or audio from never playing to starting playing, the page button UI (UserInterface) is displayed correctly, and there is sound output.
[0044] The design prerequisites are: the vehicle is in P gear and the application to be tested has been installed in the application center.
[0045] Design a test path and write it in the form of code to automatically run the following steps: click the desktop application icon button on the specified screen to open the application; click to enter a certain page; click to open an album; click to open a video or audio; click the play button of this video or audio.
[0046] Design verification points and determine whether they meet the expected results and output test results, which correspond to the designed test paths one by one to ensure that there is no deviation in the execution path: identify the icon of the application under test to verify that it meets expectations, execute to open the application under test, and verify that the application has been opened; open a page, and verify whether the opened page meets expectations by comparing the words or pictures in the opened page; open an album, and verify whether the opened page meets expectations by comparing the words or pictures in the opened page; open a resource, display the play page, and verify that it is on the play page; first verify that the UI is in pause state, click the pause button on the page, verify that the UI displays the play state / play button, and verify that the sound has been output; a fixed test script is executed, and if the verification points do not meet expectations during the period, the test fails, and if they all meet expectations, the test passes; restore the initial environment and return to the desktop, and each script is an independent individual.
[0047] The above is a complete cycle of the traversal test mode execution. In the embodiment of the present application, each fragment is a test script that completes the test corresponding to a control, so that after determining the execution order of each second fragment based on the map and the second page, each second fragment is traversed and executed according to the traversal test mode to obtain the test result of each second fragment.
[0048] In one embodiment of the present application, executing the second fragment by traversing the test mode according to the second page to obtain the test result of the second fragment includes: determining the execution order of the second fragment according to the graph and the second page; executing the second fragment according to the execution order to obtain the test result of the second fragment.
[0049] The graph records the jump relationship of each page, so based on the graph and the second page, the execution order of all the determined second fragments can be determined according to the jump relationship of each second page. For example, control 1 in page 1 needs to open page 2, and page 2 includes control 2 and control 3. Control 1 corresponds to fragment 1, control 2 corresponds to fragment 2, and control 3 corresponds to fragment 3. At this time, the execution order of fragment 1, fragment 2, and fragment 3 can be to execute fragment 1 first, then execute fragment 2, and finally execute fragment 3, or the execution order of fragment 1, fragment 2, and fragment 3 can be to execute fragment 1 first, then execute fragment 3, and finally execute fragment 2.
[0050] After determining the execution order of the second fragments, the second pages where the second fragments are located can be opened in sequence according to the execution order of the second fragments and the second fragments can be executed. After each second fragment is executed, the test result of the second fragment is obtained.
[0051] By determining the execution order of the second fragments according to the graph and the second page, and executing each second fragment according to the execution order, it is achieved that all second fragments that are not executed in the random test mode are executed by traversing the test mode, thereby expanding the test scope and improving the software quality of the application. In addition, sequential execution can further improve the test efficiency.
[0052] It should be noted that although the second half adopts the traversal idea of the traversal test mode, there are still jumps between pages and multiple custom test paths (jumps and test paths in the random test mode) between the unexecuted pages, which is not a traversal test in the full sense of the traversal test mode.
[0053] Table 1 is a comparison result of different test modes. As shown in Table 1, when the traversal test mode is used entirely for testing, the test speed is low and the coverage range is fixed. Only the fixed test path in the pre-written script can be tested, and the fragments outside the fixed test path cannot be covered; when the random test mode is used entirely for testing, the test speed is high, and the coverage range is larger than that of the traversal test mode when the test time is long, but there will still be uncovered fragments; when the random test mode and the traversal test mode in the embodiment of the present application are used for testing in combination, the test speed is basically the same as the test speed of the random test mode, and the fragments that the random test mode cannot cover can be covered, further expanding the test coverage.
[0054] Table 1 Comparison results of different test modes
[0055]
[0056] The application testing method provided by the embodiment of the present application randomly executes the fragments corresponding to the controls in the page of the application to be tested through a random test mode according to the graph of the application to be tested, and records the executed first fragment and the first page where the first fragment is located to obtain the test result of the first fragment until the test duration of the random test mode reaches the first test duration, and determines the second fragment that has not been tested and the second page where each second fragment is located according to the graph, the first fragment and the first page, and executes the second fragment through a traversal test mode according to the second page to obtain the test result of each second fragment, and after the test duration of the random test mode reaches the first test duration, the traversal test mode is used to execute the second fragment that is not executed by the random test mode, so that more fragments can be covered, a larger test range can be covered, and the software quality of the application can be improved, and by encapsulating the test content into fragments, it is convenient to randomly jump and execute each fragment through the random test mode without executing it according to the established test path, which can improve the test efficiency and meet the requirements of high delivery quality and short cycle.
[0057] On the basis of the above technical solution, the method further comprises:
[0058] When recording the first segment and the first page, also recording a first screen corresponding to the first segment and the first page;
[0059] The determining, according to the graph, the first segment and the first page, a second segment where the test is not performed and a second page where the second segment is located includes:
[0060] According to the graph, the first segment, the first page and the first screen, a second segment on which a test is not performed, a second page where the second segment is located and a second screen corresponding to the second segment and the second page are determined.
[0061] The first screen is a screen corresponding to the first segment executed in the random test mode, and the second screen is a screen corresponding to the 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 a vehicle terminal, there may be multiple screens, such as a central control screen, a co-pilot screen, a rear screen, etc. Different pages of the application to be tested may be displayed on the corresponding screens, that is, one page may be displayed on multiple screens or on one screen. In this case, during the test, while recording the first segment and the first page, it is also necessary to record the first screen corresponding to the first segment and the first page, so as to facilitate subsequent traversal test mode testing for screens that have not been tested.
[0063] After the execution time of the random test mode reaches the first test time, it switches to the traversal test mode. When executing the test in the traversal test mode, the second segment that has not been tested is traversed and executed. At this time, it is necessary to first determine the second segment that has not been executed. According to the graph, the first segment, the first page and the first screen, the second segment that has not been tested 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 can be determined. When the second segment is subsequently executed in the traversal test mode, the second screen corresponding to the second segment and the second page can be jumped to the second page and execute the second segment, thereby realizing the testing of applications in different screens in a vehicle terminal with multiple screens.
[0064] On the basis of the above technical solution, according to the second page, the second fragment is executed by traversing the test mode to obtain the test result of the second fragment, including: executing the second fragment under the second screen and the second page by traversing the test mode to obtain the test result of the second fragment.
[0065] After determining the execution order of each second fragment according to the graph, each second fragment is traversed and executed in turn according to the execution order of each second fragment through the traversal test mode. When traversing to a second fragment, jump to the second page corresponding to the second fragment in the second screen corresponding to the second fragment, and execute the second fragment on the second page. After the second fragment is executed, the test result of the second fragment is obtained.
[0066] When executing the second fragment by traversing the test mode, the execution screen of each second fragment is fully considered, which can ensure the implementation of testing in multiple screens, further improve the coverage of the test, and improve the quality of the application program.
[0067] On the basis of the above technical solution, the randomly executing the fragments corresponding to the controls in the page of the application to be tested through the random test mode according to the graph of the application to be tested, and recording the executed first 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 test mode reaches the first test duration, includes:
[0068] According to the graph of the application to be tested, randomly jump to the first page of the application to be tested through a random test mode, and randomly execute a first segment corresponding to a control in the first page to obtain a test result of the first segment;
[0069] Recording the first segment and the first page that have been executed;
[0070] The operations of randomly jumping to the first page, randomly executing the first segment, and recording the first segment and the first page are cyclically performed until the test duration of the random test mode reaches the first test duration.
[0071] According to the graph of the application to be tested, randomly jump to a first page in the application to be tested, and based on the controls included in the first page, randomly execute the first fragment corresponding to one of the controls. After the first fragment is executed, record the executed first fragment and the first page, and randomly jump to another first page, execute the first fragment corresponding to the control under the other first page, and record the executed first fragment and the first page. In this way, randomly jump to the first page and randomly execute the first fragment therein until the test time of the random test mode reaches the first test time, and end the test of the random test mode. By randomly jumping to the first page and randomly executing the first fragment in the first page, random testing is achieved, which can improve the test speed and improve the test efficiency.
[0072] On the basis of the above technical solution, the method further includes: when recording the executed first segment and the first page where the first segment is located, recording the number of executions of the first segment.
[0073] In the test of random test mode, since the first page is randomly jumped according to the graph and the first fragment in the first page is randomly executed, the same fragment may be executed multiple times. Therefore, after the first fragment is executed, the execution count of the first fragment needs to be recorded. In this way, the stress test of the first fragment can be implemented at the same time without the need to write additional stress test scripts.
[0074] When using the random test mode to execute the test task, you need to set a fixed first test duration (such as 4 hours). During the test execution, it will randomly jump to a page, execute the control-fragment in the page, and then jump to the page to execute the control-fragment, simulating the random clicking of human thinking, and executing as a very long operation path until the execution meets the set duration, and then the execution will stop.
[0075] The specific implementation plan of the random test mode, the execution strategy of a script and the complete execution cycle are as follows:
[0076] Suppose a test point is to click a video or audio from never playing to starting playing, the page button UI is displayed correctly, and there is sound output.
[0077] Scenario management: Maintain the prerequisites in scenario management (such as the vehicle is in P gear).
[0078] Follow the steps below to build the test path + test point + verification point: first build the map, that is, the architecture of each software page, which can be understood as a mind map-style hierarchical structure; obtain the control elements and parameters of each page; add fragments, and add fragments based on the controls (that is, test points, such as clicking the pause button to start playing); improve the test point script + verification point (UI display).
[0079] Follow the steps below to use the random test model to perform the test task: select the screen parameters for the task (central control screen, co-pilot screen and / or rear screen); set the first test duration for the task, such as 4 hours; the test execution will randomly jump to a certain page or / and any fragment within the execution page; while executing, record the first page, the first fragment and the number of executions of each first fragment, and execute any fragment continuously; until the first test duration set for the task (such as 4 hours) is met, the test stops automatically, and the test task in the random test mode ends.
[0080] The embodiment of the present application is more suitable for application testing in vehicle terminals. Since the test of vehicle terminal applications is multi-screen interactive, the user usage scenarios are also very wide. The combination of random test mode and traversal test mode can cover a larger test range. The increase in the test time of the random test mode will cover a larger test range, and the test efficiency can be improved by the test of the random test mode. After practice, the application testing method provided by the embodiment of the present application can increase the test coverage and test efficiency by 6 to 10 times.
[0081] Figure 3 is a schematic diagram of the structure of an application testing device provided in an embodiment of the present application, such as Figure 3 As shown, the device comprises:
[0082] A test duration acquisition module 210, used to acquire a first test duration of a random test mode;
[0083] A random test module 220 is used to randomly execute the fragments corresponding to the controls in the page of the application to be tested through a random test mode according to the graph of the application to be tested, and record the first fragment that has been 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 test mode reaches the first test duration; the graph includes the page jump relationship of the application to be tested and the controls to be tested in the page, and the fragments are the test content corresponding to the controls;
[0084] An unexecuted segment determination module 230, configured to determine, based on the graph, the first segment and the first page, a second segment of an unexecuted test and a second page where the second segment is located;
[0085] The traversal test module 240 is used to execute the second segment through the traversal test mode according to the second page to obtain the test result of the second segment.
[0086] Optionally, the traversal test module includes:
[0087] an execution order determination unit, configured to determine an execution order of the second fragments according to the graph and the second page;
[0088] The traversal test unit is used to execute the second fragment according to the execution order to obtain the test result of the second fragment.
[0089] Optionally, the device further comprises:
[0090] a recording module, configured to record, when recording the first segment and the first page, also a first screen corresponding to the first segment and the first page;
[0091] The unexecuted segment determination module is specifically used for:
[0092] According to the graph, the first segment, the first page and the first screen, a second segment on which a test is not performed, a second page where the second segment is located and a second screen corresponding to the second segment and the second page are determined.
[0093] Optionally, the traversal test module is specifically used for:
[0094] The second screen and the second fragment under the second page are executed by traversing the test mode to obtain a test result of the second fragment.
[0095] Optionally, the random test module includes:
[0096] a fragment random execution unit, configured to randomly jump to a first page of the application to be tested through a random test mode according to the graph of the application to be tested, and randomly execute a first fragment corresponding to a control in the first page to obtain a test result of the first fragment;
[0097] An executed segment recording unit, used for recording the first segment and the first page that have been executed;
[0098] The random test control unit is used to cyclically 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.
[0099] Optionally, the device further comprises:
[0100] The execution times recording module is used to record the execution times of the first segment when recording the executed first segment and the first page where the first segment is located.
[0101] Optionally, the test duration acquisition module is specifically used to:
[0102] The total test duration is obtained, and a preset proportion of the total test duration is determined as the first test duration.
[0103] The application testing device provided in the embodiment of the present application is used to implement the various steps of the application testing method described in the embodiment of the present application. The specific implementation methods of each module of the device refer to the corresponding steps and will not be repeated here.
[0104] The application testing device provided in the embodiment of the present application randomly executes the fragments corresponding to the controls in the page of the application to be tested through a random test mode according to the graph of the application to be tested, and records the executed first fragment and the first page where the first fragment is located, to obtain the test result of the first fragment, until the test duration of the random test mode reaches the first test duration, and determines the second fragment that has not been tested and the second page where each second fragment is located according to the graph, the first fragment and the first page, and executes the second fragment through a traversal test mode according to the second page to obtain the test result of each second fragment, and after the test duration of the random test mode reaches the first test duration, the traversal test mode is used to execute the second fragment that is not executed by the random test mode, so that more fragments can be covered, a larger test range can be covered, and the software quality of the application can be improved, and by encapsulating the test content into fragments, it is convenient to randomly jump and execute each fragment through the random test mode without executing it according to the established test path, which can improve the test efficiency and meet the requirements of high delivery quality and short cycle.
[0105] Figure 4 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, such as Figure 4 As shown, the electronic device 300 may include one or more processors 310 and one or more memories 320 connected to the processor 310. The electronic device 300 may 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 may be stored in the memory 320.
[0106] The processor 310 in the electronic device 300 calls the program code stored in the memory 320 to execute the application program testing method in the above embodiment.
[0107] The embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the application program testing method described in the embodiment of the present application are implemented.
[0108] The embodiment of the present application also provides a computer program product, which, when executed by a processor, implements the steps of the application program testing method as described in the embodiment of the present application.
[0109] Each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments 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 partial description of the method embodiment.
[0110] The above is a detailed introduction to an application testing method, device, electronic device and storage medium provided in an embodiment of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
[0111] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art 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 ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to 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 of the random test mode; According to the graph of the application to be tested, randomly executing the fragments corresponding to the controls in the page of the application to be tested through a random test mode, and recording the executed first 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 test mode reaches the first test duration; the graph includes the page jump relationship of the application to be tested and the controls to be tested in the page, and the fragments are the test contents corresponding to the controls; Determine, according to the graph, the first segment and the first page, a second segment on which the test is not performed and a second page on which the second segment is located; According to the second page, the second segment is executed by traversing the test mode to obtain a test result of the second segment.
2. The method according to claim 1, characterized in that The step of executing the second fragment by traversing the test mode according to the second page to obtain a test result of the second fragment includes: Determining the execution order of the second fragments according to the graph and the second page; Execute the second segment according to the execution order to obtain a test result of the second segment.
3. The method according to claim 1, characterized in that Also includes: When recording the first segment and the first page, also recording a first screen corresponding to the first segment and the first page; The determining, according to the graph, the first segment and the first page, a second segment where the test is not performed and a second page where the second segment is located includes: According to the graph, the first segment, the first page and the first screen, a second segment on which a test is not performed, a second page where the second segment is located, and a second screen corresponding to the second segment and the second page are determined.
4. The method according to claim 3, characterized in that The step of executing the second fragment by traversing the test mode according to the second page to obtain a test result of the second fragment includes: The second screen and the second fragment under the second page are executed by traversing the test mode to obtain a test result of the second fragment.
5. The method according to claim 1, characterized in that The step of randomly executing the fragments corresponding to the controls in the page of the application to be tested in a random test mode according to the graph of the application to be tested, and recording the executed first 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 test mode reaches the first test duration includes: According to the graph of the application to be tested, randomly jump to the first page of the application to be tested through a random test mode, and randomly execute a first segment corresponding to a control in the first page to obtain a test result of the first segment; Recording the first segment and the first page that have been executed; The operations of randomly jumping to the first page, randomly executing the first segment, and recording the first segment and the first page are cyclically performed until the test duration of the random test mode reaches the first test duration.
6. The method according to claim 1, characterized in that Also includes: When recording the executed first segment and the first page where the first segment is located, the execution times of the first segment are recorded.
7. The method according to claim 1, characterized in that The obtaining of a first test duration of a random test mode includes: The total test duration is obtained, and a preset proportion of the total test duration is determined as the first test duration.
8. An application testing device, characterized in that: include: A test duration acquisition module, used to acquire a first test duration of a random test mode; A random test module, configured to randomly execute the fragments corresponding to the controls in the page of the application to be tested through a random test mode according to the graph of the application to be tested, and record the first fragment that has been 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 test mode reaches the first test duration; the graph includes the page jump relationship of the application to be tested and the controls to be tested in the page, and the fragments are the test contents corresponding to the controls; an unexecuted segment determination module, configured to determine, according to the graph, the first segment and the first page, a second segment that has not been tested and a second page where the second segment is located; The traversal test module is used to execute the second fragment through the traversal test mode according to the second page to obtain the test result of the second fragment.
9. 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, the application program testing method described in any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the application testing method described in any one of claims 1 to 7 are implemented.
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
Test case generation method and device, medium and electronic equipment
CN116401173A
Application stability test method, terminal equipment and storage medium
CN116414716A
Application program testing method and device, computer equipment and readable storage medium
CN118503114A