Test case generation method, device and equipment and storage medium

CN117234905BActive Publication Date: 2026-11-03GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311143761.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-05
Publication Date
2026-11-03
Estimated Expiration
2043-09-05

AI Technical Summary

Technical Problem

When there are many testing requirements, testers write too many test cases, resulting in wasted manpower, lengthy testing processes, and reduced testing efficiency.

Method used

Test cases are automatically generated by generating operation flow models. Multiple predicted operation flows are generated based on the target operation flow using pre-trained models, and test cases are generated by combining the expected results, reducing the need for manual writing of test code.

Benefits of technology

It eliminates the need for testers to manually write a large number of test cases, freeing up manpower and improving testing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117234905B_ABST
    Figure CN117234905B_ABST
Patent Text Reader

Abstract

The application discloses a test case generation method and device, equipment and a storage medium, and belongs to the technical field of computers. The method comprises the following steps: obtaining a target operation process of a to-be-tested task, the target operation process being an operation process capable of completing the to-be-tested task; generating a plurality of predicted operation processes of the to-be-tested task based on the target operation process through an operation process generation model, the operation process generation model being obtained through a plurality of historical operation processes and labeling training of each historical operation process; and generating a plurality of test cases of the to-be-tested task based on the plurality of predicted operation processes. In this way, the plurality of predicted operation processes of the to-be-tested task are automatically generated through the operation process generation model which is pre-trained, so that a tester does not need to write a large number of test cases, human resources are fully liberated, and therefore, the test case writing time is reduced and the test efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a test case method, apparatus, device, and storage medium. Background Technology

[0002] Currently, in order to ensure the normal use of systems and applications, a system or application is usually tested after its development is completed to test whether it is normal in all aspects and whether it can guarantee normal use by users.

[0003] In related technologies, testers typically first write test cases, which are then executed to test the system and application. Specifically, during the test case writing process, testers first need to determine the testing requirements, that is, which functions, applications, and operations need to be tested. Subsequently, testers write corresponding test cases for each function, application, and the different operational processes of each application.

[0004] However, with the above methods, when there are many testing requirements, testers will write a lot of test cases, which will be a waste of manpower and make the entire testing process more lengthy, thus reducing testing efficiency. Summary of the Invention

[0005] This application provides a test case generation method, apparatus, device, and storage medium, which eliminates the need for testers to write a large number of test cases, thereby freeing up manpower, reducing test case writing time, and improving testing efficiency. The technical solution is as follows:

[0006] Firstly, a test case generation method is provided, the method comprising:

[0007] Obtain the target operation flow of the task to be tested, wherein the target operation flow is an operation flow that can complete the task to be tested;

[0008] The operation process generation model generates multiple predicted operation processes for the task to be tested based on the task information. The operation process generation model is trained by multiple historical operation processes and the annotation of each historical operation process.

[0009] Based on the aforementioned multiple prediction operation processes, multiple test cases are generated for the task to be tested.

[0010] In this application, the target operation flow of the task to be tested is first obtained, that is, an operation flow that can complete the task to be tested is first obtained. Then, the target operation flow can be input into an operation flow generation model, which generates multiple predicted operation flows for the task to be tested based on the target operation flow. The operation flow generation model is pre-trained and is trained using multiple historical operation flows and their annotations. After obtaining multiple predicted operation flows, multiple test cases for the task to be tested can be generated based on these predicted operation flows. In this way, multiple predicted operation flows for the task to be tested are automatically generated through the pre-trained operation flow generation model, eliminating the need for testers to write a large number of test cases, thus freeing up manpower, reducing test case writing time, and improving testing efficiency.

[0011] Optionally, the operation flow generation model includes an encoder and a decoder, and the generation of multiple predicted operation flows for the test task based on the target operation flow through the operation flow generation model includes:

[0012] The target operation flow is input into the encoder, and the encoder maps the target operation flow into a first feature sequence;

[0013] The first feature sequence is input into the decoder, and the decoder generates the plurality of prediction operation processes.

[0014] Optionally, the operation flow generation model further includes an attention module and a gating module. After inputting the target operation flow into the encoder and mapping the target operation flow into a first feature sequence through the encoder, the model further includes:

[0015] The first feature sequence is input into the attention module, and the attention module performs attention encoding on the first feature sequence to obtain the second feature sequence;

[0016] The second feature sequence and the first feature sequence are input into the gating module, and the gating module filters the second feature sequence based on the first feature sequence to obtain the third feature sequence;

[0017] The third feature sequence is input into the decoder, and the decoder generates the multiple prediction operation processes.

[0018] Optionally, before generating multiple test cases for the task to be tested based on the multiple prediction operation processes, the method further includes:

[0019] Obtain the expected results of the task to be tested;

[0020] The generation of multiple test cases for the task to be tested based on the multiple prediction operation processes includes:

[0021] For any one of the multiple prediction operation processes, the prediction operation process is determined as the test step of the test case.

[0022] The test steps and the expected results are combined to form test cases for the task to be tested.

[0023] Optionally, before obtaining the target operation flow of the task to be tested, the method further includes:

[0024] Obtain a sample dataset, which includes multiple training samples. Any one of the multiple training samples includes the historical operation flow of the sample task and the annotation of the historical operation flow.

[0025] The operation process generation model is trained based on the sample dataset.

[0026] Optionally, the historical operation flow includes control information for multiple controls, which are controls operated during the completion of the sample task. The control information includes control identifier, control attributes, control state, control operation method, and number of control operations. The step of training the operation flow generation model based on the sample dataset includes:

[0027] Input the control identifier, control attributes, control state, control operation method, and number of control operations of the multiple controls into the operation flow generation model;

[0028] The model is generated through the operation process to generate multiple first operation processes for the sample task based on the control identifier, control attributes, control state, control operation method, and control operation count of the multiple controls.

[0029] Based on the differences between the annotations of the multiple first operation processes and the historical operation processes, the parameters of the operation process generation model are updated.

[0030] Optionally, obtaining the sample dataset includes:

[0031] For any one of the multiple training samples in the sample dataset, when the target operating system is currently on the main interface, each time a selection operation of a control in the target operating system is received, the control information of that control is recorded until the target operating system is on the main interface again.

[0032] The control information of at least two controls obtained from the recording is determined as the training samples.

[0033] Secondly, a test case generation apparatus is provided, the apparatus comprising:

[0034] The first acquisition module is used to acquire the target operation flow of the task to be tested, wherein the target operation flow is an operation flow that can complete the task to be tested.

[0035] The first generation module is used to generate multiple predicted operation processes for the task to be tested based on the target operation process through an operation process generation model. The operation process generation model is trained by multiple historical operation processes and the annotation of each historical operation process.

[0036] The second generation module is used to generate multiple test cases for the task to be tested based on the multiple prediction operation processes.

[0037] Optionally, the operation flow generation model includes an encoder and a decoder, and the first generation module is used for:

[0038] The target operation flow is input into the encoder, and the encoder maps the target operation flow into a first feature sequence;

[0039] The first feature sequence is input into the decoder, and the decoder generates the plurality of prediction operation processes.

[0040] Optionally, the operation flow generation model further includes an attention module and a gating module, and the first generation module is further used for:

[0041] The first feature sequence is input into the attention module, and the attention module performs attention encoding on the first feature sequence to obtain the second feature sequence;

