Test case priority acquisition method and device, and storage medium
By extracting multiple target text fields from the text data of test cases, performing structured concatenation, and using a neural network model to predict priorities, the problem of low efficiency and poor consistency in test case priority labeling in existing technologies is solved. This achieves automated, stable, and efficient priority acquisition, adapts to different testing scenarios, and supports cross-platform reuse.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- AIJI MICRO CONSULTING (XIAMEN) CO LTD
- Filing Date
- 2026-02-04
- Publication Date
- 2026-05-26
AI Technical Summary
In existing technologies, the priority labeling of test cases mainly relies on manual judgment or simple rules, which leads to low efficiency, strong subjectivity, poor consistency and stability of results, and an inability to fully utilize the semantic information of test cases, making it difficult to adapt to different testing scenarios.
By extracting multiple target text fields from the text data of test cases, structurally concatenating them to form a comprehensive text feature sequence, and using a pre-trained neural network model for priority prediction, the semantic information of test cases is fully utilized to achieve a unified standard for automatic priority acquisition.
It improves the consistency and stability of test case priority determination, enhances testing efficiency, strengthens generalization ability, supports cross-platform model reuse, and reduces manual and maintenance costs.
Smart Images

Figure CN122086776A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of software testing technology, specifically to a method for obtaining the priority of test cases, a device for obtaining the priority of test cases, and a storage medium. Background Technology
[0002] A test case is a description of a specific software product's testing task. It's a set of test inputs, execution conditions, and expected results designed for a specific goal to verify whether a particular software requirement is met. Testing a software product typically involves executing a large number of test cases. To ensure the order of these test cases, they need to be prioritized, with higher-priority test cases being executed first. In existing technologies, test case priorities are usually manually assigned by testers based on experience, or obtained through preset rules or keyword matching. However, manual assignment is inefficient, and priority determination results are highly subjective, inconsistent, and unstable. Methods based on preset rules and keyword matching only focus on single information such as the test case's title or description, failing to fully utilize the textual information of the test cases and thus not comprehensively reflecting their semantic information. This results in weak generalization ability and difficulty adapting to different testing scenarios. Summary of the Invention
[0003] In view of this, this application provides a method, device, and storage medium for obtaining test case priorities. It can automatically obtain test case priorities using a unified standard, resulting in better consistency and stability of priority determination results. Furthermore, it fully utilizes the text field information of test cases when obtaining priorities, comprehensively reflecting the semantic information of test cases, and can adapt to different test scenarios.
[0004] This application provides a method for obtaining the priority of test cases, including: In response to the collected text data of the test cases, multiple target text fields are extracted from the text data of the test cases, and each target text field has a different dimension; The multiple target text fields are structurally concatenated to obtain a comprehensive text feature sequence; The comprehensive text feature sequence is input into a pre-trained neural network model, which has multiple levels of candidate priorities. The neural network model outputs the predicted probability of each candidate priority corresponding to the test case; The candidate with the highest predicted probability is selected as the priority of the test case.
[0005] Optionally, the extraction of multiple target text fields from the text data of the test cases includes: Extract at least two of the following from the text data of the test cases: title, description, test steps, expected results, preconditions, module, and priority label, and use them as target text fields.
[0006] Optionally, the method further includes: Determine whether the text data of the test case contains a text field corresponding to the priority label; If so, then perform the step of extracting multiple target text fields from the text data of the test case; If not, the priority of the test case will be marked as the lowest priority, or a prompt will be made to add a priority label to the test case, and after adding the label, the step of extracting multiple target text fields from the text data of the test case will be executed.
[0007] Optionally, the step of structurally concatenating the plurality of target text fields includes: Each target text field's field name and the corresponding field value are combined into a sub-text segment to obtain multiple sub-text segments corresponding to the multiple target text fields; The multiple sub-text segments are concatenated according to a preset field order.
[0008] Optionally, the method further includes: In response to detecting that a new test case is input into the neural network model, the semantic similarity between the new test case and the existing test case is obtained; When the semantic similarity meets the first preset condition, it is determined that the neural network model is suitable for the new test case, and the priority of the new test case is obtained by using the neural network model.
[0009] Optionally, obtaining the semantic similarity between the new test case and the existing test case includes: Obtain a first semantic vector obtained by semantically encoding the comprehensive text feature sequence corresponding to the test case through the neural network model, and a second semantic vector obtained by semantically encoding the comprehensive text feature sequence corresponding to the new test case; In the semantic space corresponding to the neural network model, the distance between the first semantic vector and the second semantic vector is calculated as the semantic similarity between the new test case and the test case.
[0010] Optionally, the method further includes: In response to detecting that the neural network model has been switched from the first platform to the second platform, a first test case set for the first platform and a second test case set for the second platform are obtained; Calculate the average semantic similarity between the first test case set and the second test case set; Determine whether the average semantic similarity meets the second preset condition; Furthermore, when the average semantic similarity meets the second preset condition, it is determined that the neural network model is suitable for the second platform.
[0011] Optionally, the average semantic similarity satisfies a second preset condition, including at least one of the following: The average semantic similarity reaches the first threshold; The average semantic similarity is between a first threshold and a second threshold, wherein the first threshold is greater than the second threshold; Determining that the neural network model is suitable for the second platform includes: When the average semantic similarity reaches the first threshold, the neural network model is directly used to prioritize test cases based on the input from the second platform. When the average semantic similarity is between the first threshold and the second threshold, the neural network model is optimized based on the labeled data of the second platform, and the optimized neural network model is used to prioritize the test cases input based on the second platform.
[0012] This application provides a test case priority acquisition device, including a processor and a memory. The memory stores a priority acquisition program. When the priority acquisition program is executed by the processor, it implements the steps of the priority acquisition method for any of the above-mentioned test cases.
[0013] This application provides a storage medium storing a computer program, which, when executed by a processor, implements the steps of the priority acquisition method for any of the above test cases.
[0014] As described above, this application structurally concatenates the multidimensional textual features of test cases to obtain a comprehensive textual feature sequence, which is then input into a pre-trained neural network model. The neural network model performs inference calculations and outputs the priority prediction result of the test cases. By utilizing multidimensional textual features, the textual field information of the test cases can be fully utilized, comprehensively reflecting the semantic information of the test cases. This results in a high generalization ability for the priority acquisition method of this application, adapting to different testing scenarios. Furthermore, this application essentially uses a unified standard to automatically acquire the priority of test cases, significantly improving testing efficiency compared to manual annotation methods, and demonstrating good consistency and stability in priority determination results.
[0015] In addition, this application can determine whether a neural network model can be used across platforms (or projects) based on the fact that the average semantic similarity between test case sets meets the corresponding preset conditions. This enables the application to support model reuse between different platforms or projects, reducing labor and maintenance costs. Attached Figure Description
[0016] Figure 1 This is a flowchart illustrating the method for obtaining the priority of test cases according to the first embodiment of this application; Figure 2 This is a schematic diagram of the layer structure of a deep learning priority classification model according to an embodiment of this application; Figure 3 This is a flowchart illustrating the method for obtaining the priority of test cases according to the second embodiment of this application; Figure 4 This is a flowchart illustrating the method for obtaining the priority of test cases according to the third embodiment of this application; Figure 5 This is a schematic diagram of the structure of a test case priority acquisition device provided in an embodiment of this application. Detailed Implementation
[0017] To address the aforementioned problems in the prior art, this application provides a method, device, and storage medium for obtaining test case priorities. These protection subjects are based on the same concept, and their problem-solving principles are essentially the same or similar. The implementation methods of each protection subject can be referred to mutually, and repeated details will not be elaborated.
[0018] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly described below in conjunction with specific embodiments and corresponding drawings. Obviously, the embodiments described below are only a part of the embodiments of this application, and not all of them. Unless otherwise specified, the following embodiments and their technical features can be combined with each other, and also belong to the technical solutions of this application.
[0019] Figure 1 This is a flowchart illustrating the test case priority acquisition method according to the first embodiment of this application. The test case priority acquisition method may also be referred to as a "method" or "acquisition method," and the executing entity for each step may be a suitable priority acquisition device, a computer performing priority acquisition, or a storage medium, processor, controller, etc., with software testing capabilities.
[0020] like Figure 1 As shown, the method includes at least the following steps S11 to S15.
[0021] S11. In response to the collected text data of the test cases, multiple target text fields are extracted from the text data of the test cases, and each target text field has a different dimension.
[0022] The text data of the test cases contains at least one test case. Since each test case contains at least a title, description, test steps, expected results, preconditions, and the module to which it belongs, the text data of the test cases includes at least six dimensions of information: title, description, test steps, expected results, preconditions, and the module to which it belongs. The specific meaning of each dimension of information can be found in the prior art.
[0023] In practical scenarios, this application embodiment exports structured test case text data from a test management system for controlling software testing. In this test management system, the test case text data is stored in Excel format. Multiple test cases corresponding to the same software product can be stored in one Excel spreadsheet. When exporting test case text data from the test management system, text data for all test cases corresponding to the current software product can be exported at once, improving data collection efficiency. After extracting the text fields corresponding to each dimension from the Excel spreadsheet, basic preprocessing such as cleaning can be performed on each text field, including but not limited to removing special characters, newlines, standardizing case, and filtering null values. Finally, the preprocessed text fields (i.e., valid text fields) are used as the corresponding target text fields.
[0024] In other examples, test cases may also include manually labeled priority tags. Although these priority tags may not be the most reasonable reflection of the priority of the test cases, they can still be used as one of the dimensions to determine the priority. Therefore, this application may also use the priority tag as one of the target text fields. That is, at least two of the following are extracted from the text data of the test cases: title, description, test steps, expected results, preconditions, module to which they belong, and priority tag, as target text fields.
[0025] In another example, before extracting multiple target text fields from the text data of the test case, it can be determined whether the text data of the test case contains text fields corresponding to priority labels. If the text data of the test case contains text fields corresponding to priority labels, then the step of extracting multiple target text fields from the text data of the test case is executed; otherwise, it can be determined that the tester considers the test case to be of low importance and directly marks the priority of the test case as the lowest priority. In this case, subsequent steps S12 to S15 are not executed. Alternatively, it can be determined that the tester forgot or omitted setting a priority label for the test case. In this case, the tester is prompted to add a priority label to the test case, and after adding the label, the step of extracting multiple target text fields from the text data of the test case is executed.
[0026] Taking the aforementioned seven dimensions—title, description, test steps, expected results, preconditions, module, and priority tag—as an example, the seven target text fields can be as follows: The target text field corresponding to the title is "Title: User Login Function Test"; The target text field corresponding to the description is "Description: After verifying that the correct username and password are entered, you can successfully log in and be redirected to the homepage"; The target text field corresponding to the test steps is "Steps: 1. Open the login page; 2. Enter username 'test-user'; 3. Enter password 'Test1234'; 4. Click the login button"; The target text field corresponding to the expected result is "Expected Result: Login successful, page redirects to 'Welcome test-user' homepage"; The target text field corresponding to the precondition is "Precondition: User 'test-user' has registered and the account status is normal"; The target text field corresponding to the module is "Module: User Authentication Module"; The target text field corresponding to the priority label is "Priority_Label: P1".
[0027] S12. Concatenate multiple target text fields in a structured manner to obtain a comprehensive text feature sequence.
[0028] In one example, the field names of each target text field and the field values corresponding to those field names are combined into a sub-text segment to obtain multiple sub-text segments corresponding to the multiple target text fields. Then, the multiple sub-text segments are structurally concatenated according to a preset field order.
[0029] In each sub-text segment, the field name and its corresponding field value can be separated by a preset identifier, such as ":", that is, each sub-text segment is identified in the form of "field name: field value". Taking the aforementioned seven dimensions—title, description, test steps, expected result, preconditions, module, and priority label—as an example, the subtext segment for the title is "Title: User Login Function Test"; for the description, the subtext segment is "Description: After verifying the correct username and password, successful login and redirection to the homepage"; for the test steps, the subtext segment is "Steps: 1. Open the login page; 2. Enter username 'test-user'; 3. Enter password 'Test1234'; 4. Click the login button"; for the expected result, the subtext segment is "ExpectedResult: Login successful, page redirects to 'Welcome test-user' homepage"; for the preconditions, the subtext segment is "Precondition: User 'test-user' has registered and the account status is normal"; for the module, the subtext segment is "Module: User Authentication Module"; and for the priority label, the subtext segment is "Priority_Label: P1". When performing structured concatenation of various sub-text segments, separators such as ";" can be set between different target text fields to preserve the semantic boundary information of the fields. Based on this, the comprehensive text feature sequence obtained after structured concatenation is: "Title: User login function test; Description: After verifying the correct username and password, the user can successfully log in and be redirected to the homepage; Steps: 1. Open the login page; 2. Enter username 'test-user'; 3. Enter password 'Test1234'; 4. Click the login button; Expected" Result: Login successful, page redirects to 'Welcome test-user' homepage"; Precondition: User 'test-user' has registered and account status is normal; Module: User authentication module; Priority_Label: P1. By using the above "field name: field value" method to structurally concatenate multiple target text fields, the semantic information of different target text fields can be clearly distinguished in the comprehensive text feature sequence, thus preserving the structured semantic features of the test case. This allows the neural network model to simultaneously perceive the semantic content expressed by different fields after the comprehensive text feature sequence is input, thereby more accurately reflecting the overall testing intent of the test case.
[0030] S13. Input the comprehensive text feature sequence into a pre-trained neural network model, wherein the neural network model has multiple levels of alternative priorities.
[0031] S14. Output the predicted probability of each alternative priority corresponding to the test case through the neural network model.
[0032] S15. Select the candidate with the highest predicted probability as the priority of the test case.
[0033] Neural network models include, but are not limited to, pre-trained language models based on Transformer encoders, such as the BERT (Bidirectional Encoder Representations from Transformers) model. This neural network model first semantically encodes the input sequence of comprehensive text features to obtain semantic vectors, and then predicts priorities based on these semantic vectors.
[0034] Specifically, this neural network model is a pre-trained deep learning priority classification model, including a pre-trained language model encoding layer and a multi-classification output layer. The pre-trained language model encoding layer encodes the comprehensive text feature sequence to form semantic vectors, and the multi-classification output layer outputs the predicted probabilities of multiple alternative priorities corresponding to the test cases. The training process of this deep learning priority classification model is as follows: First, multiple text feature sequences are encoded using conventional semantic encoding methods in the field to obtain semantic vectors. Each text feature sequence has the same structure as the comprehensive text feature sequence. For example, each sequence contains at least two fields corresponding to the title, description, test steps, expected results, preconditions, module, and priority label of the test case, and the order of each field is also the same. Then, using semantic vectors as the input layer of the BERT model and the predicted probabilities of multiple candidate priorities as the multi-class output layer of the BERT model, a deep learning priority classification model is established, such as... Figure 2 As shown, the deep learning priority classification model has multiple hidden layers. The data input through the input layer (referred to as input data, i.e., the semantic vectors obtained by encoding multiple text feature sequences) x1, x2, x3, ..., x s The input layers pass through a series of hidden layers, each connected to all nodes in the previous layer. For example, the first hidden layer is connected to all nodes in the input layer, and any node in the second hidden layer is connected to all nodes in the first hidden layer. Each node receives input from all nodes in the previous layer, performs a weighted sum of these inputs, and then passes them through an activation function. The resulting data (called output data) is then output through the output layer as y1, y2, y3, ..., y...t This refers to the predicted probability of each candidate priority. Each node in each hidden layer will apply an activation function, including but not limited to any one of the following: the logistic function Sigmoid, the hyperbolic tangent function Tanh, and the linear rectified function ReLU. The activation function is used to increase non-linearity, so that no matter how many hidden layers the model has, the output of any hidden layer is a non-linear combination of the input variables of that hidden layer, and the input variables of the next hidden layer are also a non-linear combination. This means that the deep learning priority classification model is a multi-layer non-linear model. Next, multiple text feature sequences are divided into training and test sets according to a preset ratio. For the training set, the weights and bias parameters of each hidden layer are calculated using a preset loss function to minimize the loss, so as to train the deep learning priority classification model. Finally, the semantic vectors of the test set and the predicted probabilities of multiple candidate priorities are input into the trained neural network model, and the loss of the preset loss function is verified to be minimized. If so, the weights and bias parameters of each hidden layer obtained based on the training set are applied to the deep learning priority classification model, thus completing the training of the deep learning priority classification model. If not, the weights and bias parameters of each hidden layer of the neural network model can be adjusted based on the training set until the loss of the preset loss function is minimized when the semantic vectors of the test set and the predicted probabilities of multiple candidate priorities are input into the trained deep learning priority classification model.
[0035] During the training process of this deep learning priority classification model, the preset loss function includes, but is not limited to, the root mean squared error (RMSE) function. The loss is expressed as the value of the RMSE function, and the preset loss function can be expressed as the following mathematical relationship:
[0036] in, The value of the root mean square error function, i.e., the loss, This refers to the number of text feature sequences, i.e., the number of samples. This refers to the sequence number of the text feature sequence, i.e., the sample number. For the first The predicted values of the weights and bias parameters of each text feature sequence. For the first The true values of each text feature sequence are the sample feature matrices input to the corresponding hidden layer nodes, i.e., the text fields contained in each text feature sequence. The principle and implementation process of obtaining the weights and bias parameters of each hidden layer when the loss is minimized based on the loss function are conventional techniques in this field and will not be elaborated here.
[0037] The loss The loss reflects the difference between the predicted and the actual values. The smaller the value of , the more accurate the prediction of the deep learning priority classification model. Therefore, in the loss... When the minimum value is reached, the weights and bias parameters of each hidden layer are obtained and applied to the nonlinear calculation of each hidden layer, which can make the prediction probability of multiple candidate priorities most accurate.
[0038] For a trained neural network model, taking four candidate priorities P1, P2, P3, and P4 as an example, if the predicted probability distribution output by the neural network model is "0.05 for candidate priority P1, 0.80 for candidate priority P2, 0.14 for candidate priority P3, and 0.01 for candidate priority P1", then the test case is determined to have priority P2, and the determination result is written into the text field corresponding to the priority label of the test case, thus achieving automatic classification of test case priorities. It is understood that after obtaining the priority prediction results of all test cases, they are summarized and output to a spreadsheet file or test management system for testers to refer to during the test execution phase.
[0039] Based on steps S11 to S15 above, this application structurally concatenates the multidimensional text features of test cases to obtain a comprehensive text feature sequence, and inputs the comprehensive text feature sequence into a pre-trained neural network model. Through the inference calculation of the neural network model, the priority prediction result of the test cases is output. By using multidimensional text features, the text field information of the test cases can be fully utilized, comprehensively reflecting the semantic information of the test cases, thus improving semantic understanding capabilities. This makes the priority acquisition method of this application highly generalizable and adaptable to different testing scenarios. Furthermore, by performing the above steps, this application can automatically acquire the priority of test cases using a unified standard, which significantly improves testing efficiency compared to manual annotation methods, and the consistency and stability of the priority determination results are better.
[0040] Figure 3 This is a flowchart illustrating the method for obtaining the priority of test cases according to the second embodiment of this application. Figure 3 As shown, the method includes the following steps S21 to S27.
[0041] S21. In response to the collected text data of the test cases, multiple target text fields are extracted from the text data of the test cases, and each target text field has a different dimension. S22. Concatenate multiple target text fields in a structured manner to obtain a comprehensive text feature sequence; S23. Input the comprehensive text feature sequence into a pre-trained neural network model, wherein the neural network model has multiple levels of alternative priorities preset. S24. Output the predicted probability of each candidate priority corresponding to the test case through the neural network model; S25. Select the candidate with the highest predicted probability as the priority of the test case; S26. In response to detecting that a new test case is input into the neural network model, obtain the semantic similarity between the new test case and the test case; S27. When the semantic similarity meets the first preset condition, determine that the neural network model is suitable for the new test case, and use the neural network model to obtain the priority of the new test case.
[0042] Steps S21 to S25 can be referred to in detail in the preceding steps S11 to S15, and will not be repeated here. That is, in the preceding... Figure 1 Based on the description of the embodiments, after obtaining the priority of a test case, this second embodiment further includes steps S26 and S27 to determine whether the neural network model can be applied to the new test case, thereby determining whether the neural network model can be shared by multiple test cases.
[0043] In one example of step S26, a first semantic vector obtained by semantically encoding the comprehensive text feature sequence corresponding to the test case using a neural network model, and a second semantic vector obtained by semantically encoding the comprehensive text feature sequence corresponding to the new test case, can be obtained to map the new test case and the previous test case to a unified semantic vector space. Then, in the semantic space corresponding to the neural network model, the distance between the first semantic vector and the second semantic vector is calculated as the semantic similarity between the new test case and the previous test case. In the same model (i.e., the neural network model), the closer the distance between semantic vectors in the semantic space, the higher the semantic similarity; conversely, the farther apart they are, the lower the semantic similarity.
[0044] In step S27, the first preset condition can be a preset threshold. When the semantic similarity between the new test case and the previous test case reaches the preset threshold, it means that the semantic similarity between the two meets the first preset condition, and it is determined that the neural network model can be applied to the new test case.
[0045] Therefore, when testing multiple software products, each of which contains a large number of test cases, this can lead to a situation where the number of test cases is enormous. This example uses semantic similarity judgment to enable the sharing of neural network models between similar test cases. This eliminates the need to train neural network models for each test case individually, thus enabling the reuse of neural network models across different software products and greatly improving testing efficiency.
[0046] Figure 4 This is a flowchart illustrating the method for obtaining the priority of test cases according to the third embodiment of this application. Figure 4 As shown, the method includes the following steps: S31. In response to the collected text data of the test cases, multiple target text fields are extracted from the text data of the test cases, and each target text field has a different dimension. S32. Concatenate multiple target text fields in a structured manner to obtain a comprehensive text feature sequence; S33. Input the comprehensive text feature sequence into a pre-trained neural network model, wherein the neural network model has multiple levels of alternative priorities. S34. Output the predicted probability of each alternative priority corresponding to the test case through the neural network model; S35. Select the candidate with the highest predicted probability as the priority of the test case; S36. In response to detecting that the neural network model is switched from the first platform to the second platform, obtain the first test case set of the first platform and the second test case set of the second platform; S37. Calculate the average semantic similarity between the first test case set and the second test case set; S38. Determine whether the average semantic similarity meets the second preset condition; If so, proceed to step S391: determine that the neural network model is suitable for the second platform.
[0047] If not, proceed to step S392 to determine that the neural network model is not applicable to the second platform.
[0048] Steps S31 to S35 can be referred to in detail in steps S11 to S15 above, and will not be repeated here. That is, in the aforementioned... Figure 1 Based on the description of the embodiments, after obtaining the priority of a test case, this third embodiment further includes steps S36 to S38 to determine whether the neural network model can be used across platforms, thereby determining whether the neural network model can be shared by multiple platforms.
[0049] In step S36, the first test case set is a set of all test cases executed on the first platform, and the second test case set is a set of all test cases executed on the second platform.
[0050] In step S37, the text fields of the first test case set and the text fields of the second test case set can be semantically encoded to obtain corresponding semantic vectors. Then, in the semantic space corresponding to the neural network model, the distance between the two semantic vectors is calculated as the average semantic similarity.
[0051] In step S38, the average semantic similarity satisfies a second preset condition, including at least one of the following: 1. The average semantic similarity reaches a first threshold; 2. The average semantic similarity is between the first threshold and a second threshold, wherein the first threshold is greater than the second threshold. Based on this, in step S391, when the average semantic similarity reaches the first threshold, the neural network model is directly used to prioritize test cases input from the second platform; and when the average semantic similarity is between the first threshold and the second threshold, the neural network model is optimized based on the labeled data of the second platform, and the optimized neural network model is used to prioritize test cases input from the second platform. The labeled data can be necessary information about the platform. Through the labeled data, the main differences between different platforms can be determined. Therefore, only minor adjustments to the neural network model of the first platform are needed to make it suitable for use on the second platform.
[0052] Based on the above, this example can map test case sets from different platforms (or projects) to a unified semantic space, and determine whether the neural network model can be reused based on the average semantic similarity between test case sets meeting the corresponding second preset condition. This avoids the repeated construction of priority determination rules, enabling this application to support model reuse between different platforms (or projects), improve model reuse efficiency, and reduce labor and maintenance costs.
[0053] This application embodiment also provides a storage medium storing a priority acquisition program for test cases. The priority acquisition program is essentially a computer program, and when executed by a processor, it implements the steps of the priority acquisition method of any of the foregoing examples.
[0054] The storage medium includes, but is not limited to, any one of read-only memory (ROM), random access memory (RAM), magnetic disk, and optical disk.
[0055] Since the program stored in the storage medium can execute the steps in the priority acquisition method of any embodiment provided in this application, the beneficial effects that the priority acquisition method of any of the foregoing embodiments can achieve can be realized. For details, please refer to the foregoing embodiments, which will not be repeated here.
[0056] This application also provides a priority acquisition device or chip, including a memory and a processor. The memory stores a priority acquisition program, which, when executed by the processor, implements the steps of the priority acquisition method of any of the foregoing embodiments. And / or, the priority acquisition device or chip is provided with a storage medium as shown in the above example, and the processor loads the storage medium to execute the steps of the priority acquisition method, thereby achieving the beneficial effects that the priority acquisition method of the corresponding embodiment can achieve.
[0057] Figure 5 This is a schematic diagram of the structure of a priority acquisition device provided in an embodiment of this application. For example... Figure 5 As shown, the priority acquisition device 40, also referred to as device 40, includes: Extraction module 41 is used to extract multiple target text fields from the text data of the test cases in response to the collected text data of the test cases. Each target text field has a different dimension. The splicing module 42 is used to structurally splice the multiple target text fields to obtain a comprehensive text feature sequence; Input module 43 is used to input the comprehensive text feature sequence into a pre-trained neural network model, wherein the neural network model has multiple levels of alternative priorities. Processing module 44 is used to output the predicted probability of each alternative priority corresponding to the test case through the neural network model, and to select the alternative priority with the highest predicted probability as the priority of the test case.
[0058] It should be understood that the various modules of the device 40 described above can be represented as physical devices or virtual modules (i.e., commonly referred to as modules) in a real-world scenario. A single physical device can implement a module, or two or more physical devices can work together to implement it. Similarly, the function performed by a single physical device can be implemented by a single physical device, or two or more physical devices can work together to implement it. Furthermore, the functions corresponding to each module can be implemented by the corresponding steps of the priority acquisition method in any of the foregoing embodiments.
[0059] The above are only some embodiments of this application and do not limit the patent scope of this application. For those skilled in the art, any equivalent structural transformations made using the content of this specification and drawings are similarly included within the patent protection scope of this application.
[0060] The use of step designations such as S11 and S12 in this document is intended to more clearly and concisely describe the corresponding content and does not constitute a substantial restriction on the order. In specific implementation, those skilled in the art may execute S12 first and then S11, etc., but these should all be within the protection scope of this application.
[0061] Although this document uses terms such as "first," "second," etc., to describe various types of information, this information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. Furthermore, the singular forms "a," "an," and "the" are intended to also include the plural forms. The terms "or" and "and / or" are interpreted as inclusive, or meaning either one or any combination thereof. Exceptions to this definition only arise when combinations of elements, functions, steps, or operations are inherently mutually exclusive in some way.
Claims
1. A method for obtaining the priority of test cases, characterized in that, include: In response to the collected text data of the test cases, multiple target text fields are extracted from the text data of the test cases, and each target text field has a different dimension; The multiple target text fields are structurally concatenated to obtain a comprehensive text feature sequence; The comprehensive text feature sequence is input into a pre-trained neural network model, which has multiple levels of candidate priorities. The neural network model outputs the predicted probability of each candidate priority corresponding to the test case; The candidate with the highest predicted probability is selected as the priority of the test case.
2. The method according to claim 1, characterized in that, The extraction of multiple target text fields from the text data of the test cases includes: Extract at least two of the following from the text data of the test cases: title, description, test steps, expected results, preconditions, module, and priority label, and use them as target text fields.
3. The method according to claim 2, characterized in that, The method further includes: Determine whether the text data of the test case contains a text field corresponding to the priority label; If so, then perform the step of extracting multiple target text fields from the text data of the test case; If not, the priority of the test case will be marked as the lowest priority, or a prompt will be made to add a priority label to the test case, and after adding the label, the step of extracting multiple target text fields from the text data of the test case will be executed.
4. The method according to claim 1, characterized in that, The step of structurally concatenating the multiple target text fields includes: Each target text field's field name and the corresponding field value are combined into a sub-text segment to obtain multiple sub-text segments corresponding to the multiple target text fields; The multiple sub-text segments are concatenated according to a preset field order.
5. The method according to any one of claims 1 to 4, characterized in that, The method further includes: In response to detecting that a new test case is input into the neural network model, the semantic similarity between the new test case and the existing test case is obtained; When the semantic similarity meets the first preset condition, it is determined that the neural network model is suitable for the new test case, and the priority of the new test case is obtained by using the neural network model.
6. The method according to claim 5, characterized in that, The step of obtaining the semantic similarity between the new test case and the existing test case includes: Obtain a first semantic vector obtained by semantically encoding the comprehensive text feature sequence corresponding to the test case through the neural network model, and a second semantic vector obtained by semantically encoding the comprehensive text feature sequence corresponding to the new test case; In the semantic space corresponding to the neural network model, the distance between the first semantic vector and the second semantic vector is calculated as the semantic similarity between the new test case and the test case.
7. The method according to any one of claims 1 to 4, characterized in that, The method further includes: In response to detecting that the neural network model has been switched from the first platform to the second platform, a first test case set for the first platform and a second test case set for the second platform are obtained; Calculate the average semantic similarity between the first test case set and the second test case set; Determine whether the average semantic similarity meets the second preset condition; Furthermore, when the average semantic similarity meets the second preset condition, it is determined that the neural network model is suitable for the second platform.
8. The method according to claim 7, characterized in that, The average semantic similarity satisfies the second preset condition, including at least one of the following: The average semantic similarity reaches the first threshold; The average semantic similarity is between a first threshold and a second threshold, wherein the first threshold is greater than the second threshold; Determining that the neural network model is suitable for the second platform includes: When the average semantic similarity reaches the first threshold, the neural network model is directly used to prioritize test cases based on the input from the second platform. When the average semantic similarity is between the first threshold and the second threshold, the neural network model is optimized based on the labeled data of the second platform, and the optimized neural network model is used to prioritize the test cases input based on the second platform.
9. A test case priority acquisition device, characterized in that, The device includes a processor and a memory, the memory storing a priority acquisition program, which, when executed by the processor, implements the steps of the method according to any one of claims 1 to 8.
10. A storage medium, characterized in that, The device contains a computer program that, when executed by a processor, implements the steps of the method as described in any one of claims 1 to 8.