Test method, device and medium based on unified modeling language (UML) flowchart
By obtaining the executable path of the UML flowchart and using the path switching algorithm for testing, the problem of low testing efficiency in the existing technology is solved, batch and automated testing is realized, and testing efficiency is improved.
Patent Information
- Application Number
- CN202211498923.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-28
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2042-11-28
AI Technical Summary
Existing UML flowchart-based testing methods rely on the tester's skill level, resulting in low testing efficiency.
By obtaining all executable paths of the target UML flowchart, inputting the test dataset, and using a preset path switching algorithm to determine the current executable path, the test results are output, thus achieving batch and automated testing.
It improves the testing efficiency of UML flowcharts, enables batch and automated testing, and reduces reliance on the skill level of testers.
Smart Images

Figure CN115934519B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a testing method, device and medium based on the Unified Modeling Language (UML) flowchart. Background Technology
[0002] Unified Modeling Language (UML) is a standard language for describing, visualizing, and documenting object-oriented systems. It is a non-proprietary third-generation modeling and specification language.
[0003] In existing technologies, when testing based on UML flowcharts, it often relies mainly on testers to complete the testing process manually.
[0004] It can be seen that the existing testing methods rely entirely on the testers' proficiency, thus resulting in low testing efficiency. Summary of the Invention
[0005] The purpose of this application is to address the shortcomings of the prior art by providing a testing method, device, and medium based on the Unified Modeling Language (UML) flowchart, which can improve the testing efficiency of UML flowcharts.
[0006] To achieve the above objectives, the technical solutions adopted in the embodiments of this application are as follows:
[0007] In a first aspect, the present invention provides a testing method based on Unified Modeling Language (UML) flowcharts, comprising:
[0008] Obtain all executable paths of the target Unified Modeling Language (UML) flowchart, wherein each executable path includes at least one node;
[0009] Input the test dataset into the initial executable path and obtain the node type of each node in the initial executable path, wherein the test dataset includes multiple test data;
[0010] Based on the node type of each node, a preset path switching algorithm is used to determine the current executable path of each test data.
[0011] Input the test data into each of the current executable paths and output the test results for each of the current executable paths.
[0012] In an optional implementation, the node types include: start node, end node, decision node, and step node;
[0013] The step of determining the current executable path for each piece of test data using a preset path switching algorithm based on the node type of each node includes:
[0014] If the node type of the node is a decision node, then determine whether the next node identifier pointed to by each of the test data is consistent with the next node identifier corresponding to each of the test data in the initial executable path;
[0015] If they are inconsistent, the node identifiers of the executed test data are obtained, and the current executable path of each test data is determined based on the node identifiers of the executed test data and the next node identifiers they point to.
[0016] In an optional implementation, determining the current executable path of each test data based on the node identifier that has been executed and the next node identifier it points to includes:
[0017] Based on the node identifiers that have been executed and the next node identifiers that the test data points to, among all executable paths, the executable paths whose node identifiers include the node identifiers that have been executed and the next node identifiers that the test data points to are selected as the current executable paths for each test data.
[0018] In an optional implementation, obtaining the node type of each node in the initial executable path includes:
[0019] Based on the type of each figure in the target UML flowchart, determine the node type of each node in the initial executable path.
[0020] In an optional implementation, obtaining all executable paths of the target Unified Modeling Language (UML) flowchart includes:
[0021] Convert the target UML flowchart into a preset data format file;
[0022] Traverse the preset data format file to obtain all executable paths corresponding to the target UML flowchart.
[0023] In an optional implementation, all executable paths are stored in a two-dimensional array format, wherein the row parameters of the two-dimensional array are determined according to the number of all executable paths, and the column parameters of the two-dimensional array are determined according to the number of node identifiers in each executable path.
[0024] In an optional implementation, the method further includes:
[0025] Output a test report set of the test dataset. The test report set includes a test report corresponding to each test data. Each test report includes: the test result corresponding to each test data and the node identifier corresponding to each test data.
[0026] Based on the test reports corresponding to each of the test data, determine whether the test results corresponding to each of the test data meet the preset requirements;
[0027] If it does not meet the requirements, the target UML flowchart is updated according to the node identifiers corresponding to each of the test data.
[0028] Secondly, the present invention provides a testing device based on Unified Modeling Language (UML) flowcharts, comprising:
[0029] The first acquisition module is used to acquire all executable paths of the target Unified Modeling Language (UML) flowchart, wherein each executable path includes at least one node;
[0030] The second acquisition module is used to input the test dataset into the initial executable path and acquire the node type of each node in the initial executable path, wherein the test dataset includes multiple test data.
[0031] The determination module is used to determine the current executable path of each test data according to the node type of each node and using a preset path switching algorithm;
[0032] The output module is used to input the test data into each of the current executable paths and output the test results of each of the current executable paths.
[0033] In an optional implementation, the node type includes: start node, end node, decision node, and step node; the determining module is specifically used to determine whether the next node identifier pointed to by each of the test data is consistent with the next node identifier corresponding to each of the test data in the initial executable path if the node type is decision node.
[0034] If they are inconsistent, the node identifiers of the executed test data are obtained, and the current executable path of each test data is determined based on the node identifiers of the executed test data and the next node identifiers they point to.
[0035] In an optional implementation, the determining module is specifically used to filter among all executable paths based on the node identifiers that have been executed and the next node identifiers that point to each of the test data, and to select executable paths whose node identifiers include the node identifiers that have been executed and the next node identifiers that point to each of the test data, as the current executable paths for each of the test data.
[0036] In an optional implementation, the second acquisition module is specifically used to determine the node type of each node in the initial executable path based on the type of each figure in the target UML flowchart.
[0037] In an optional implementation, the first acquisition module is specifically used to convert the target UML flowchart into a preset data format file;
[0038] Traverse the preset data format file to obtain all executable paths corresponding to the target UML flowchart.
[0039] In an optional implementation, all executable paths are stored in a two-dimensional array format, wherein the row parameters of the two-dimensional array are determined according to the number of all executable paths, and the column parameters of the two-dimensional array are determined according to the number of node identifiers in each executable path.
[0040] In an optional implementation, the output module is further configured to output a test report set of the test dataset, the test report set including a test report corresponding to each of the test data, and each test report including: the test result corresponding to each of the test data, and the node identifier corresponding to each of the test data.
[0041] Based on the test reports corresponding to each of the test data, determine whether the test results corresponding to each of the test data meet the preset requirements;
[0042] If it does not meet the requirements, the target UML flowchart is updated according to the node identifiers corresponding to each of the test data.
[0043] Thirdly, the present invention provides an electronic device, comprising: a processor, a storage medium, and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of the test method based on the Unified Modeling Language (UML) flowchart as described in any of the foregoing embodiments.
[0044] Fourthly, the present invention provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the test method based on the Unified Modeling Language (UML) flowchart as described in any of the foregoing embodiments.
[0045] The beneficial effects of this application are:
[0046] The testing method, device, and medium based on Unified Modeling Language (UML) flowcharts provided in this application include: acquiring all executable paths of a target UML flowchart, wherein each executable path includes at least one node; inputting a test dataset into an initial executable path and acquiring the node type of each node in the initial executable path, wherein the test dataset includes multiple test data; determining the current executable path of each test data using a preset path switching algorithm based on the node type of each node; inputting each test data into each current executable path; and outputting the test results of each current executable path. By applying this application embodiment, batch testing of target UML flowcharts can be achieved, and executable paths can be flexibly switched according to the test dataset during the testing process. Compared with the prior art, batch and automated testing can be achieved, improving the testing efficiency of target UML flowcharts. Attached Figure Description
[0047] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0048] Figure 1 A flowchart illustrating a testing method based on UML flowcharts provided in this application embodiment;
[0049] Figure 2 A flowchart illustrating another UML flowchart-based testing method provided in this application embodiment;
[0050] Figure 3 This application provides a partial executable path diagram corresponding to a target UML flowchart.
[0051] Figure 4 A schematic diagram of another UML flowchart-based testing method provided in this application embodiment;
[0052] Figure 5 A flowchart illustrating another UML flowchart-based testing method provided in this application embodiment;
[0053] Figure 6 A schematic diagram of another UML flowchart-based testing method provided in this application embodiment;
[0054] Figure 7 This is a schematic diagram of an electronic device structure provided in an embodiment of this application. Detailed Implementation
[0055] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0056] Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0057] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0058] Figure 1 This is a flowchart illustrating a testing method based on UML flowcharts provided in an embodiment of this application. The execution subject of this method can be an electronic device with data processing capabilities, such as a computer, server, or processor. Figure 1 As shown, the method may include:
[0059] S101. Obtain all executable paths of the target Unified Modeling Language (UML) flowchart, wherein each executable path includes at least one node.
[0060] The target UML flowchart can be used to describe the sequence followed by target activities. It can visually represent the steps and procedures for solving a problem using graphical symbols. Optionally, depending on the application scenario, the target UML flowchart may include different graphical symbols, such as: start / end symbols, flow symbols, processing symbols, input / output symbols, decision symbols, etc., which are not limited here.
[0061] In some embodiments, by converting the target UML flowchart, all executable paths of the target UML flowchart can be obtained. Optionally, during the specific conversion process, each graphical symbol in the target UML flowchart can be converted into a code-recognizable storage format, wherein each graphical symbol may correspond to one or more nodes, which is not limited here.
[0062] S102. Input the test dataset into the initial executable path and obtain the node type of each node in the initial executable path.
[0063] The test dataset includes multiple test data sets. However, this application does not limit the number of test data sets or the relationships between them. It is understood that the selection of the test dataset should cover as many test scenarios as possible, so that the target UML flowchart can be comprehensively tested based on this dataset.
[0064] Based on this test dataset, all test data in the dataset can be simultaneously input into the initial executable path, and the node type of each node in the initial executable path can be obtained. Optionally, the initial executable path can be any executable path among all executable paths, or it can be a specified executable path among all executable paths; there is no limitation here.
[0065] S103. Based on the node type of each node, a preset path switching algorithm is used to determine the current executable path of each test data.
[0066] Based on the test data and the node type of each node, it can be determined whether the initial executable path needs to be switched during the execution process. If it is determined that a switch is needed, a preset path switching algorithm can be used to determine the current executable path of each test data.
[0067] It should be noted that, depending on the actual application scenario, this path switching operation can be performed once or multiple times, and the number of path switching is not limited here.
[0068] S104. Input each test data into each current executable path and output the test results for each current executable path.
[0069] Based on the above description, after determining the current executable path, each test data point can be input into its corresponding current executable path, and the test results for each current executable path can be output. Optionally, the test results can characterize whether the selection of the test case is appropriate, whether the design of the target UML flowchart meets the preset business requirements, etc. By applying the embodiments of this application, based on the test dataset, batch and automated testing of the target UML flowchart can be achieved, which can effectively improve testing efficiency.
[0070] It is worth noting that different test data may correspond to the same or different current executable paths, which is not limited here.
[0071] In summary, this application provides a testing method based on Unified Modeling Language (UML) flowcharts. The method includes: obtaining all executable paths of the target UML flowchart, wherein each executable path includes at least one node; inputting a test dataset into an initial executable path and obtaining the node type of each node in the initial executable path, wherein the test dataset includes multiple test data sets; determining the current executable path for each test data set using a preset path switching algorithm based on the node type of each node; inputting each test data set into each current executable path; and outputting the test results for each current executable path. By applying this application, batch testing of the target UML flowchart can be achieved, and executable paths can be flexibly switched according to the test dataset during the testing process. Compared with existing technologies, this method enables batch and automated testing, improving the testing efficiency of the target UML flowchart.
[0072] Figure 2 This is a flowchart illustrating another testing method based on a Unified Modeling Language (UML) flowchart provided in an embodiment of this application. Optionally, the node types include: start node, end node, decision node, and step node.
[0073] Among them, the start node can correspond to the beginning of the process in the target UML flowchart; the end node can correspond to the end of the process in the target UML flowchart; the decision node can correspond to the decision in the process in the target UML flowchart. For example, for a certain test data, the decision node can determine the next node identifier based on the test data; the step node can correspond to the processing, input, output, etc. of the process in the target UML flowchart, that is, it can specifically correspond to the specific functional process in the target UML flowchart; no restrictions are made here.
[0074] Figure 3 This application provides a partial executable path diagram corresponding to a target UML flowchart in an embodiment of the present application. Optionally, refer to the above. Figure 2 As shown, the above method uses a preset path switching algorithm to determine the current executable path for each test data point based on the node type of each node, including:
[0075] S201. If the node type is a decision node, then determine whether the next node identifier pointed to by each test data is consistent with the next node identifier corresponding to each test data in the initial executable path.
[0076] In some embodiments, for each test data, if there is a decision node in the initial executable path, then after the test data is input into the decision node, different decision results will be obtained according to the different test data. The next node identifier pointed to by the test data can be determined according to the decision result. The next node identifier pointed to by each test data is compared with the next node identifier corresponding to the test data in the initial executable path. If they are the same, there is no need to switch paths.
[0077] S202. If they are inconsistent, obtain the node identifiers of each test data that have been executed, and determine the current executable path of each test data based on the node identifiers of each test data that have been executed and the next node identifiers they point to.
[0078] For each test data, if they are different, it is necessary to obtain the node identifier that the test data has been executed, and determine the current executable path of the test data based on the executed node identifier and the next node identifier that is determined above.
[0079] For example, if the executable path corresponding to the target UML flowchart is as follows: Figure 3 As shown, if the initial executable path consists of nodes A1, A2, A3, A4, A5, and A6, it can be seen that there is a decision node A3 in this initial executable path. After a certain test data is input into this initial executable path, each node will be executed sequentially according to its order in the initial executable path. Therefore, if the test data passes through decision node A3, according to the order of each node in the initial executable path, the next node identifier corresponding to the test data in the initial executable path will be A4. However, if, based on the content of the test data and the specific decision method of decision node A3, it is determined that the next node identifier pointed to by the test data is step node A7, it can be seen that at this time, the next node identifier pointed to by the test data (A7) is not the same as the next node identifier corresponding to the test data in the initial executable path (A4). In this case, the current executable path of the test data can be further determined based on the node identifiers that the test data has already executed (i.e., A1, A3, and A4) and the next node identifier it points to (A7).
[0080] Optionally, the above-mentioned determination of the current executable path for each test data based on the node identifier that has been executed and the next node identifier it points to includes:
[0081] Based on the node identifiers that have been executed and the next node identifiers that they point to in each test data, the executable paths with node identifiers that include the node identifiers that have been executed and the next node identifiers that they point to in each test data are selected from all executable paths and used as the current executable paths for each test data.
[0082] In some embodiments, for each test data, the node identifiers that have been executed and the next node identifiers they point to can be temporarily stored (e.g., the number is N) and used as a sequence to be matched. Among all executable paths, the executable paths whose node identifiers include the sequence to be matched are selected as the current executable paths for the test data.
[0083] To further illustrate the above example, A1, A2, A3, and A7 can be temporarily stored sequentially as the matching sequence for the test data. Executable paths containing this matching sequence are then selected from all executable paths. Through this selection, executable paths A1, A2, A3, and A7 should be considered the current executable paths for the test data. It should be noted that if there are still decision nodes in the current executable paths corresponding to A1, A2, A3, and A7, then the process in steps S201 and S202 above can be used to continue determining new current executable paths until the node type of the next node corresponding to the test data is an end node, at which point the test process can end.
[0084] Optionally, obtaining the node type of each node in the initial executable path includes:
[0085] Based on the type of each figure in the target UML flowchart, determine the node type of each node in the initial executable path.
[0086] As explained above regarding node types, different node types correspond to different graphical symbols in the target UML flowchart. Therefore, in some embodiments, the node type of each node in the initial executable path can be determined based on the type (i.e., graphical symbol) of each graphic in the target UML flowchart. It is understood that the node types in this initial executable path should at least include: start node, end node, and step node. Of course, depending on the actual application scenario, decision nodes may also be included, which is not limited here.
[0087] Of course, it should be noted that in actual application scenarios, the method for determining the node type of each node is not limited to this, and other methods can also be used.
[0088] Figure 4 This is a flowchart illustrating another testing method based on a UML flowchart provided in an embodiment of this application. Optionally, as... Figure 4 As shown, the above-mentioned executable paths for obtaining the target Unified Modeling Language (UML) flowchart include:
[0089] S401. Convert the target UML flowchart into a preset data format file.
[0090] Optionally, the storage format in the preset data format file can be a JavaScript Object Notation (JSON), Extensible Markup Language (XML), or other data formats. There are no restrictions on this, and it can be flexibly set according to the actual application scenario.
[0091] S402. Traverse the preset data format files to obtain all executable paths corresponding to the target UML flowchart.
[0092] Based on the converted preset data format file, the preset data format file can be traversed. The traversal method can be depth-first traversal, breadth-first traversal, etc., which is not limited here. Through this traversal operation, all executable paths corresponding to the target UML flowchart can be calculated.
[0093] Optionally, all the above executable paths are stored in a two-dimensional array format, wherein the row parameter of the two-dimensional array is determined according to the number of all executable paths, and the column parameter of the two-dimensional array is determined according to the number of node identifiers in each executable path.
[0094] In some embodiments, all executable paths obtained through traversal can be stored in a preset format, such as a two-dimensional array, a linked list, etc., without limitation, which simplifies the storage method. Specifically, when stored in a two-dimensional array, each row can correspond to one executable path; that is, the number of executable paths corresponding to the target UML flowchart can be determined based on the row parameters of the two-dimensional array. Furthermore, each element in each row can represent a node in the executable path corresponding to that row; that is, the number of elements in each row can represent the number of node identifiers in the executable path corresponding to that row.
[0095] Of course, it should be noted that in some embodiments, each column can also correspond to an executable path. That is, the number of executable paths corresponding to the target UML flowchart can be determined according to the column parameters of the two-dimensional array. Correspondingly, each element in each column can represent each node in the executable path corresponding to that column. In other words, the number of each element in each column can represent the number of node identifiers in the executable path corresponding to that column.
[0096] Figure 5 This is a flowchart illustrating another testing method based on a UML flowchart provided in an embodiment of this application. Optionally, as... Figure 5 As shown, the above method also includes:
[0097] S501. Output the test report set of the test dataset. The test report set includes the test report corresponding to each test data.
[0098] Each test report includes: the test results corresponding to each test data point, and the node identifier corresponding to each test data point.
[0099] Based on the above explanation, for each piece of test data, after inputting each test data into its corresponding current executable path, the test results for that current executable path can be output. Then, based on these test results and the node identifier corresponding to the test data, a test report for that test data can be generated. Furthermore, the test reports for each piece of test data can be integrated and packaged to obtain a test report set corresponding to the integrated test dataset.
[0100] S502. Based on the test reports corresponding to each test data, determine whether the test results corresponding to each test data meet the preset requirements.
[0101] S503. If not, update the target UML flowchart according to the node identifiers corresponding to each test data.
[0102] For each test data, the test result corresponding to each test data can be compared with the preset test result. If they are inconsistent, it can be determined that the test result corresponding to the test data does not meet the preset requirements. Optionally, if it does not meet the requirements, the execution path corresponding to the test data can be further analyzed based on the node identifier corresponding to the test data. Through analysis, the design parts in the target UML flowchart that do not meet the preset business requirements can be identified, and the target UML flowchart can be optimized accordingly. By applying the embodiments of this application, the target UML flowchart can be optimized in a timely manner based on the test report, which can improve the applicability of this application.
[0103] Figure 6 This is a functional module diagram of a UML flowchart-based testing device provided in this application embodiment. The basic principle and technical effects of this device are the same as those of the corresponding method embodiments described above. For the sake of brevity, parts not mentioned in this embodiment can be referred to the corresponding content in the method embodiments. Figure 6 As shown, the testing apparatus includes:
[0104] The first acquisition module 110 is used to acquire all executable paths of the target Unified Modeling Language (UML) flowchart, wherein each executable path includes at least one node;
[0105] The second acquisition module 120 is used to input the test dataset into the initial executable path and acquire the node type of each node in the initial executable path, wherein the test dataset includes multiple test data.
[0106] The determination module 130 is used to determine the current executable path of each test data according to the node type of each node and using a preset path switching algorithm;
[0107] The output module 140 is used to input the test data into each of the current executable paths and output the test results of each of the current executable paths.
[0108] In an optional implementation, the node type includes: start node, end node, decision node, and step node; the determining module 130 is specifically used to determine whether the next node identifier pointed to by each of the test data is consistent with the next node identifier corresponding to each of the test data in the initial executable path if the node type of the node is a decision node.
[0109] If they are inconsistent, the node identifiers of the executed test data are obtained, and the current executable path of each test data is determined based on the node identifiers of the executed test data and the next node identifiers they point to.
[0110] In an optional implementation, the determining module 130 is specifically used to filter executable paths from all executable paths based on the node identifiers of the executed test data and the next node identifiers they point to, and use these executable paths as the current executable paths for each test data.
[0111] In an optional implementation, the second acquisition module 120 is specifically used to determine the node type of each node in the initial executable path based on the type of each graphic in the target UML flowchart.
[0112] In an optional implementation, the first acquisition module 110 is specifically used to convert the target UML flowchart into a preset data format file;
[0113] Traverse the preset data format file to obtain all executable paths corresponding to the target UML flowchart.
[0114] In an optional implementation, all executable paths are stored in a two-dimensional array format, wherein the row parameters of the two-dimensional array are determined according to the number of all executable paths, and the column parameters of the two-dimensional array are determined according to the number of node identifiers in each executable path.
[0115] In an optional implementation, the output module 140 is further configured to output a test report set of the test dataset, the test report set including a test report corresponding to each test data, and each test report including: the test result corresponding to each test data and the node identifier corresponding to each test data.
[0116] Based on the test reports corresponding to each of the test data, determine whether the test results corresponding to each of the test data meet the preset requirements;
[0117] If it does not meet the requirements, the target UML flowchart is updated according to the node identifiers corresponding to each of the test data.
[0118] The above-described device is used to execute the method provided in the foregoing embodiments, and its implementation principle and technical effect are similar, so they will not be described again here.
[0119] These modules can be one or more integrated circuits configured to implement the above methods, such as one or more Application Specific Integrated Circuits (ASICs), one or more microprocessors, or one or more Field Programmable Gate Arrays (FPGAs). Alternatively, when a module is implemented using processing element scheduler code, the processing element can be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. Furthermore, these modules can be integrated together as a system-on-a-chip (SOC).
[0120] Figure 7 This is a schematic diagram of an electronic device structure provided in an embodiment of this application. This electronic device can be integrated into the aforementioned testing apparatus. Figure 7 As shown, the electronic device may include a processor 210, a storage medium 220, and a bus 230. The storage medium 220 stores machine-readable instructions executable by the processor 210. When the electronic device is running, the processor 210 communicates with the storage medium 220 via the bus 230, and the processor 210 executes the machine-readable instructions to perform the steps of the above method embodiment. The specific implementation and technical effects are similar and will not be described in detail here.
[0121] Optionally, this application also provides a storage medium storing a computer program, which, when run by a processor, executes the steps of the above-described method embodiments. The specific implementation and technical effects are similar and will not be repeated here.
[0122] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, 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 coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0123] 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.
[0124] 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 in a combination of hardware and software functional units.
[0125] The integrated units implemented as software functional units described above can be stored in a computer-readable storage medium. These software functional units, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0126] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.
[0127] The above are merely preferred embodiments of this application and are not intended to limit this application. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application. It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need further definition and explanation in subsequent figures. The above are merely preferred embodiments of this application and are not intended to limit this application. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A testing method based on Unified Modeling Language (UML) flowcharts, characterized in that, include: Obtain all executable paths of the target Unified Modeling Language (UML) flowchart, wherein each executable path includes at least one node; Input the test dataset into the initial executable path and obtain the node type of each node in the initial executable path, wherein the test dataset includes multiple test data; Based on the node type of each node, a preset path switching algorithm is used to determine the current executable path of each test data. Input the test data into each of the current executable paths and output the test results for each of the current executable paths; The node types include: start node, end node, decision node, and step node; The step of determining the current executable path for each piece of test data using a preset path switching algorithm based on the node type of each node includes: If the node type is a decision node, then it is determined whether the next node identifier pointed to by each of the test data is consistent with the next node identifier corresponding to each of the test data in the initial executable path; if they are inconsistent, then the node identifier that has been executed for each of the test data is obtained, and based on the node identifier that has been executed for each of the test data and the next node identifier it points to, the executable path whose node identifier includes the node identifier that has been executed for each of the test data and the next node identifier it points to is selected from all the executable paths, and this is used as the current executable path for each of the test data.
2. The method according to claim 1, characterized in that, The step of obtaining the node type of each node in the initial executable path includes: Based on the type of each figure in the target UML flowchart, determine the node type of each node in the initial executable path.
3. The method according to claim 1, characterized in that, The process of obtaining all executable paths for the target Unified Modeling Language (UML) flowchart includes: Convert the target UML flowchart into a preset data format file; Traverse the preset data format file to obtain all executable paths corresponding to the target UML flowchart.
4. The method according to claim 1, characterized in that, All executable paths are stored in a two-dimensional array format, wherein the row parameter of the two-dimensional array is determined according to the number of all executable paths, and the column parameter of the two-dimensional array is determined according to the number of node identifiers in each executable path.
5. The method according to any one of claims 1-4, characterized in that, The method further includes: Output a test report set of the test dataset, the test report set including a test report corresponding to each test data, and each test report including: the test result corresponding to each test data, and the node identifier corresponding to each test data; Based on the test reports corresponding to each of the test data, determine whether the test results corresponding to each of the test data meet the preset requirements; If it does not meet the requirements, the target UML flowchart is updated according to the node identifiers corresponding to each of the test data.
6. A testing device based on Unified Modeling Language (UML) flowcharts, characterized in that, include: The first acquisition module is used to acquire all executable paths of the target Unified Modeling Language (UML) flowchart, wherein each executable path includes at least one node; The second acquisition module is used to input the test dataset into the initial executable path and acquire the node type of each node in the initial executable path, wherein the test dataset includes multiple test data. The determination module is used to determine the current executable path of each test data according to the node type of each node and using a preset path switching algorithm; The output module is used to input the test data into each of the current executable paths and output the test results of each of the current executable paths; The node types include: start node, end node, decision node, and step node; The determining module is configured to, if the node type of the node is a decision node, determine whether the next node identifier pointed to by each of the test data is consistent with the next node identifier corresponding to each of the test data in the initial executable path; if they are inconsistent, obtain the node identifier that has been executed for each of the test data, and based on the node identifier that has been executed for each of the test data and the next node identifier it points to, filter the executable paths in all executable paths that include the node identifier that has been executed for each of the test data and the next node identifier it points to, and use these as the current executable paths for each of the test data.
7. An electronic device, characterized in that, include: The device includes a processor, a storage medium, and a bus. The storage medium stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of the test method based on the Unified Modeling Language (UML) flowchart as described in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the test method based on the Unified Modeling Language (UML) flowchart as described in any one of claims 1-5.
Citation Information
Patent Citations
Device and method for automatically testing software based on UML (unified modeling language) graphs
CN102053912A
Testing framework for policy-based workflows
US20150095895A1