[0042] The second feature sequence and the first feature sequence are input into the gating module, and the gating module filters the second feature sequence based on the first feature sequence to obtain the third feature sequence;

[0043] The third feature sequence is input into the decoder, and the decoder generates the multiple prediction operation processes.

[0044] Optionally, the device further includes:

[0045] The second acquisition module is used to acquire the expected results of the task to be tested;

[0046] The second generation module is used for:

[0047] For any one of the multiple prediction operation processes, the prediction operation process is determined as the test step of the test case.

[0048] The test steps and the expected results are combined to form test cases for the task to be tested.

[0049] Optionally, the device further includes:

[0050] The third acquisition module is used to acquire a sample dataset, which includes multiple training samples. Any one of the multiple training samples includes the historical operation process of the sample task and the annotation of the historical operation process.

[0051] The training module is used to train the operation process generation model based on the sample dataset.

[0052] Optionally, the historical operation flow includes control information for multiple controls, which are controls operated during the process of completing the sample task. The control information includes control identifier, control attributes, control state, control operation method, and control operation count. The training module is used for:

[0053] Input the control identifier, control attributes, control state, control operation method, and number of control operations of the multiple controls into the operation flow generation model;

[0054] The model is generated through the operation process to generate multiple first operation processes for the sample task based on the control identifier, control attributes, control state, control operation method, and control operation count of the multiple controls.

[0055] Based on the differences between the annotations of the multiple first operation processes and the historical operation processes, the parameters of the operation process generation model are updated.

[0056] Optionally, the third acquisition module is used for:

[0057] For any one of the multiple training samples in the sample dataset, when the target operating system is currently on the main interface, each time a selection operation of a control in the target operating system is received, the control information of that control is recorded until the target operating system is on the main interface again.

[0058] The control information of at least two controls obtained from the recording is determined as the training samples.

[0059] Thirdly, a computer device is provided, the computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the above-described test case generation method.

[0060] Fourthly, a computer-readable storage medium is provided, the computer-readable storage medium storing a computer program, which, when executed by a processor, implements the above-described test case generation method.

[0061] Fifthly, a computer program product containing instructions is provided, which, when run on a computer, causes the computer to execute the steps of the test case generation method described above.

[0062] It is understood that the beneficial effects of the second, third, fourth, and fifth aspects mentioned above can be found in the relevant descriptions in the first aspect above, and will not be repeated here. Attached Figure Description

[0063] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0064] Figure 1 This is a schematic diagram of the implementation environment of a test case generation method provided in an embodiment of this application;

[0065] Figure 2 This is a flowchart of a test case generation method provided in an embodiment of this application;

[0066] Figure 3 This is a schematic diagram of the structure of an operation flow generation model provided in an embodiment of this application;

[0067] Figure 4 This is a schematic diagram of another operation flow generation model provided in the embodiments of this application;

[0068] Figure 5 This is a flowchart of another test case generation method provided in the embodiments of this application;

[0069] Figure 6 This is a schematic diagram of the structure of a test case generation device provided in an embodiment of this application;

[0070] Figure 7 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0071] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0072] It should be understood that "multiple" as mentioned in this application refers to two or more. In the description of this application, unless otherwise stated, " / " indicates "or," for example, A / B can mean A or B; "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist, for example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, to facilitate a clear description of the technical solutions of this application, the terms "first," "second," etc., are used to distinguish identical or similar items with essentially the same function and effect. Those skilled in the art will understand that the terms "first," "second," etc., do not limit the quantity or execution order, and that "first," "second," etc., do not necessarily imply differences.

[0073] First, the terms used in the embodiments of this application will be explained.

[0074] Natural Language Processing (NLP) technology encompasses various theories and methods for enabling effective communication between humans and computers using natural language. Simply put, it's a technology for processing natural language. Natural language refers to languages ​​used in daily life, such as Chinese, English, and French. These languages ​​have evolved through human societal development and are generally considered conventional languages, distinct from artificial languages ​​like programming languages. Processing includes understanding, transformation, and generation. NLP refers to using computers to process the form, sound, and meaning of natural language; that is, the input, output, recognition, analysis, understanding, and generation of characters, words, sentences, and texts. In simpler terms, NLP aims to help computers understand natural language, involving two processes: natural language understanding and natural language generation. Natural language understanding refers to a computer's ability to comprehend the meaning of natural language text, while natural language generation refers to the ability to express a given intention using natural language text.

[0075] Text generation models: These are models used to perform natural language generation tasks; they are models capable of generating text. Common text generation models include Seq2Seq models and SeqGAN models.

[0076] The implementation environment involved in the test case generation method provided in the embodiments of this application is described below.

[0077] Figure 1 This is a schematic diagram of the implementation environment of the test case generation method provided in this application embodiment. See also: Figure 1 The implementation environment includes server 101, first terminal 102, and second terminal 103.

[0078] Server 101 can be a standalone server or a server cluster consisting of multiple servers. Because server 101 has large storage space and large running memory, it can be used to store historical operation processes and to perform training tasks for operation process generation models.

[0079] In addition, server 101 and terminal 102 can communicate via wired or wireless means.

[0080] The first terminal 102 can be a desktop computer, laptop, PDA, mobile phone, tablet computer, or other terminal device. It should be understood that the terminal 102 may have an operating system installed, through which users can perform corresponding operations, such as playing music. Optionally, the operating system can be the native Android system, a derivative system of Android, etc., and this embodiment of the application does not limit this.

[0081] The first terminal 102 can record the control information of the controls operated by the user in the operating system, and send the recorded control information to the server 101 for storage.

[0082] The first terminal 102 may be equipped with an application for capturing control information and user operation, which can record the control information of user operation controls.

[0083] The second terminal 103 can be a computer device such as a desktop computer, a portable computer, or a handheld computer. The second terminal 103 can execute the test case generation method provided in the embodiments of this application to generate multiple operation processes through the operation process generation model, and then generate a large number of test cases.

[0084] When a user operates multiple controls on the first terminal 102, the first terminal 102 can sequentially record the control information of these multiple controls and send it to the server 101. After receiving the control information, the server 101 integrates the control information to obtain multiple historical operation flows and stores them in its memory. Subsequently, when receiving a training task for an operation flow generation model, the server 101 can train an operation flow generation model based on these multiple historical operation flows. The server 101 can then send the trained operation flow generation model to the second terminal 103. After receiving the operation flow generation model, the second terminal 103 first stores the operation flow generation model.

[0085] Subsequently, when the second terminal 103 receives the test case generation instruction, it can execute the specific steps of the test case method provided in the embodiments of this application to generate multiple test cases.

[0086] Before providing a detailed description of the test case generation method provided in the embodiments of this application, the application scenarios of the embodiments of this application will be explained.

[0087] This test case generation method can be applied to scenarios where test cases are automatically generated.

[0088] For example, this test case generation method can be applied to scenarios where test cases are generated for the test task "Connecting to WiFi (Wireless Fidelity)". Specifically, the target operation flow for the "Connecting to WiFi" test task can be obtained first, that is, a test flow that can complete this test task. Then, the target operation flow is processed by a trained operation flow generation model to generate multiple operation flows for the "Connecting to WiFi" test task. Finally, based on the multiple operation flows generated by the operation flow generation model, multiple test cases for the "Connecting to WiFi" test task are generated.

