Software testing method and device and storage medium
By using event tracking technology in software testing to obtain and analyze test execution information, determine scenario coverage, and promptly supplement missing scenarios, the problem of missing test scenarios was solved, and the test quality was improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- INDUSTRIAL AND COMMERCIAL BANK OF CHINA
- Filing Date
- 2025-12-15
- Publication Date
- 2026-04-17
AI Technical Summary
Existing technologies often overlook software testing scenarios, leading to lower test quality.
By embedding test points in the target software's code, test execution information is obtained, the target scenarios that have been tested are identified, scenario coverage is calculated, and a reminder message is triggered when the coverage falls below a threshold to supplement the test scenarios.
It enables timely and accurate identification and supplementation of test scenarios, thereby improving test quality.
Smart Images

Figure CN121880176A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of financial technology, and more specifically, to a software testing method, apparatus, and storage medium. Background Technology
[0002] To comprehensively evaluate the software's functionality, performance, and security, the development process requires testing the software across multiple business scenarios. Each scenario necessitates executing a series of operational steps to cover various usage situations and boundary conditions that may arise during software use. Software testing needs to cover multiple business scenarios to uncover as many potential problems as possible.
[0003] However, in related technologies, testers mainly rely on manually recording and checking test scenario coverage. This method is not only time-consuming and labor-intensive but also prone to omissions. Even when using some test management tools, testers still need to manually compare and confirm, making it difficult to identify omissions in test scenarios in real time and accurately.
[0004] There is currently no effective solution to the problem that test scenarios in related technologies are prone to omissions, resulting in low test quality. Summary of the Invention
[0005] The main purpose of this application is to provide a software testing method, apparatus and storage medium to solve the problem that test scenarios are prone to omissions in related technologies, resulting in low test quality.
[0006] To achieve the above objectives, according to one aspect of this application, a software testing method is provided. The method includes: acquiring a preset set of scenarios and a scenario coverage threshold; during the testing of target software, determining multiple tested target scenarios through data entry points in the target software's code; determining test scenario coverage based on the multiple target scenarios and the preset set of scenarios; and triggering a notification message regarding the test scenario coverage if the test scenario coverage is lower than the scenario coverage threshold.
[0007] Furthermore, during the testing of the target software, determining the multiple target scenarios that have been tested through the instrumentation points in the target software's code includes: obtaining the execution information of each test through instrumentation points during the testing of the target software, thus obtaining multiple execution information; for any execution information, determining the target scenario corresponding to the execution information; and determining the multiple target scenarios that have been tested based on the target scenarios corresponding to the multiple execution information.
[0008] Furthermore, determining the target scenario corresponding to the execution information based on the execution information includes: if the execution information includes scenario parameters, obtaining the scenario parameters in the execution information; and determining the target scenario corresponding to the scenario parameters based on a preset parameter lookup table.
[0009] Furthermore, determining the target scenario corresponding to the execution information based on the execution information includes: when the execution information does not include scenario parameters, obtaining the code parameters in the execution information, wherein the code parameters include a set of function names and a set of function parameters of the software code; inputting the set of function names and the set of function parameters into the scenario recognition model, and using the scenario recognition model to predict the target scenario corresponding to the execution information.
[0010] Furthermore, when the test scenario coverage is lower than the scenario coverage threshold, the reminder information triggered for the test scenario coverage includes: when the test scenario coverage is lower than the scenario coverage threshold, determining the scenario to be tested based on a preset scenario set and multiple target scenarios; determining the information of the target tester based on the tracking points, and determining the target push method based on the information of the target tester; sending the scenario to be tested to the target tester according to the target push method to remind the target tester to conduct supplementary testing on the scenario to be tested.
[0011] Furthermore, after determining the test scenario coverage based on multiple target scenarios and a preset scenario set, the method also includes: receiving incremental scenario information sent by testers and updating the preset scenario set based on the incremental scenario information, wherein the incremental scenario information includes scenario information to be added to the preset scenario set; determining the target code segment in the software code based on the incremental scenario information, and adding tracking points in the target code segment.
[0012] To achieve the above objectives, according to another aspect of this application, a software testing apparatus is provided. The apparatus includes: a data acquisition unit for acquiring a preset set of scenarios and a scenario coverage threshold; a scenario determination unit for determining multiple tested target scenarios through embedded points in the software code of the target software during the testing of the target software; and a reminder triggering unit for determining a test scenario coverage rate based on the multiple target scenarios and the preset set of scenarios, and triggering a reminder message regarding the test scenario coverage rate when the test scenario coverage rate is lower than the scenario coverage threshold.
[0013] Furthermore, the scenario determination unit includes: an execution information acquisition module, used to acquire execution information for each test by embedding points during the testing of the target software, thereby obtaining multiple execution information; an execution information analysis module, used to determine the target scenario corresponding to any execution information; and a target scenario determination module, used to determine multiple tested target scenarios based on the target scenarios corresponding to multiple execution information.
[0014] Furthermore, the execution information analysis module includes: a scene parameter acquisition submodule, used to acquire scene parameters in the execution information when the execution information includes scene parameters; and a parameter comparison submodule, used to determine the target scene corresponding to the scene parameters based on a preset parameter comparison table.
[0015] Furthermore, the execution information analysis module includes: a code parameter acquisition submodule, used to acquire code parameters in the execution information when the execution information does not include scene parameters, wherein the code parameters include a set of function names and a set of function parameters of the software code; and a target scene prediction submodule, used to input the set of function names and the set of function parameters into the scene recognition model, and use the scene recognition model to predict the target scene corresponding to the execution information.
[0016] Furthermore, the reminder triggering unit includes: a test scenario determination module, used to determine the test scenario based on a preset scenario set and multiple target scenarios when the test scenario coverage is lower than the scenario coverage threshold; a push determination module, used to determine the target tester's information based on the data points and determine the target push method based on the target tester's information; and a target push module, used to send the test scenario to the target tester according to the target push method to remind the target tester to conduct supplementary testing on the test scenario.
[0017] Furthermore, the device also includes: a scene update unit, used to receive incremental scene information sent by testers after determining the test scene coverage based on multiple target scenes and a preset scene set, and update the preset scene set based on the incremental scene information, wherein the incremental scene information includes scene information to be added for the preset scene set; and a tracking point update unit, used to determine the target code segment in the software code based on the incremental scene information, and add tracking points in the target code segment.
[0018] According to another aspect of this application, a computer-readable storage medium is provided, which includes a stored program, wherein, when the program is executed, it controls the device on which the computer-readable storage medium is located to execute any software testing method.
[0019] According to another aspect of this application, an electronic device is provided, comprising: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include methods for performing any software testing method.
[0020] According to another aspect of this application, a computer program product is provided, including computer instructions that, when executed by a processor, implement the steps of the software testing method described above.
[0021] In this embodiment, a preset set of scenarios and a scenario coverage threshold are obtained; during the testing of the target software, multiple target scenarios that have been tested are determined by the embedding points in the software code of the target software; the test scenario coverage is determined based on the multiple target scenarios and the preset set of scenarios; and when the test scenario coverage is lower than the scenario coverage threshold, a reminder message for the test scenario coverage is triggered, which solves the technical problem in the prior art that test scenarios are easily missed, resulting in low test quality.
[0022] By identifying multiple target scenarios based on data points during the testing of the target software, the actual test scenario coverage is obtained. When the test scenario coverage falls below the scenario coverage threshold, a reminder message is triggered to remind testers to complete supplementary testing, thus avoiding omissions in test scenarios and improving test quality. Attached Figure Description
[0023] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:
[0024] Figure 1 A hardware structure block diagram of a computer terminal for implementing software testing methods is shown.
[0025] Figure 2 This is a flowchart of a software testing method provided according to an embodiment of this application;
[0026] Figure 3 This is a schematic diagram of a software testing apparatus provided according to an embodiment of this application;
[0027] Figure 4 This is a structural block diagram of an electronic device according to an embodiment of this application. Detailed Implementation
[0028] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0029] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0030] It should be noted that the information collected in this application (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) are information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, storage, use, processing, transmission, provision, disclosure, and application of this data all comply with relevant laws, regulations, and standards, necessary confidentiality measures have been taken, and they do not violate public order and good morals. Corresponding access points are provided for users to choose to authorize or refuse. For example, interfaces are set up between this system and relevant users or organizations, providing users with corresponding access points to choose to agree to or refuse automated decision-making results; if the user chooses to refuse, the process proceeds to the expert decision-making stage.
[0031] Example 1
[0032] According to an embodiment of this application, a method embodiment for software testing is also provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0033] The method embodiment provided in Embodiment 1 of this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1 A hardware structure block diagram of a computer terminal (or mobile device) for implementing a software testing method is shown. Figure 1 As shown, the computer terminal 10 (or mobile device) may include one or more processors 102 (shown as 102a, 102b, ..., 102n in the figure) 102 (processor 102 may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0034] It should be noted that the aforementioned one or more processors 102 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10 (or mobile device). As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).
[0035] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the software testing method in this embodiment. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby implementing the aforementioned software testing method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0036] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0037] The display may be, for example, a touchscreen liquid crystal display (LCD) that allows the user to interact with the user interface of the computer terminal 10 (or mobile device).
[0038] Under the aforementioned operating environment, this application provides the following: Figure 2 The software testing method shown. Figure 2 This is a flowchart of a software testing method according to Embodiment 1 of this application.
[0039] Step S201: Obtain the preset scene set and scene coverage threshold.
[0040] Optionally, a software test configuration file can be received via a program interface, and a preset set of scenarios and scenario coverage thresholds can be read by parsing the software test configuration file. The scenario coverage threshold is used to represent the scenario coverage requirements for testing the target software, and different scenario coverage thresholds can be set for different projects or software.
[0041] For example, the set of preset scenarios can include multiple preset business scenarios, such as transaction query scenario, repayment scenario, incorrect password input scenario, security log audit scenario, etc.
[0042] Step S202: During the testing of the target software, multiple target scenarios that have been tested are determined by the embedded points in the software code of the target software.
[0043] Optionally, event tracking is a technique for collecting data in a product or application. It involves inserting code snippets at specific locations to record relevant data for analysis. Event tracking code statements can be inserted into the target software's code before testing. During testing, the code is invoked, triggering these event tracking points and recording execution information. This execution information can be parsed to determine the target scenario for each test, thus obtaining multiple tested target scenarios.
[0044] Step S203: Determine the test scenario coverage based on multiple target scenarios and a preset scenario set, and trigger a reminder message for the test scenario coverage if the test scenario coverage is lower than the scenario coverage threshold.
[0045] Optionally, since target scenarios may overlap in different tests, the `set` function in Python can be used to deduplicate multiple target scenarios, resulting in a deduplicated set of tested scenarios (which includes multiple deduplicated tested scenarios). The `len` function is used to determine the number of elements in the deduplicated set of tested scenarios, thus obtaining the number of tested scenarios. The `len` function is also used to determine the number of elements in the preset set of scenarios, thus obtaining the total number of scenarios. The quotient obtained by dividing the number of tested scenarios by the total number of scenarios is determined as the test scenario coverage.
[0046] For example, if the scenario coverage threshold is 91%, and the test scenario coverage is 89%, a notification regarding the missing test scenario coverage will be triggered. This notification can be triggered via a pop-up window reminding testers that there are currently uncovered test scenarios. Alternatively, an email can be sent to the testers' inboxes reminding them to conduct additional testing as soon as possible.
[0047] In summary, by identifying multiple target scenarios based on data points during the testing of the target software, the actual test scenario coverage was obtained. Furthermore, when the test scenario coverage fell below the threshold, a reminder message was triggered, thus enabling timely and accurate reminders for testers to complete supplementary testing, avoiding omissions in test scenarios, and improving test quality.
[0048] To improve testing quality, during the testing of the target software, multiple target scenarios that have been tested are determined by tracking points in the target software code. This includes: obtaining execution information for each test through tracking points during the testing of the target software, resulting in multiple execution information; determining the target scenario corresponding to any given execution information; and determining the multiple target scenarios that have been tested based on the target scenarios corresponding to the multiple execution information.
[0049] Optionally, during the testing of the target software, pre-set tracking points in the software code will be activated as the test progresses, thereby collecting and reporting test execution information based on these tracking points. Testing of the target software can be based on a test database, which stores test cases (e.g., test operation descriptions, expected results, etc.) and scenario parameters. There is a one-to-one correspondence between test cases and scenario parameters. Therefore, after the software code reads data from the test database, the execution information will include scenario parameters. By parsing the scenario parameters, the target scenario can be obtained. Each test yields one tested target scenario, and multiple tests can yield multiple tested target scenarios.
[0050] In summary, by acquiring execution information for each test during the testing of the target software through instrumentation, multiple execution information can be obtained. For any given execution information, the target scenario corresponding to that execution information can be determined. Based on the target scenarios corresponding to multiple execution information, multiple target scenarios that have been tested can be identified. This allows for the timely discovery of uncovered preset business scenarios (i.e., preset business scenarios that have not been tested), avoiding omissions in test scenarios and improving test quality.
[0051] To improve testing quality, determining the target scenario corresponding to the execution information includes: if the execution information includes scenario parameters, obtaining the scenario parameters in the execution information; and determining the target scenario corresponding to the scenario parameters based on a preset parameter lookup table.
[0052] For example, for a particular test, execution information was obtained through event tracking. By parsing the execution information, it was determined whether the scenario parameter in the execution information was empty. If it was not empty, then the execution information included the scenario parameter. Suppose the scenario parameter was obtained as "CJ005". By searching through a preset parameter lookup table, it was found that the target scenario corresponding to the scenario parameter "CJ005" was the transaction query scenario.
[0053] In summary, by obtaining the scene parameters from the execution information when they are included, and determining the target scene corresponding to the scene parameters based on a preset parameter lookup table, the test quality is improved.
[0054] To improve testing quality, determining the target scenario corresponding to the execution information based on the execution information includes: when the execution information does not include scenario parameters, obtaining the code parameters in the execution information, where the code parameters include a set of function names and a set of function parameters of the software code; inputting the set of function names and the set of function parameters into the scenario recognition model, and using the scenario recognition model to predict the target scenario corresponding to the execution information.
[0055] Optionally, event tracking is used to capture scene parameters and code parameters. By parsing the execution information, it is determined whether the scene parameters in the execution information are empty. If the scene parameters are empty, then the execution information does not include scene parameters. In this case, the code parameters in the execution information can be obtained. The code parameters can include a set of function names and a set of function parameters in the software code. The function names represent the type of operation performed during the test, and the function parameters represent the data called during the test. The code parameters are used to represent the function execution information of the software code during the test. The code parameters are input into the scene recognition model, which classifies the data based on the code parameters to map it to the corresponding target scene, thereby achieving the prediction of the target scene of the test.
[0056] Optionally, to improve the accuracy of predicting target scenarios, functions in the software code can be selected to obtain multiple preset key functions (e.g., the main function). The instrumentation points can be set at the entry point (e.g., the first line of all code in the function) and the exit point (e.g., the line before the return statement) of the preset key functions in the software code to capture code parameters as comprehensively as possible.
[0057] For example, all code parameters generated in a single test can be aggregated according to the chronological order in which they were captured to form a complete execution trajectory. This trajectory can then be vectorized and its dimensionality reduced to obtain execution trajectory features. Simultaneously, each function name can be vectorized to obtain multiple function name features. The data names called from the function parameters can be extracted and vectorized to obtain multiple data name features. These execution trajectory features, function name features, and data name features are then input into a scene recognition model to obtain the target scene. The scene recognition model can be a model trained on a gradient boosting tree model. Those skilled in the art, knowing the input and output data of the aforementioned scene recognition model, can collect and label samples to construct a training dataset, and then use this training dataset to train the gradient boosting tree model to obtain the scene recognition model.
[0058] Optionally, the event tracking points are used to capture scene parameters and code parameters. By parsing the execution information, it is determined whether the scene parameters in the execution information are empty. If the scene parameters are empty, then the execution information does not include scene parameters. At this time, the code parameters in the execution information can be obtained. The code parameters may include a set of function names and a set of function parameters in the software code. The code parameters are input into the scene recognition model, and the scene recognition model is used to predict the target scene.
[0059] In summary, by obtaining code parameters from event tracking points and using a scene recognition model for prediction, the target scene corresponding to the code parameters can be obtained, which can promptly identify any omissions in the test scene and improve the test quality.
[0060] To improve testing quality, when the test scenario coverage is lower than the scenario coverage threshold, the following reminder information is triggered: when the test scenario coverage is lower than the scenario coverage threshold, the scenario to be tested is determined based on a preset scenario set and multiple target scenarios; the information of the target tester is determined based on the tracking points, and the target push method is determined based on the information of the target tester; the scenario to be tested is sent to the target tester according to the target push method to remind the target tester to conduct supplementary testing on the scenario to be tested.
[0061] Optionally, the preset scenario set includes multiple preset business scenarios. If the test scenario coverage is lower than the scenario coverage threshold, untested preset business scenarios can be identified from the preset scenario set based on multiple target scenarios, resulting in multiple untested scenarios (i.e., scenarios to be tested). Execution information can be obtained through event tracking, and the set of function parameters in the execution information can be obtained. The target data table (i.e., the target data table called when a function in the software code passes parameters) can be determined through the set of function parameters. The information of the testers can be determined based on the mapping relationship between the preset target data table and the testers. The information of the testers can include the tester ID and the tester's preferred information receiving method. The tester's preferred information receiving method is determined as the target push method (e.g., email push, SMS push, etc.). The scenarios to be tested are sent to the target testers according to the target push method to remind them to conduct supplementary testing on the scenarios to be tested.
[0062] In summary, by determining the test scenarios based on a preset set of scenarios and multiple target scenarios when the test scenario coverage is lower than the scenario coverage threshold, the system identifies the target testers' information based on the tracking points, determines the target push method based on the target testers' information, and sends the test scenarios to the target testers according to the target push method to remind them to conduct supplementary testing on the test scenarios. This effectively supplements the testing of missed test scenarios and improves the test quality.
[0063] To improve testing quality, after determining the test scenario coverage based on multiple target scenarios and a preset scenario set, the method further includes: receiving incremental scenario information sent by testers and updating the preset scenario set based on the incremental scenario information, wherein the incremental scenario information includes scenario information to be added to the preset scenario set; determining the target code segment in the software code based on the incremental scenario information, and adding instrumentation points in the target code segment.
[0064] Optionally, during the testing process, testers may discover new test scenario requirements. These scenarios are called incremental scenarios. Incremental scenario information includes the names of multiple incremental scenarios and the corresponding test cases. These incremental scenarios can be identified as scenarios to be added to a preset scenario set, and the information of these scenarios to be added (e.g., the names of the incremental scenarios) can be added to the preset scenario set. For each piece of incremental scenario information, the relevant target code segments can be determined in the software code based on the functional points involved in the incremental scenario information, and instrumentation points can be added to these code segments to capture execution information for future tests targeting that scenario.
[0065] In summary, by receiving incremental scenario information sent by testers, updating the preset scenario set based on this information, identifying target code segments in the software code, and adding tracking points within these target code segments, testing quality is improved. It should be noted that the steps shown in the flowchart in the attached figures can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that presented here.
[0066] Example 2
[0067] This application also provides a software testing apparatus. It should be noted that the software testing apparatus of this application can be used to execute the software testing method provided in this application. The software testing apparatus provided in this application is described below.
[0068] According to an embodiment of this application, an apparatus for implementing the above-described software testing method is also provided, such as... Figure 3 As shown, the device includes:
[0069] The data acquisition unit 301 is used to acquire a preset set of scenes and scene coverage thresholds.
[0070] The scene determination unit 302 is used to determine multiple target scenes that have been tested by means of embedded points in the software code of the target software during the testing process of the target software.
[0071] The reminder triggering unit 303 is used to determine the test scene coverage rate based on the multiple target scenes and the preset scene set, and to trigger a reminder message for the test scene coverage rate when the test scene coverage rate is lower than the scene coverage rate threshold.
[0072] The software testing apparatus provided in this application embodiment acquires a preset scene set and scene coverage threshold through a data acquisition unit 301. During the testing of target software, a scene determination unit 302 identifies multiple tested target scenes using embedded points in the target software's code. An alert triggering unit 303 determines the test scene coverage based on the multiple target scenes and the preset scene set. If the test scene coverage is lower than the scene coverage threshold, an alert message is triggered regarding the test scene coverage. This solves the problem in related technologies where test scenes are easily missed, leading to low test quality. Therefore, it improves test quality.
[0073] Optionally, in the software testing apparatus provided in this application embodiment, the scenario determination unit 302 includes: an execution information acquisition module, used to acquire execution information of each test by embedding points during the testing of the target software, and obtain multiple execution information; an execution information analysis module, used to determine the target scenario corresponding to any execution information based on the execution information; and a target scenario determination module, used to determine multiple tested target scenarios based on the target scenarios corresponding to the multiple execution information.
[0074] Optionally, in the software testing apparatus provided in this application embodiment, the execution information analysis module includes: a scene parameter acquisition submodule, used to acquire scene parameters in the execution information when the execution information includes scene parameters; and a parameter comparison submodule, used to determine the target scene corresponding to the scene parameters according to a preset parameter comparison table.
[0075] Optionally, in the software testing apparatus provided in this application embodiment, the execution information analysis module includes: a code parameter acquisition submodule, used to acquire code parameters in the execution information when the execution information does not include scene parameters, wherein the code parameters include a set of function names and a set of function parameters of the software code; and a target scene prediction submodule, used to input the set of function names and the set of function parameters into a scene recognition model, and use the scene recognition model to predict the target scene corresponding to the execution information.
[0076] Optionally, in the software testing apparatus provided in this application embodiment, the reminder triggering unit 303 includes: a test scenario determination module, used to determine the test scenario based on a preset scenario set and multiple target scenarios when the test scenario coverage is lower than the scenario coverage threshold; a push determination module, used to determine the target tester's information based on the data points and determine the target push method based on the target tester's information; and a target push module, used to send the test scenario to the target tester according to the target push method to remind the target tester to perform supplementary testing on the test scenario.
[0077] Optionally, in the software testing apparatus provided in this application embodiment, the apparatus further includes: a scene update unit, configured to receive incremental scene information sent by testers after determining the test scene coverage based on multiple target scenes and a preset scene set, and update the preset scene set based on the incremental scene information, wherein the incremental scene information includes scene information to be added for the preset scene set; and a tracking point update unit, configured to determine a target code segment in the software code based on the incremental scene information, and add tracking points in the target code segment.
[0078] It should be noted that the data acquisition unit 301, scene determination unit 302, and reminder triggering unit 303 mentioned above correspond to steps S201 to S203 in Embodiment 1. The instances and application scenarios implemented by the units and corresponding steps are the same, but are not limited to the content disclosed in Embodiment 1. It should be noted that the above modules or units can be hardware or software components stored in memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n). The above modules can also be part of the device and run in the computer terminal 10 provided in Embodiment 1.
[0079] Example 3
[0080] Embodiments of this application may provide an electronic device. Figure 4 This is a structural block diagram of an electronic device according to an embodiment of this application. Figure 4 As shown, the electronic device may include: one or more ( Figure 4 (Only one is shown) processor 1002, memory 1004, memory controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module and display.
[0081] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the methods and apparatus in the embodiments of this application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby implementing the above-described methods. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0082] The processor can access information and applications stored in memory via a transmission device to perform the following steps: obtain a preset set of scenarios and a scenario coverage threshold; during the testing of the target software, determine multiple target scenarios that have been tested through the embedded points in the software code of the target software; determine the test scenario coverage based on the multiple target scenarios and the preset set of scenarios, and trigger a reminder message for the test scenario coverage if the test scenario coverage is lower than the scenario coverage threshold.
[0083] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: during the testing of the target software, the execution information of each test is obtained by embedding points to obtain multiple execution information; for any execution information, the target scenario corresponding to the execution information is determined based on the execution information; the multiple target scenarios that have been tested are determined based on the target scenarios corresponding to the multiple execution information.
[0084] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: if the execution information includes scene parameters, obtain the scene parameters in the execution information; determine the target scene corresponding to the scene parameters according to the preset parameter lookup table.
[0085] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: if the execution information does not include scene parameters, obtain the code parameters in the execution information, wherein the code parameters include a set of function names and a set of function parameters of the software code; input the set of function names and the set of function parameters into the scene recognition model, and use the scene recognition model to predict the target scene corresponding to the execution information.
[0086] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: when the test scenario coverage is lower than the scenario coverage threshold, determine the scenario to be tested based on the preset scenario set and multiple target scenarios; determine the information of the target testers based on the tracking points, and determine the target push method based on the information of the target testers; send the scenario to be tested to the target testers according to the target push method to remind the target testers to conduct supplementary testing on the scenario to be tested.
[0087] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: receive incremental scene information sent by the tester, and update the preset scene set according to the incremental scene information, wherein the incremental scene information includes scene information to be added to the preset scene set; determine the target code segment in the software code according to the incremental scene information, and add the tracking point in the target code segment.
[0088] This application provides a software testing solution. By acquiring a preset set of scenarios and a scenario coverage threshold, during the testing of the target software, multiple target scenarios are identified through tracking points in the target software's code. The test scenario coverage is determined based on the multiple target scenarios and the preset set of scenarios. If the test scenario coverage is lower than the scenario coverage threshold, a reminder message is triggered regarding the test scenario coverage. This solves the technical problem in the prior art where test scenarios are easily missed, leading to low test quality.
[0089] Those skilled in the art will understand that Figure 4 The structure shown is for illustrative purposes only. Electronic devices can also be smartphones, tablets, handheld computers, mobile internet devices (MIDs), PADs, and other terminal devices. Figure 4 This does not limit the structure of the aforementioned electronic device. For example, electronic devices may also include components that are more... Figure 4 The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same Figure 4 The different configurations shown.
[0090] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0091] Example 4
[0092] Embodiments of this application also provide a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the software testing method provided in Embodiment 1.
[0093] Optionally, in this embodiment, the storage medium may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.
[0094] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: obtaining a preset set of scenarios and a scenario coverage threshold; during the testing of the target software, determining multiple target scenarios that have been tested through the embedding points in the software code of the target software; determining the test scenario coverage based on the multiple target scenarios and the preset set of scenarios, and triggering a reminder message for the test scenario coverage if the test scenario coverage is lower than the scenario coverage threshold.
[0095] Optionally, in this embodiment, the computer-readable storage medium is further configured to store program code for performing the following steps: during the testing of the target software, obtaining execution information for each test by embedding data points to obtain multiple execution information; for any execution information, determining the target scenario corresponding to the execution information based on the execution information; determining multiple target scenarios that have been tested based on the target scenarios corresponding to the multiple execution information.
[0096] Optionally, in this embodiment, the computer-readable storage medium is further configured to store program code for performing the following steps: if the execution information includes scene parameters, obtaining the scene parameters in the execution information; and determining the target scene corresponding to the scene parameters according to a preset parameter lookup table.
[0097] Optionally, in this embodiment, the computer-readable storage medium is further configured to store program code for performing the following steps: when the execution information does not include scene parameters, obtaining code parameters from the execution information, wherein the code parameters include a set of function names and a set of function parameters of the software code; inputting the set of function names and the set of function parameters into a scene recognition model, and using the scene recognition model to predict the target scene corresponding to the execution information.
[0098] Optionally, in this embodiment, the computer-readable storage medium is further configured to store program code for performing the following steps: when the test scenario coverage is lower than the scenario coverage threshold, determining the scenario to be tested based on a preset scenario set and multiple target scenarios; determining the information of the target tester based on the data points, and determining the target push method based on the information of the target tester; sending the scenario to be tested to the target tester according to the target push method to remind the target tester to perform supplementary testing on the scenario to be tested.
[0099] Optionally, in this embodiment, the computer-readable storage medium is further configured to store program code for performing the following steps: receiving incremental scene information sent by testers and updating a preset scene set based on the incremental scene information, wherein the incremental scene information includes scene information to be added to the preset scene set; determining a target code segment in the software code based on the incremental scene information, and adding embedding points in the target code segment.
[0100] This application also provides a computer program product that, when executed on a data processing device, is suitable for performing software testing method steps.
[0101] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0102] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0103] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0104] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0105] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0106] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0107] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A software testing method, characterized in that, include: Obtain the preset scene set and scene coverage threshold; During the testing of the target software, multiple target scenarios that have been tested are determined by the embedded points in the software code of the target software. The test scenario coverage rate is determined based on the multiple target scenarios and the preset scenario set, and a reminder message for the test scenario coverage rate is triggered when the test scenario coverage rate is lower than the scenario coverage rate threshold.
2. The method according to claim 1, characterized in that, During the testing of the target software, multiple target scenarios that have been tested are identified through the instrumentation points in the target software's code, including: During the testing of the target software, the execution information of each test is obtained through the aforementioned tracking points, resulting in multiple execution information entries. For any given execution information, determine the target scenario corresponding to the execution information based on the execution information; Based on the target scenarios corresponding to the multiple execution information, multiple target scenarios that have been tested are determined.
3. The method according to claim 2, characterized in that, Determining the target scenario corresponding to the execution information based on the execution information includes: If the execution information includes scene parameters, then the scene parameters in the execution information are obtained; The target scene corresponding to the scene parameters is determined based on a preset parameter lookup table.
4. The method according to claim 2, characterized in that, Determining the target scenario corresponding to the execution information based on the execution information includes: If the execution information does not include scenario parameters, the code parameters in the execution information are obtained, wherein the code parameters include a set of function names and a set of function parameters of the software code; The set of function names and the set of function parameters are input into the scene recognition model, and the scene recognition model is used to predict the target scene corresponding to the execution information.
5. The method according to claim 1, characterized in that, If the test scenario coverage is lower than the scenario coverage threshold, the alert message triggered for the test scenario coverage includes: If the test scenario coverage is lower than the scenario coverage threshold, the scenario to be tested is determined based on the preset scenario set and the multiple target scenarios; Based on the data points, determine the target tester's information, and based on the target tester's information, determine the target push method; The scenario to be tested is sent to the target tester according to the target push method, so as to remind the target tester to conduct supplementary testing on the scenario to be tested.
6. The method according to claim 1, characterized in that, After determining the test scenario coverage based on the multiple target scenarios and the preset scenario set, the method further includes: Receive incremental scene information sent by testers, and update the preset scene set according to the incremental scene information, wherein the incremental scene information includes scene information to be added to the preset scene set; Based on the incremental scenario information, a target code segment is determined in the software code, and the embedded point is added to the target code segment.
7. A software testing device, characterized in that, include: The data acquisition unit is used to acquire a preset set of scenes and scene coverage thresholds. The scenario determination unit is used to determine multiple target scenarios that have been tested by means of embedded points in the software code of the target software during the testing process of the target software. The reminder triggering unit is used to determine the test scene coverage rate based on the multiple target scenes and the preset scene set, and to trigger a reminder message for the test scene coverage rate when the test scene coverage rate is lower than the scene coverage rate threshold.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored executable program, wherein, when the executable program is executed, it controls the device on which the computer-readable storage medium is located to perform the software testing method according to any one of claims 1 to 6.
9. An electronic device, characterized in that, include: Memory, which stores executable programs; A processor for running the program, wherein the program, when running, performs the software testing method according to any one of claims 1 to 6.
10. A computer program product comprising computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the steps of the software testing method according to any one of claims 1 to 6.