[0089] In this way, multiple operation processes can be automatically generated by the pre-trained operation process generation model, so that testers do not need to write a large number of test cases, which fully frees up manpower, thereby reducing test case writing time and improving testing efficiency.

[0090] The test case generation method provided in the embodiments of this application will be explained in detail below.

[0091] Figure 2 This is a flowchart illustrating a test case generation method provided in an embodiment of this application. This test case generation method can be applied to computer devices; for example, the computer device can be the second terminal 103 in the above-described implementation environment. See also... Figure 2 The method includes the following steps.

[0092] Step 201: The computer device obtains the target operation flow of the task to be tested, which is an operation flow that can complete the task to be tested.

[0093] The task to be tested refers to a task that has not yet been tested but will be tested later. In software testing, testers typically receive test requirements first. After receiving the test requirements, they can perform requirements analysis to determine what the test tasks are and write corresponding test cases based on the test requirements. In this embodiment of the application, the test tasks determined by the testers based on the test requirements are the aforementioned tasks to be tested. However, in this embodiment of the application, testers do not need to write a large number of test cases.

[0094] For example, the task to be tested could be "connecting to WiFi". Another example is "completing account login in application A".

[0095] Optionally, the target operation process can be an operation process written by testers based on test requirements to complete the test task, and the target operation process is the operation steps that need to be performed when performing the test task.

[0096] Optionally, the target operation flow may include control information for multiple controls operated when completing the task under test. For example, if the task under test is a test task under a certain operating system, then the target operation flow consists of the multiple controls operated when completing this test task under that operating system. For instance, if the task under test is "connecting to WiFi," then the control information for the multiple controls included in the target operation flow could be: settings control information, WLAN control information, and target WiFi control information. That is, when testing "connecting to WiFi," you need to first click the settings control, then click the WLAN control, and then click the target WiFi from the WiFi list to connect.

[0097] It should be understood that different operating systems contain different controls. Each control is used to implement different functions. Performing an operation in an operating system may require multiple controls. Therefore, the target operation flow can include control information for the multiple controls operated on when completing the task under test.

[0098] For any one of multiple controls, the control information can include the control's property information and the operation information of the control. Optionally, the control information can include the control identifier, control properties, control state, and control operation mode.

[0099] A control's identifier is used to uniquely identify the control; that is, the identifier tells you which control it is. For example, a control's identifier can be the control's name.

[0100] A control's properties describe the control's operational attributes, such as whether the control is clickable or allows input.

[0101] A control's state indicates whether the control is on or off after being clicked. For example, if a control is named "Settings," and clicking it sets its state to "True," then the control is on, meaning clicking "Settings" opens the "Settings" control.

[0102] The control operation mode of a control refers to the way to operate the control. For example, the control operation mode can include clicking, long-pressing, swiping, and inputting. If the control operation mode of a control is "click", then it means that the control operation mode of this control is clicking.

[0103] When the target operation flow of a task to be tested is written by the tester according to the test requirements, the operation to obtain the target operation flow of the task to be tested can be: in response to the target operation flow writing instruction, display the target operation flow writing interface; in response to the input operation on the target operation flow writing interface, determine the output of the input operation as the target operation flow of the task to be tested.

[0104] The writing instructions for the target operation process can be triggered by specific actions. For example, testers can trigger the writing instructions through clicks, swipes, voice commands, or motion controls. For instance, a tester can trigger the writing instructions by clicking a "write" button.

[0105] The target operation flow writing interface is used to instruct testers to write the target operation flow for the task to be tested. For example, the target operation flow writing interface may include a text input box. This text input box provides testers with an input entry point for writing the target operation flow; that is, testers can write the target operation flow through this text input box.

[0106] In this scenario, it essentially displays an interface for writing operation procedures, allowing testers to create the corresponding procedures. This provides a relatively accurate and convenient way to obtain the target operation procedures.

[0107] Step 202: The computer device generates multiple predicted operation processes for the test task based on the target operation process using an operation process generation model. This operation process generation model is trained by multiple historical operation processes and the annotations of each historical operation process.

[0108] This operation flow generation model is used to automatically generate multiple predicted operation flows for a task to be tested. Optionally, the operation flow generation model can be a text generation model, that is, text generation is achieved through natural language processing technology. In the embodiments of this application, the operation flow generation model uses natural language processing technology to understand the input target operation flow, and then outputs multiple predicted operation flows for the task to be tested.

[0109] Multiple historical operation flows are the user's operation flow of controls in the operating system, which can be recorded by the first terminal 102 in the above implementation environment. For example, multiple historical operation flows may include the user's operation flow of controls when "connecting to WiFi", and may also include the operation flow of controls when "logging in an account in application A", etc.

[0110] The annotations for each historical operation process indicate the multiple actual operation processes of the test task corresponding to each historical operation process. That is, in real-world scenarios, there are multiple operation methods that can be implemented when executing the test task. Optionally, the annotations for each historical operation process can also be obtained by recording the user's operation log. In this case, given multiple operation processes recorded for a single operation task, one of the operation processes can be designated as the input for training the operation process generation model, and the remaining operation processes can be used as annotations for this operation process for subsequent training.

[0111] These multiple predicted operation flows represent the possible operation flows when performing the task under test. That is, during testing, the task under test may not be executed through a single operation method; it can be executed in other ways. Furthermore, users may not always use a single method to operate the controls; various user habits exist. Therefore, the task under test can be executed in multiple ways. For example, for the task "Connect to WiFi," users can click the "Settings" control, click the WLAN control, and then click the target WiFi from the WiFi list to connect. Alternatively, they can click the "Settings" control, click the WLAN control, click the scan control, and then click the target WiFi from the WiFi list to connect. Or, they can click the "Settings" control, click the WLAN control, click "Manually Add Network," and then connect to the manually added WiFi.

[0112] In this scenario, testers need to consider multiple approaches when writing test cases, essentially requiring one test case for each approach. This results in a large number of test cases to be written. Therefore, the aforementioned operation flow generation model can generate multiple predictive operation flows for the task under test.

[0113] In this way, the pre-trained operation flow generation model generates multiple predicted operation flows for the task to be tested based on the target operation flow. This eliminates the need for users to write a large number of test cases based on testing requirements, significantly freeing up manpower and reducing test case writing time, thereby improving testing efficiency.

[0114] Optionally, the operational process generating model may include an encoder and a decoder.

[0115] Encoder-decoder architectures can be used in generative models, such as translation models. They accept a sequence as input, encode the information in the sequence as an intermediate representation, and then decode the intermediate representation into the target language. For example, if the input is French, the encoder-decoder architecture can output the corresponding English language. Therefore, by using encoder-decoders in generation tasks, it becomes possible to generate the text desired by the user.

[0116] An encoder extracts features from the input data, encoding the input text into a vector representation. A decoder decodes the vector representation obtained by the encoder back into a text representation.

[0117] In this case, step 202 can be performed as follows: inputting the target operation flow into the encoder of the operation flow generation model, and mapping the target operation flow into a first feature sequence through the encoder; inputting the first feature sequence into the decoder of the operation flow generation model, and generating the multiple predicted operation flows through the decoder.

[0118] In this scenario, the encoder maps the target operation flow to an intermediate representation, resulting in the first feature sequence. The decoder then decodes this first feature sequence into a text representation, which is essentially the multiple predicted operation flows desired by the user. Due to the generative nature of the encoder-decoder pair, processing the target operation flow using this method yields relatively accurate multiple predicted operation flows.

[0119] For example, the input data is (x1, x2, x3, ..., x...). n The encoder can process this input data, performing non-linear transformations to convert it into an intermediate representation: C = f(x1, x2, x3, ..., x...). n Then, the intermediate representation is decoded by the decoder to obtain multiple prediction operation processes.

[0120] The encoder can be composed of a single-layer or multi-layer RNN (Recurrent Neural Network). In this case, the first sequence features are obtained by encoding the input data (target operation flow) through this single-layer or multi-layer RNN.

[0121] Alternatively, the decoder can be a single-layer or multi-layer RNN (non-bidirectional), and then decode each step according to the context information to output the corresponding text. That is, it decodes each step according to the context information of the first sequence features obtained by encoding, and outputs multiple prediction operation processes.

[0122] Optionally, there can be multiple encoders and decoders, allowing the target operation flow to be mapped to a first feature sequence via multiple encoders, and then the first feature sequence to be decoded into multiple predicted operation flows via multiple decoders. Thus, by extracting features from the target operation flow using multiple encoders, more refined features can be obtained, leading to more potential operation flows after subsequent decoding by multiple decoders.

[0123] For example, Figure 3 This is a schematic diagram of the structure of the model generated by this operation process. See [link / reference]. Figure 3 , Figure 3 It includes input data 301, multiple encoders 302, multiple decoders 303, and output data 304.

[0124] like Figure 3 As shown, the first encoder 302 among the plurality of encoders 302 can extract the sequence features of the input data 301, and the second to last encoders 302 among the plurality of encoders 302 can extract the features of the output sequence of the previous encoder 302. On this basis, each encoder from the second to the last encoder 302 can also fuse the sequence features output by the encoder two years prior.

[0125] The first decoder 303 of the multiple decoders 303 can decode the first sequence features output by the last encoder 303. The second to last decoders 303 of the multiple decoders 303 can decode the feature sequences output by the previous decoder. Furthermore, each encoder between the second and last decoders 303 can fuse the feature sequences output by the decoder two steps prior to it to decode and generate the corresponding prediction operation flow. The last decoder 303 then outputs the results to generate multiple prediction operation flows for the test task.

[0126] Optionally, the operation process generation model may include an attention module and a gating module in addition to the encoder and decoder.

[0127] In this case, the operation of step 202 may include the following steps (1)-(4).

[0128] (1) Input the target operation flow into the encoder and map the target operation flow into the first feature sequence through the encoder.

[0129] (2) Input the first feature sequence into the attention module, and encode the first feature sequence through the attention module to obtain the second feature sequence.

[0130] Attention modules are modules that encode sequences based on attention mechanisms.

[0131] Attention mechanisms can capture global and local relationships in data from a large number of features, thereby identifying the more important features in the feature sequence. Therefore, by setting an attention module in the model generated in this workflow, the more important features in the feature sequence can be identified, thus providing reference information for subsequent decoding operations.

[0132] Optionally, the attention mechanism can be a self-attention mechanism, a multi-head attention mechanism, etc., and this application embodiment does not limit it.

[0133] Self-attention mechanisms are used to determine the correlation between different parts of the entire feature sequence. They consider the positional information of vectors, determining the similarity between vectors at two different positions to subsequently identify the more important features in the entire feature sequence.

[0134] Multi-head attention is an improved attention mechanism that maps feature sequences to different subspaces through various linear transformations. Attention features are then extracted from these different subspaces, resulting in attention features for each subspace. These extracted attention features can then be concatenated to obtain a fused attention feature set. In this way, by extracting attention features from feature sequences from different perspectives, more accurate attention features can be determined.

[0135] In this case, after the first feature sequence is encoded by the attention module, the second feature sequence is obtained by comprehensively considering the more important features in the first feature sequence. That is, the features in the second feature sequence are the features that play a key role in the subsequent decoding process. In this way, a more accurate prediction operation can be obtained by subsequent decoding.

[0136] (3) Input the second feature sequence and the first feature sequence into the gating module, and filter the second feature sequence based on the first feature sequence to obtain the third feature sequence.

[0137] The gating module is a module that performs sequence encoding through a gating mechanism.

[0138] Gating mechanisms are used to control which features are allowed to enter the next layer. In this embodiment, the gating module is used to control which features in the second feature sequence are allowed to enter the decoder. That is, the gating module can act as a filter.

[0139] Furthermore, since the first feature sequence is a more comprehensive feature sequence, representing all the features of the input data, the second feature sequence is filtered by combining the first feature sequence with the gating module. This allows the second sequence to be filtered by integrating all the features of the input data, resulting in a more accurate third feature sequence that avoids the loss of some important features.

[0140] Furthermore, in the proposed embodiment, by combining an attention module and a gating module, the attention module first identifies the more important features to obtain a second feature sequence, which contains the more important features from the entire feature sequence. Subsequently, the gating module allows important features to enter the decoder, while irrelevant features are excluded. This eliminates decoding interference in subsequent decoding, enabling the decoder to decode the multiple prediction operations more quickly.

[0141] Specifically, the operation of filtering the second feature sequence based on the first feature sequence by the gating module to obtain the third feature sequence can be as follows: for each feature vector in the second feature sequence, a gating value corresponding to a feature vector is determined based on the first and second feature sequences; the gating value is multiplied by the feature vector to obtain a feature vector in the third feature sequence.

[0142] The gate value can be either 0 or 1. It can be determined based on whether a feature vector is important. For example, if a feature vector is important, the gate value is 1. If a feature vector is not important, the gate value can be 0. Feature vectors with a gate value of 0 do not flow into the decoder.

[0143] (4) Input the third feature sequence into the decoder and generate the multiple prediction operation process through the decoder.

[0144] The operation of inputting the third feature sequence into the decoder and generating the multiple prediction operation processes through the decoder is similar to the operation of inputting the first feature sequence into the decoder and generating the multiple prediction operation processes through the decoder, and will not be described in detail in the embodiments of this application.

[0145] For example, continuing with the above Figure 3 Examples of encoders and decoders are provided. Figure 4 This is a schematic diagram of the structure of the model generated by this operation process. See [link / reference]. Figure 4 , Figure 4 It includes input data 301, multiple encoders 302, attention module 401, gating module 402, multiple decoders 303, and output data 304.

[0146] like Figure 4As shown, after the last encoder 302 of the plurality of encoders 302 outputs the first feature sequence, the first feature sequence can be input into the attention module 401 to perform attention encoding on the first feature sequence, thereby obtaining the second feature sequence. Then, the second feature sequence and the first feature sequence are input into the gating module 402, which filters the second feature sequence to retain the more important features and remove the less important features, resulting in the third feature sequence. Subsequently, the third feature sequence is input into the first decoder 303 of the plurality of decoders 303, and then decoded sequentially through the plurality of decoders 303, thereby obtaining the plurality of prediction operation flows 304.

[0147] It is worth noting that before generating multiple predicted operation flows for the test task based on the target operation flow using the operation flow generation model, the operation flow generation model also needs to be trained.

[0148] The training of the operation process generation model can be performed by server 101 in the aforementioned implementation environment. The training process of the operation process generation model is described in detail below.

[0149] Specifically, the server can first obtain a sample dataset; then, based on the sample dataset, train the operation process generation model.

[0150] The sample dataset may include multiple training samples. These multiple training samples may be pre-set, and each training sample includes sample data and sample annotations. The sample data contains the historical operation flow of a sample task, and the sample annotations are the multiple operation flows that exist to complete this sample task. That is, each training sample includes a historical operation flow of a sample task and the other multiple operation flows of this sample task.

[0151] The historical operation flow can include control information for multiple controls, which are the controls operated on during the completion of the sample task. Furthermore, the control information for these controls can include control identifiers, control properties, control states, control operation methods, and the number of times each control has been operated.

[0152] Optionally, the format of the control information of any one of the multiple controls in a historical operation process can be [id, text, clickable, enable, operator, inputText, operatorTimes].

[0153] `id` represents the control's identifier. `text` represents the textual description of the control; for example, if a control is a settings control, then `text` could be "Settings". `clickable` indicates whether the control is clickable; its value is generally "True" (clickable) or "False" (not clickable). `enable` indicates the control's state; its value is generally "True" (on) or "False" (off). `operator` indicates the user's interaction with the control, including clicking (single, double, three-finger), swiping, long-pressing, and typing. `inpuText` represents the content entered into the control. Its value is empty when no input is entered. `operatorTimes` represents the number of times the control has been operated on, that is, the number of times the control has been repeatedly operated on in a historical operation flow.

[0154] This workflow generation model can include multiple network layers, including an input layer, multiple hidden layers, and an output layer. The input layer is responsible for receiving input data; the output layer is responsible for outputting the processed data; the multiple hidden layers are located between the input and output layers and are responsible for processing the data. These hidden layers are not visible to the outside world. For example, this workflow generation model can be a text generation model, such as a Seq2Seq model or a SeqGAN model.

[0155] The operation of obtaining the sample dataset can be as follows: For any one of the multiple training samples in the sample dataset, when the target operating system is currently on the main interface, for each selection operation of a control in the target operating system, the control information of the control is recorded until the target operating system is on the main interface again; the control information of at least two recorded controls is determined as this training sample.

[0156] The target operating system is the operating system executed by the sample task. Furthermore, the target operating system refers to the operating system installed on the first terminal 102 in the aforementioned implementation environment. For example, the target operating system could be Android 10.0. Or, for example, it could be Android 12.0. This application does not specifically limit the target operating system.

[0157] The main interface refers to the first screen displayed after entering the target operating system. In the case of a mobile phone with the target operating system installed, the main interface is generally referred to as the phone's home screen.

[0158] The selection of a control in the target operating system can be triggered by the user. For example, the user can trigger the selection of this control through clicking, swiping, or inputting. For instance, the user clicks the control to trigger the selection.

[0159] In this scenario, whenever the target operating system is on the main screen, if a selection operation on a control is detected, the control information of that control is captured and recorded until the target operating system returns to the main screen. In other words, the control operation pipeline from the start of the main screen to the return to the main screen is used as a training sample.

[0160] In this way, multiple control operation flows are recorded, that is, multiple historical operation processes are used as multiple training samples to form a sample dataset, which is then used to train the operation process generation model.

[0161] The server trains the operation process generation model based on the sample dataset by: inputting the control identifiers, control attributes, control states, control operation methods, and control operation counts of multiple controls into the operation process generation model; generating multiple first operation processes for the sample task based on the control identifiers, control attributes, control states, control operation methods, and control operation counts of the multiple controls; and updating the parameters of the operation process generation model based on the differences between the annotations of the multiple first operation processes and the historical operation processes.

[0162] Multiple first operation procedures are operation procedures generated by the operation procedure generation model during model training.

[0163] In this scenario, a training sample (a historical operation procedure) is input into the operation procedure generation model, resulting in output data, which consists of multiple first operation procedures. The parameters of the operation procedure generation model are then updated based on the differences between the annotations of these multiple first operation procedures and the historical operation procedure.

[0164] It should be understood that for multiple training samples in the sample dataset, each of the multiple training samples is input into the operation process generation model, and the above operation is performed to update the parameters of the operation process generation model.

[0165] The operation of updating the parameters of the operation process generation model based on the difference between the annotations of the multiple first operation processes and the historical operation process can be as follows: determine the loss value between the annotations of the multiple first operation processes and the historical operation process through a loss function; and adjust the parameters of the operation process generation model according to the loss value.

[0166] After adjusting the parameters of the operation process generation model based on each of the multiple training samples, the model with the adjusted parameters is the operation process generation model, and at this time the parameters of the operation process generation model are the optimal parameters.

[0167] For example, computer equipment can use formulas This allows adjustment of any parameter in the model generated for the operation process. Among them, These are the adjusted parameters. W is the parameter before adjustment. α is the learning rate, which can be preset, such as 0.001, 0.000001, etc., but this application does not limit this to a single value. dw is the derivative of the loss function with respect to W, which can be obtained from the loss value.

[0168] It is worth noting that the server obtains the optimal parameters of the operation process generation model by updating the parameters of the model multiple times; that is, the operation process generation model is trained through multiple rounds of training. It is understood that each round of training in the multi-round training process of the operation process generation model is the same. In this embodiment, only one round of training is used as an example to illustrate the training process of the operation process generation model.

[0169] Furthermore, after the operation process generation model is trained, it can be validated to verify whether its accuracy meets the usage requirements.

[0170] Specifically, a validation dataset is obtained, which includes multiple validation data sets, each containing a historical operation process. For each validation data set, the validation data is input into the operation process generation model, which generates multiple second operation processes. Based on the multiple second operation processes and the annotations of the validation data, the accuracy of the operation process generation model is determined. If the accuracy of the operation process generation model is greater than a preset accuracy threshold, the model is determined to be trained successfully. If the accuracy of the operation process generation model is less than or equal to the preset accuracy threshold, the model is determined to be untrained.

[0171] These multiple validation datasets are used to validate the operation procedure generation model after training. These validation datasets are the same as the multiple training samples, and their input data consists of multiple historical operation procedures. The difference is that these validation datasets are not involved in the training process of the operation procedure generation model. Therefore, by validating the operation procedure generation model using multiple validation datasets, the accuracy of the operation procedure generation model can be accurately obtained.

[0172] Multiple second operation processes are multiple operation processes generated during the model validation process of the model generated by this operation process.

[0173] The accuracy of the operational procedure generation model is used to indicate its precision. Higher accuracy indicates greater precision, meaning the predicted second operational procedures are closer to the labeled data in the validation dataset, indicating better generation performance. Conversely, lower accuracy indicates lower precision, meaning the predicted second operational procedures deviate significantly from the labeled data, indicating poorer generation performance.

[0174] The preset accuracy threshold can be set in advance. Furthermore, the preset accuracy threshold can be set to a relatively large value. For example, the preset accuracy threshold can be set to 0.9.

[0175] In this scenario, if the accuracy of the operation process generation model is greater than the preset accuracy threshold, it indicates that the model has high accuracy, meaning its generation performance is good, and the server can determine that the model has been successfully trained. Conversely, if the accuracy of the operation process generation model is less than or equal to the preset accuracy threshold, it indicates that the model has low accuracy, meaning its generation performance is poor, and the server can determine that the model has not been successfully trained and requires further training.

[0176] Furthermore, if the server determines that the operation process generation model has not been fully trained, it can adjust the hyperparameters of the operation process generation model and train the adjusted operation process generation model.

[0177] The hyperparameters of this workflow generation model are fixed during training. Generally, before training the workflow generation model, technicians can manually set the hyperparameters based on actual needs. The purpose of the hyperparameters is to ensure that the workflow generation model neither fails to fit nor overfits during training, while allowing the network to learn the data structure features as quickly as possible.

[0178] Optionally, the server can adjust the learning rate of the operation process generation model and train the operation process generation model with the adjusted learning rate.

[0179] The parameter updates of the model generated by this process depend on the gradient error and the learning rate. A larger learning rate results in a larger step size for parameter updates, while a smaller learning rate results in a smaller step size. During model training, adjusting the learning rate can change the magnitude of parameter updates. Based on this, the learning rate determines whether the parameters can be updated to their optimal values ​​and whether they can be updated quickly. Therefore, the learning rate of the model generated by this process can be adjusted.

[0180] In this case, by training the operation process generation model after adjusting the learning rate, the operation process generation model can be updated to the optimal parameters, thereby improving the model accuracy.

[0181] For example, the server can reduce the learning rate of the operation process generation model to decrease the step size of parameter updates, so that the parameters will not miss the optimal parameter values ​​during the update process, thus enabling the operation process generation model to obtain the optimal parameters, thereby improving the model accuracy.

[0182] Furthermore, after confirming that the operation process generation model has been trained, a test dataset can be obtained; the operation process generation model can then be tested based on the test dataset.

[0183] The test dataset includes multiple test data sets, similar to the aforementioned validation data sets, all of which are historical operational procedures input into the model. Furthermore, these test data sets are not used in the training or validation process of the operational procedure generation model. Therefore, the operational procedure generation model can be accurately tested using the multiple test data sets in the test dataset.

[0184] It should be noted that the sample dataset used in the training model, the validation dataset used in the validation model, and the test dataset used in the testing model were all obtained by processing the recorded historical user interaction flow with the controls.

[0185] Specifically, when a large number of historical operation processes are recorded, the recorded historical operation processes can be summarized and preprocessed, and the large number of preprocessed historical operation processes can be divided into sample datasets for training models, validation datasets for validating models, and test datasets for testing models.

[0186] When summarizing and preprocessing the recorded historical operation processes, for a given historical operation process, duplicate operations can be performed on controls that have repeated operations in this historical operation process, and the number of times the control has been operated can be added to the control information of that control.

[0187] In this scenario, if a control is repeatedly accessed within a given historical workflow, then control information for that control will appear multiple times consecutively in the workflow. Therefore, a deduplication operation can be performed on this control, meaning that only one instance of the control's information is retained within a single historical workflow, while simultaneously recording the number of times the control was accessed.

[0188] This makes the entire historical operation process simpler, and the subsequent operation process generation model can more easily process the historical operation process.

[0189] Thus, through the above step 202, multiple predicted operation flows for the task to be tested can be generated by the operation flow generation model obtained through training. That is, multiple predicted operation flows for the task to be tested can be predicted by the operation flow generation model, so that multiple test cases for the task to be tested can be determined accordingly.

[0190] Step 203: The computer device generates multiple test cases for the task to be tested based on the multiple predictive operation processes.

[0191] A test case is a set of test steps designed for a specific purpose, in order to test a program path or verify whether a specific requirement is met.

[0192] Optionally, a complete test case may include the following seven elements.

[0193] First, the test environment: that is, what the system to be tested is. In the embodiments of this application, the test environment is the environment in which the task to be tested is executed.

[0194] Second, test data: the input values ​​when a test task is executed. When test data is required in a test, it can be set in advance by technical personnel.

[0195] Third, test steps: provide the steps of the test execution process, that is, the steps to be performed when executing the task to be tested.

[0196] Fourth, expected results: Expected results are derived from the outputs in the test requirements. Therefore, during actual testing, if the actual test results do not match the expected results, the test can be considered a failure; otherwise, the test can be considered a success.

[0197] Fifth, Test Case Title: The test case title is a description of the main idea of ​​the test case and is used to indicate the purpose of the test case.

[0198] Sixth, Test Case Number: Define a test case number to identify the uniqueness of each test case and to track and maintain test cases.

[0199] Seventh, test case levels: These are generally divided into four levels: P0, P1, P2, and P3. Different levels correspond to different test content. For example, P0 level test cases are used for testing basic functionalities and core business processes, while P1 level test cases are used for testing non-core basic functions.

[0200] The above seven elements constitute a complete test case. In practical use, the third element—the test steps—is the most important. Test steps are the elements that define the steps involved in the test execution process; therefore, they are indispensable in a test case. Furthermore, regarding expected results, test cases may or may not include expected results depending on the requirements. The content of the remaining elements is likely fixed for a given test task, thus not increasing the workload of the testers.

[0201] In this case, the operation in step 203 can be implemented in the following two possible ways.

[0202] The first possible implementation is to define a test step of a test case for the task to be tested, without setting the expected result in the test case and only including the test steps. For any one of the multiple predictive operation processes, the predictive operation process is determined as a test step of a test case for the task to be tested.

[0203] In other words, the multiple predictive operation processes generated by the model through this operation process are the test steps of multiple test cases. In this case, multiple test cases of the task to be tested can be obtained directly, making the generation process of multiple test cases more convenient and improving the generation efficiency of test cases.

[0204] It should be noted that, in the embodiments of this application, the first possible implementation can be applied to scenarios of stress testing, for example, to test scenarios of stress testing using the Monkey testing method.

[0205] Furthermore, stress testing is a random testing method that tests the robustness of a system or application through random operations. In other words, it continuously performs random operations on the system or application to determine how long it will take before an anomaly occurs, or whether an anomaly will occur at all. However, these random operations are chaotic and unrelated to users' daily routines, which can lead to inaccurate test results.

[0206] In this embodiment, the operation flow generation model is trained using the user's historical operation flow of the control, which comprehensively covers the user's daily usage scenarios. Therefore, the operation flow generation model learns the basic characteristics of the user's use of the control, as well as the user's operation process in different scenarios. Consequently, the multiple predicted operation flows generated by this model in step 202 are combined with the characteristics of the user's daily use of the control, making them more closely aligned with the user's usage scenarios.

[0207] In this way, the operation process generation model can automatically and efficiently generate operation processes that can fully cover user scenarios. This allows for the automatic generation of a large number of test cases that are more in line with user scenarios and user operations, thereby ensuring that subsequent tests are more in line with user operating habits and making the tests more accurate.

[0208] The second possible implementation involves setting the expected result in the test case, and for any one of the multiple prediction operation processes, determining one prediction operation process as the test step of a test case for the task to be tested; and combining this test step and the expected result into a test case for the task to be tested.

[0209] It is worth noting that after generating these multiple prediction operation processes, the expected results of the task to be tested can also be obtained.

[0210] The expected result of a task to be tested can be determined based on the requirements of that task. It should be understood that the generation of test cases is intended to execute the task to be tested, and the purpose of executing the task to be tested is to obtain the expected result. Therefore, the expected result of a task to be tested should be the expected result of the multiple test cases.

[0211] In this case, by combining the test step and the expected result into a test case for the task to be tested, the test case includes the test step and the expected result after executing the test step, so that accurate testing can be carried out subsequently.

[0212] Furthermore, after generating multiple test cases for the task to be tested through steps 201-203 above, corresponding test scripts can be generated based on these multiple test cases; and the corresponding test scripts can be automatically executed to perform the task to be tested.

[0213] In this case, the multiple test cases are more closely aligned with user scenarios and user operations. Therefore, executing the test scripts corresponding to these multiple test cases can detect anomalies that may exist in various user scenarios, that is, it can detect anomalies that may exist in potential operation processes. This makes the test results more interpretable and the test more accurate.

[0214] After executing the corresponding test script, the actual test results of the task to be tested can be obtained. The actual test results are then compared with the expected results. If the actual test results match the expected results, the test is considered passed; if the actual results do not match the expected results, the test is considered failed.

[0215] To facilitate understanding, we will now combine... Figure 5 The test case generation method provided in the embodiments of this application will be explained and described. For example, Figure 5 A flowchart of a test case generation method is shown below. Figure 5 , Figure 5 This includes steps 501-506.

[0216] Step 501: Capture and record the user's historical operation flow on the control.

[0217] Step 502: Process the recorded historical operation process data.

[0218] Specifically, the recorded historical operation processes are summarized and preprocessed, and the large number of historical operation processes obtained after preprocessing are divided into a sample dataset, a validation dataset, and a test dataset.

[0219] Step 503: Train the operation process generation model based on the sample dataset.

[0220] After model training is complete, the trained operation process generation model is validated using a validation dataset to determine if it has successfully completed training. If the model has been confirmed to have completed training, it is then tested using a test dataset before being deployed.

[0221] Step 504: Obtain the target operation flow of the task to be tested.

[0222] The target operation flow may include control information for multiple controls that the user needs to use when completing the task to be tested.

[0223] For example, the task to be tested is "connect to WiFi". One operation flow for performing the task to be tested is "desktop - click settings - click WLAN - slide the scan list - click SSID - enter password - click OK to connect - return to desktop".

[0224] The target operation flow can then include control information for the following multiple controls:

[0225] {[app, settings, True, True, click, NULL, 1],

[0226] [button1,WLAN,True,True,click,NULL,1],

[0227] [layout1, scan list, True, True, swipe, NULL, 5],

[0228] [layout2,SSID,True,True,click,NULL,1],

[0229] [editText1, Enter Password, True, True, input, 12345678, 1],

[0230] [layout3, NULL, True, True, click, NULL, 1],

[0231] [home, NULL, True, True, swipe, NULL, 1]}

[0232] Step 505: Generate multiple prediction operation processes for the task to be tested through this operation process.

[0233] The target operation process is input into the operation process generation model, which then processes the target operation process to generate an operation process that comprehensively covers user scenarios.

[0234] Step 506: Based on these multiple test operation processes, generate multiple test cases.

[0235] In this embodiment, the computer device first obtains the target operation flow of the task to be tested, that is, it first obtains an operation flow that can complete the task to be tested. Then, the target operation flow can be input into an operation flow generation model, which generates multiple predicted operation flows for the task to be tested based on the target operation flow. The operation flow generation model is pre-trained and is trained using multiple historical operation flows and their annotations. After obtaining multiple predicted operation flows, multiple test cases for the task to be tested can be generated based on these predicted operation flows. Thus, by automatically generating multiple predicted operation flows for the task to be tested through a pre-trained operation flow generation model, testers do not need to write a large number of test cases, significantly freeing up manpower, reducing test case writing time, and improving testing efficiency.

[0236] Figure 6 This is a schematic diagram of a test case generation device provided in an embodiment of this application. The test case generation device can be implemented as part or all of a computer device by software, hardware, or a combination of both. This computer device can be as described below. Figure 7 The computer equipment shown. See also Figure 6 The device includes: a first acquisition module 601, a first generation module 602, and a second generation module 603.

[0237] The first acquisition module 601 is used to acquire the target operation flow of the task to be tested, which is an operation flow that can complete the task to be tested.

[0238] The first generation module 602 is used to generate multiple predicted operation processes for the test task based on the target operation process through an operation process generation model. The operation process generation model is trained by multiple historical operation processes and the annotation of each historical operation process.

[0239] The second generation module 603 is used to generate multiple test cases for the task to be tested based on the multiple prediction operation processes.

[0240] Optionally, the operation flow generates a model including an encoder and a decoder, with the first generation module used for 602:

[0241] The target operation flow is input into the encoder, and the encoder maps the target operation flow into a first feature sequence.

[0242] The first feature sequence is input into the decoder, which generates the multiple prediction operation processes.

[0243] Optionally, the operation flow generation model further includes an attention module and a gating module, and the first generation module 602 is also used for:

[0244] The first feature sequence is input into the attention module, and the attention module performs attention encoding on the first feature sequence to obtain the second feature sequence;

[0245] The second feature sequence and the first feature sequence are input into the gating module, and the gating module filters the second feature sequence based on the first feature sequence to obtain the third feature sequence;

[0246] The third feature sequence is input into the decoder, which generates the multiple prediction operation processes.

[0247] Optionally, the device further includes:

[0248] The second acquisition module is used to acquire the expected results of the task to be tested;

[0249] The second generation module 603 is used for:

[0250] For any one of the multiple prediction operation processes, this prediction operation process is determined as a test step of a test case;

[0251] Combine the test steps and the expected results into test cases for the task to be tested.

[0252] Optionally, the device further includes:

[0253] The third acquisition module is used to acquire the sample dataset, which includes multiple training samples. Any one of these training samples includes the historical operation process of the sample task and the annotation of this historical operation process.

[0254] The training module is used to train a model for generating the operation process based on the sample dataset.

[0255] Optionally, the historical operation flow includes control information for multiple controls, which are the controls operated during the completion of the sample task. This control information includes control identifier, control attributes, control state, control operation method, and the number of control operations. This training module is used for:

[0256] Input the control identifier, control properties, control state, control operation mode, and number of control operations of these multiple controls into the operation flow generation model;

[0257] Based on the control identifiers, attributes, states, operation methods, and number of operations of these multiple controls, the model generated through this operation process generates multiple first operation processes for this sample task.

[0258] Based on the differences between the annotations of multiple first operation procedures and the historical operation procedures, the parameters of the operation procedure generation model are updated.

[0259] Optionally, the third acquisition module is used for:

[0260] For any one of the multiple training samples in the sample dataset, when the target operating system is currently on the main interface, each time a selection operation is received on a control in the target operating system, the control information of that control is recorded until the target operating system is on the main interface again.

[0261] The control information of at least two controls obtained from the recording is used as the training sample.

[0262] In this embodiment, the target operation flow of the task to be tested is first obtained, that is, an operation flow capable of completing the task. Then, the target operation flow can be input into an operation flow generation model, which generates multiple predicted operation flows for the task to be tested based on the target operation flow. The operation flow generation model is pre-trained and trained using multiple historical operation flows and their annotations. After obtaining multiple predicted operation flows, multiple test cases for the task to be tested can be generated based on these predicted operation flows. Thus, by automatically generating multiple predicted operation flows for the task to be tested through a pre-trained operation flow generation model, testers do not need to write a large number of test cases, significantly freeing up manpower, reducing test case writing time, and improving testing efficiency.

[0263] It should be noted that the test case generation device provided in the above embodiments is only illustrated by the division of the above functional modules when generating test cases. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0264] The functional units and modules in the above embodiments 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. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of the embodiments of this application.

[0265] The test case generation device and test case generation method provided in the above embodiments belong to the same concept. The specific working process and technical effects of the units and modules in the above embodiments can be found in the method embodiment section, and will not be repeated here.

[0266] Figure 7This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 6 As shown, the computer device 6 includes a processor 70, a memory 71, and a computer program 72 stored in the memory 71 and executable on the processor 70. When the processor 70 executes the computer program 72, it implements the steps in the test case generation method in the above embodiments.

[0267] Computer device 7 can be a general-purpose computer device or a special-purpose computer device. In specific implementations, computer device 7 can be a desktop computer, a portable computer, a network server, a handheld computer, a mobile phone, a tablet computer, etc., and the embodiments of this application do not limit the type of computer device 7. Those skilled in the art will understand that... Figure 7 The computer device 7 is merely an example and does not constitute a limitation on the computer device 7. It may include more or fewer components than shown in the figure, or combine certain components, or different components, such as input / output devices, network access devices, etc.

[0268] Processor 70 can be a Central Processing Unit (CPU), or it can be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.

[0269] In some embodiments, memory 71 may be an internal storage unit of the computer device 7, such as a hard disk or RAM of the computer device 7. In other embodiments, memory 71 may be an external storage device of the computer device 7, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD) card, flash card, etc., provided on the computer device 7. Furthermore, memory 71 may include both internal storage units and external storage devices of the computer device 7. Memory 71 is used to store the operating system, applications, boot loader, data, and other programs. Memory 71 may also be used to temporarily store data that has been output or will be output.

[0270] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the steps in the various method embodiments described above.

[0271] This application provides a computer program product that, when run on a computer, causes the computer to perform the steps described in the various method embodiments above.

[0272] 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, all or part of the processes in the above method embodiments of this application can be implemented by a computer program instructing related hardware. This computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or some intermediate form. The computer-readable medium can include at least: any entity or device capable of carrying the computer program code to a photographing device / terminal device, a recording medium, a computer memory, ROM (Read-Only Memory), RAM (Random Access Memory), CD-ROM (Compact Disc Read-Only Memory), magnetic tape, floppy disk, and optical data storage devices. The computer-readable storage medium mentioned in this application can be a non-volatile storage medium; in other words, it can be a non-transient storage medium.

[0273] It should be understood that all or part of the steps of the above embodiments can be implemented by software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented in whole or in part as a computer program product. The computer program product includes one or more computer instructions. The computer instructions can be stored in the above-described computer-readable storage medium.

[0274] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0275] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0276] In the embodiments provided in this application, it should be understood that the disclosed apparatus / computer devices and methods can be implemented in other ways. For example, the apparatus / computer device embodiments described above are merely illustrative. For instance, the division of modules or 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.

[0277] 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.

[0278] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A test case generation method, characterized in that, The method includes: Obtain the target operation flow of the task to be tested, wherein the target operation flow is an operation flow that can complete the task to be tested; The operation process generation model generates multiple predicted operation processes for the task to be tested based on the target operation process. The operation process generation model is trained by multiple historical operation processes and the annotation of each historical operation process. Based on the multiple prediction operation processes, multiple test cases are generated for the task to be tested; Before the process of obtaining the target operation flow for the task to be tested, the following is also included: Obtain a sample dataset, which includes multiple training samples. Any one of the multiple training samples includes the historical operation flow of the sample task and the annotation of the historical operation flow. The historical operation flow includes control information of multiple controls. The multiple controls are controls operated in the process of completing the sample task. The control information includes control identifier, control attribute, control state, control operation method, and control operation count. Input the control identifier, control attributes, control state, control operation method, and number of control operations of the multiple controls into the operation flow generation model; The model is generated through the operation process to generate multiple first operation processes for the sample task based on the control identifier, control attributes, control state, control operation method, and control operation count of the multiple controls. Based on the differences between the annotations of the multiple first operation processes and the historical operation processes, the parameters of the operation process generation model are updated.

2. The method as described in claim 1, characterized in that, The operation flow generation model includes an encoder and a decoder. The process of generating multiple predicted operation flows for the test task based on the target operation flow using the operation flow generation model includes: The target operation flow is input into the encoder, and the encoder maps the target operation flow into a first feature sequence; The first feature sequence is input into the decoder, and the decoder generates the plurality of prediction operation processes.

3. The method as described in claim 2, characterized in that, The operation flow generation model further includes an attention module and a gating module. After inputting the target operation flow into the encoder and mapping the target operation flow into a first feature sequence through the encoder, the model further includes: The first feature sequence is input into the attention module, and the attention module performs attention encoding on the first feature sequence to obtain the second feature sequence; The second feature sequence and the first feature sequence are input into the gating module, and the gating module filters the second feature sequence based on the first feature sequence to obtain the third feature sequence; The third feature sequence is input into the decoder, and the decoder generates the multiple prediction operation processes.

4. The method as described in claim 1, characterized in that, Before generating multiple test cases for the task to be tested based on the multiple prediction operation processes, the method further includes: Obtain the expected results of the task to be tested; The generation of multiple test cases for the task to be tested based on the multiple prediction operation processes includes: For any one of the multiple prediction operation processes, the prediction operation process is determined as the test step of the test case; The test steps and the expected results are combined to form test cases for the task to be tested.

5. The method as described in claim 1, characterized in that, The acquisition of the sample dataset includes: For any one of the multiple training samples in the sample dataset, when the target operating system is currently on the main interface, each time a selection operation of a control in the target operating system is received, the control information of that control is recorded until the target operating system is on the main interface again. The control information of at least two controls obtained from the recording is determined as the training samples.

6. A test case generation device, characterized in that, The device includes: The first acquisition module is used to acquire the target operation flow of the task to be tested, wherein the target operation flow is an operation flow that can complete the task to be tested. The first generation module is used to generate multiple predicted operation processes for the task to be tested based on the target operation process through an operation process generation model. The operation process generation model is trained by multiple historical operation processes and the annotation of each historical operation process. The second generation module is used to generate multiple test cases for the task to be tested based on the multiple prediction operation processes. The device further includes: The third acquisition module is used to acquire a sample dataset, which includes multiple training samples. Any one of the multiple training samples includes the historical operation flow of the sample task and the annotation of the historical operation flow. The historical operation flow includes control information of multiple controls. The multiple controls are controls operated in the process of completing the sample task. The control information includes control identifier, control attribute, control state, control operation mode and control operation count. The training module is used to input the control identifiers, control attributes, control states, control operation methods, and control operation counts of the multiple controls into the operation flow generation model; the operation flow generation model generates multiple first operation flows for the sample task based on the control identifiers, control attributes, control states, control operation methods, and control operation counts of the multiple controls; and updates the parameters of the operation flow generation model based on the differences between the annotations of the multiple first operation flows and the historical operation flows.

7. A computer device, characterized in that, The computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the method as described in any one of claims 1 to 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, implements the method as described in any one of claims 1 to 5.