Test script conversion method and device, electronic equipment, medium and vehicle
Through the preset language understanding model, the test cases are identified intent and entity, and the target test scripts are automatically matched, which solves the problem of low efficiency of manual conversion test scripts, and realizes efficient and reliable test script conversion, improving the stability of automated tests.
Patent Information
- Application Number
- CN202410017073.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-04
- Publication Date
- 2025-04-08
AI Technical Summary
In the prior art, testers need to manually convert test cases in natural language form into test scripts in machine language form, resulting in low conversion efficiency and difficult quality, which affects the efficiency and stability of automated testing.
By obtaining the vehicle's test cases and inputting them into the preset language understanding model, the intention and entity of the test case are automatically identified, and then matching the corresponding target test scripts from the database, the automatic conversion from the test case to the test script is realized.
No tester intervention is required to avoid interference from human factors, which significantly improves the efficiency and quality of test script conversion, which is conducive to improving the efficiency and stability of automated testing.
Smart Images

Figure CN119782134A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of automated testing technology, and in particular to a test script conversion method, device, electronic device, medium and vehicle. Background Art
[0002] At present, automated testing of the human-computer interaction function in the in-vehicle entertainment domain is achieved through a specific test framework. When applying the test framework for functional testing, a test script is required. Usually, testers manually convert test cases in natural language into test scripts in machine language. However, the manual conversion method requires high learning and comprehension abilities of testers, and manual conversion is time-consuming. The conversion efficiency and results vary from person to person, which affects the efficiency and stability of automated testing. Summary of the invention
[0003] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a test script conversion method, device, electronic device, medium and vehicle, which can automatically convert test scripts and improve conversion efficiency and quality.
[0004] In order to achieve the above objectives, the technical solutions provided by the embodiments of the present disclosure are as follows:
[0005] In a first aspect, a test script conversion method is provided, comprising:
[0006] Get the test cases for the vehicle;
[0007] Input the test case into a preset language understanding model to obtain a data structure corresponding to the test case output by the preset language understanding model, wherein the data structure includes the intent and entity corresponding to the test case;
[0008] According to the data structure, the corresponding target test script is matched from the database.
[0009] As an optional implementation of the embodiment of the present disclosure, after obtaining the test case of the vehicle, the test case is input into the preset language understanding model, and before obtaining the data structure corresponding to the test case output by the preset language understanding model, it also includes: calculating the similarity between multiple test cases; performing deduplication processing on the multiple test cases according to the similarity; and disassembling the test step text from the deduplication-processed test case;
[0010] Input the test case into the preset language understanding model to obtain a data structure corresponding to the test case output by the preset language understanding model, including: input the test step text into the preset language understanding model to obtain a data structure corresponding to the test step text output by the preset language understanding model, the data structure including the intent and entity corresponding to the test step text.
[0011] As an optional implementation of the embodiment of the present disclosure, after obtaining the test case of the vehicle, the test case is input into a preset language understanding model, and before obtaining the data structure corresponding to the test case output by the preset language understanding model, it also includes: obtaining data format information of the test case; converting the data format of the test case into a text format according to a data conversion strategy corresponding to the data format information, and the content of the text format includes the test step text.
[0012] As an optional implementation of the embodiment of the present disclosure, according to the data structure, the corresponding target test script is matched from the database, including: inputting the data structure into a preset machine learning model to obtain the target test script corresponding to the data structure output by the preset machine learning model; wherein the preset machine learning model is trained based on the sample data structure and the corresponding test script example.
[0013] As an optional implementation of the embodiment of the present disclosure, the training process of the preset machine learning model includes: obtaining a sample data structure and a test script example corresponding to the sample data structure from a database; inputting the sample data structure into the initial machine learning model to obtain a prediction test script output by the initial machine learning model; calculating a first loss value between the prediction test script and the test script example corresponding to the sample data structure; when the first loss value is greater than a first loss threshold, adjusting the initial machine learning model until the first loss value is less than or equal to the first loss threshold, thereby obtaining a converged preset machine learning model.
[0014] As an optional implementation of the embodiment of the present disclosure, after matching the corresponding target test script from the database according to the data structure, the method also includes: extracting test parameters from the entity; generating test code according to the test parameters and the target test script, so as to input the test code into the test framework for automated testing.
[0015] As an optional implementation of the embodiment of the present disclosure, the training process of the preset language understanding model includes: obtaining sample use cases, and intent labels and entity labels corresponding to the sample use cases; inputting the sample use cases into the initial language understanding model to obtain a prediction structure output by the initial language understanding model, wherein the prediction structure includes predicted intent and predicted entity; calculating a second loss value between the predicted intent and the intent label, and a third loss value between the predicted entity and the entity label; when the second loss value and / or the third loss value is greater than a loss threshold, adjusting the model parameters of the initial language understanding model until the second loss value and the third loss value are both less than or equal to the loss threshold, thereby obtaining a converged preset language understanding model.
[0016] In a second aspect, the present disclosure provides a test script conversion device, the device comprising:
[0017] An acquisition module is used to acquire the test cases of the vehicle;
[0018] A language understanding module is used to input the test case into a preset language understanding model to obtain a data structure corresponding to the test case output by the preset language understanding model, wherein the data structure includes the intent and entity corresponding to the test case;
[0019] The matching module is used to match the corresponding target test script from the database according to the data structure.
[0020] As an optional implementation of the embodiment of the present disclosure, the acquisition module, after acquiring the test case of the vehicle, is further used to: calculate the similarity between multiple test cases; perform deduplication processing on the multiple test cases according to the similarity; and disassemble the test step text from the deduplication-processed test case;
[0021] The language understanding module is specifically used to: input the test step text into a preset language understanding model, obtain a data structure corresponding to the test step text output by the preset language understanding model, and the data structure includes the intent and entity corresponding to the test step text.
[0022] As an optional implementation of the embodiment of the present disclosure, the acquisition module, after acquiring the test case of the vehicle, is also used to: obtain data format information of the test case; convert the data format of the test case into a text format according to a data conversion strategy corresponding to the data format information, and the content of the text format includes the test step text.
[0023] As an optional implementation of the embodiment of the present disclosure, the matching module is specifically used to: input the data structure into a preset machine learning model to obtain a target test script corresponding to the data structure output by the preset machine learning model; wherein the preset machine learning model is trained based on the sample data structure and the corresponding test script examples.
[0024] As an optional implementation of the embodiment of the present disclosure, the test script conversion device also includes a training module, which is used to: obtain a sample data structure and a test script example corresponding to the sample data structure from a database; input the sample data structure into an initial machine learning model to obtain a predicted test script output by the initial machine learning model; calculate a first loss value between the predicted test script and the test script example corresponding to the sample data structure; when the first loss value is greater than a first loss threshold, adjust the initial machine learning model until the first loss value is less than or equal to the first loss threshold, so as to obtain a converged preset machine learning model.
[0025] As an optional implementation of the embodiment of the present disclosure, the matching module is also used to: extract test parameters from the entity; generate test code according to the test parameters and the target test script, so as to input the test code into the test framework for automated testing.
[0026] As an optional implementation of the embodiment of the present disclosure, the test script conversion device also includes a training module, which is used to: obtain sample use cases, and intent labels and entity labels corresponding to the sample use cases; input the sample use cases into the initial language understanding model to obtain a prediction structure output by the preset language understanding model, wherein the prediction structure includes a predicted intent and a predicted entity; calculate a second loss value between the predicted intent and the intent label, and a third loss value between the predicted entity and the entity label; when the second loss value and / or the third loss value is greater than a loss threshold, adjust the model parameters of the initial language understanding model until the second loss value and the third loss value are both less than or equal to the loss threshold, thereby obtaining a converged preset language understanding model.
[0027] In a third aspect, the present disclosure provides an electronic device comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the test script conversion method as described in the first aspect or any one of its optional embodiments is implemented.
[0028] In a fourth aspect, the present disclosure provides a computer-readable storage medium, comprising: a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the test script conversion method as described in the first aspect or any optional embodiment thereof is implemented.
[0029] In a fifth aspect, the present disclosure provides a vehicle, comprising the test script conversion device as described in the second aspect or any optional embodiment thereof, or the electronic device as described in the third aspect.
[0030] In a sixth aspect, the present disclosure provides a computer program product, including: the computer program product includes a computer program, and when the computer program runs on a computer, the computer implements the test script conversion method as described in the first aspect or any optional embodiment thereof.
[0031] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has the following advantages:
[0032] The embodiments of the present disclosure provide a test script conversion method, device, electronic device and storage medium, wherein the method comprises: first obtaining a test case of a vehicle, and then inputting the test case into a preset language understanding model, so that the preset language understanding model automatically recognizes the test case in natural language form, and obtains a data structure output by the preset language understanding model, the data structure includes the intent and entity corresponding to the test case, and then matches the corresponding target test script from the database according to the data structure. In this way, the present disclosure recognizes the intent and entity of the test case in natural language form through the preset language understanding model, so as to match the corresponding target test script according to the recognized intent and entity, and realizes automatic conversion from test case to test script, without the intervention of test personnel, avoiding interference from human factors, improving the efficiency and quality of test script conversion, and is conducive to improving the efficiency and stability of automated testing. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0034] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0035] Figure 1A A flowchart diagram 1 of a test script conversion method provided in an embodiment of the present disclosure;
[0036] Figure 1B A flow chart of a test script conversion method provided in an embodiment of the present disclosure Figure 2 ;
[0037] Figure 2 A schematic diagram of the structure of a test script conversion device according to an embodiment of the present disclosure;
[0038] Figure 3 The present invention is a schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0039] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0040] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure or the prior art, the technical terms required to be used in the embodiments or the prior art description are briefly introduced below:
[0042] Testing is a relatively important link in the process of product development and operation and maintenance. It is a process of using manual operation or automatic software operation to check whether it meets the specified requirements or to clarify the difference between the expected results and the actual results. Testers need to check the test cases of each product, and then convert the test cases in natural language into test scripts in machine language to complete the execution of the test scripts, and then run the test scripts to find out whether the software product can be executed as expected. However, for some products of similar types, the same class methods will be used in the test scripts. In this way, when testers write two test scripts, they will inevitably repeat a lot of code, wasting more time and energy. In addition, due to individual differences, the quality of the generated test scripts is also uneven. Therefore, the method of manually converting test scripts is inefficient and the quality is difficult to guarantee, which in turn affects the efficiency and stability of automated testing.
[0043] In order to solve some or all of the above technical problems, the embodiments of the present disclosure provide a test script conversion method, device, electronic device and storage medium, wherein the method first obtains a test case of a vehicle, and then inputs the test case into a preset language understanding model, so that the preset language understanding model automatically recognizes the test case in natural language form, and obtains a data structure output by the preset language understanding model, the data structure includes the intent and entity corresponding to the test case, and then matches the corresponding target test script from the database according to the data structure. In this way, the present disclosure recognizes the intent and entity of the test case in natural language form through a preset language understanding model, so as to match the corresponding target test script according to the recognized intent and entity, and realizes automatic conversion from test case to test script, without the intervention of test personnel, avoiding interference from human factors, improving the efficiency and quality of test script conversion, and helping to improve the efficiency and stability of automated testing.
[0044] A test script conversion method provided in an embodiment of the present disclosure can be implemented by an electronic device, and the electronic device includes but is not limited to a vehicle-mounted device, a server, a personal computer, a laptop computer, a tablet computer, a smart phone, etc. The electronic device includes a user device and a network device. Among them, the user device includes but is not limited to a computer, a smart phone, a tablet computer, etc.; the network device includes but is not limited to a single network server, a server group composed of multiple network servers, or a cloud composed of a large number of computers or network servers in cloud computing, wherein cloud computing is a kind of distributed computing, a super virtual computer composed of a group of loosely coupled computer sets. Among them, the electronic device can be operated alone to implement the present disclosure, and can also be connected to the network and implement the present disclosure through interactive operations with other electronic devices in the network. Among them, the network where the electronic device is located includes but is not limited to the Internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (VPN) network, etc.
[0045] It should be noted that the protection scope of the test script conversion method described in the embodiment of the present disclosure is not limited to the execution order of the steps listed in this embodiment. All solutions implemented by adding, reducing or replacing steps in the prior art based on the principles of the present disclosure are included in the protection scope of the present disclosure.
[0046] like Figure 1A As shown, Figure 1A The first flow chart of a test script conversion method provided by the embodiment of the present disclosure is a flow chart of a test script conversion method, which can be executed by a test script conversion device, wherein the device can be implemented by software and / or hardware, and can generally be integrated in an electronic device. Figure 1A As shown, the method mainly includes the following steps S101 to S103:
[0047] S101. Obtain a vehicle test case.
[0048] The test case is in natural language format, and the data format includes but is not limited to: table (such as Excel), mind map, plain text, etc. The number of test cases can be multiple. The test case includes test step text and verification point text.
[0049] Exemplarily, the test step text is: [Wake up the voice and say: "Navigate to a certain attraction"]; the verification point text is: [The central control initiates navigation to a certain attraction].
[0050] In some embodiments, after obtaining the test case of the vehicle, the data format information of the test case is first obtained, and then the data format of the test case is converted into a text format according to the data conversion strategy corresponding to the data format information, thereby standardizing the data format of the test case, avoiding inconsistent recognition results due to data format differences, and improving the effectiveness of the test case.
[0051] Specifically, after obtaining the test case of the vehicle, the data format information of the test case is first determined to determine whether the data format information indicates that the test case is plain text. If so, no additional processing is performed; if not, it indicates that the test case is not plain text. Then, based on the data format information of the test case, a data conversion strategy corresponding to the data format information is determined. The data conversion strategy indicates that the test case in non-text format is converted into text format. The test case is converted into text format according to the data conversion strategy, thereby converting other non-text format test cases into text format, thereby achieving the unification of the test case data format. The test case with a unified data format is easy to be recognized and analyzed by the preset language understanding model in step S102.
[0052] In some embodiments, after obtaining the test cases, the test cases can also be processed as follows: first, the similarity between the test cases is calculated, and then the test cases are deduplicated based on the similarity, and then the test step text is disassembled from the deduplicated test cases, thereby deduplicating and disassembling the test cases, and streamlining the amount of data to quickly locate the test step text, which is effective information, to facilitate subsequent identification based on the test step text.
[0053] Specifically, after obtaining the test cases, similarity calculation is performed on the test cases. A similarity threshold can be pre-set. When the similarity between any two test cases is greater than or equal to the similarity threshold, one of the test cases is removed, thereby removing duplicate test cases. Furthermore, for the retained test cases, they are disassembled into test step texts and verification point texts to focus on the test step texts used for subsequent entity recognition and intent recognition.
[0054] The above-mentioned embodiment improves data processing efficiency by deduplicating test cases and removing duplicate data; and by disassembling test cases and focusing on the test step texts corresponding to the test cases, so as to facilitate the subsequent preset language understanding model to perform intent recognition and entity extraction.
[0055] S102: Input the test case into a preset language understanding model to obtain a data structure corresponding to the test case output by the preset language understanding model.
[0056] The data structure includes the intent and entity corresponding to the test case.
[0057] Intents indicate the purpose of the test case, for example, navigation intent, the intention to enter a certain interface. Entities are used to enrich intents and are named entities in test cases. They can be place names, user interfaces, such as scenic spots, settings pages, etc. The preset language understanding model is a converged model that is pre-trained based on sample cases, as well as the intent labels and entity labels corresponding to the sample cases.
[0058] In some embodiments, the training process of the preset language understanding model includes: first obtaining sample use cases, as well as intent labels and entity labels corresponding to the sample use cases, and then inputting the sample use cases into the initial language understanding model to obtain a prediction structure output by the preset language understanding model, the prediction structure including predicted intent and predicted entity, and then calculating a second loss value between the predicted intent and the intent label, and a third loss value between the predicted entity and the entity label. Furthermore, when the second loss value and / or the third loss value is greater than a loss threshold, adjusting the model parameters of the initial language understanding model until the second loss value and the third loss value are both less than or equal to the loss threshold, thereby obtaining a converged preset language understanding model.
[0059] The model parameters of the initial language understanding model include, but are not limited to, word vectors, weight parameters, and transfer parameters (pipeline parameters).
[0060] Optionally, a large number of vehicle test cases are crawled from the test database as sample cases for training the language understanding model. The crawled sample cases can be preprocessed, including but not limited to: labeling, deduplication, disassembly, etc. After labeling the sample cases, the intent labels and test labels corresponding to the sample cases can be determined. For example, the sample case is a wake-up voice saying "navigate to a certain scenic spot", the corresponding intent label is "initiate navigation", and the entity label is "start:31, end:36, value:north, entity:location" to indicate the location of a certain scenic spot.
[0061] Furthermore, the sample use case is input into the initial language understanding model. The initial language understanding model is a model based on the RasaNLU framework, wherein the Rasa NLU framework is used to understand the natural language input data and convert it into structured data, and perform natural language understanding behavior, which includes identifying intent information and entity information.
[0062] Obtain the prediction structure corresponding to the sample use case output by the initial language understanding model, which includes the predicted intent and the predicted entity. The prediction structure can be in josn format. Then, based on the preset loss function, calculate the second loss value between the predicted intent (intent prediction value) and the intent label (intent actual value), and the third loss value between the predicted entity (entity prediction value) and the entity label (entity actual value). The preset loss function is a pre-set loss function for determining whether the preset language understanding model converges, which can be a cross entropy loss function, etc., and the present disclosure does not limit this.
[0063] After calculating the second loss value and the third loss value, the second loss value and the third loss value are compared with the loss threshold. The loss threshold is a pre-set threshold indicating the convergence of the language understanding model. A value greater than the loss threshold indicates that the model has not converged, and a value less than or equal to the loss threshold indicates that the model has converged. If the second loss value and / or the third loss value is greater than the loss threshold, the model parameters of the initial language understanding model are adjusted until the second loss value and the third loss value are both less than or equal to the loss threshold, and the model parameters are retained to obtain a converged preset language understanding model.
[0064] The converged preset language understanding model obtained through training in the above embodiment is applied to the processing of test cases, so as to accurately identify the data structure including intent and entity from the test cases.
[0065] Exemplarily, the data structure may be in josn format, as shown below. After the preset language understanding model performs intent recognition and entity extraction on the test case "wake up voice, say: navigate to a certain scenic spot", the resulting data structure includes the intent "initiate navigation" and the entity "start:31, end:36, value:north, entity:location".
[0066]
[0067] S103. Match the corresponding target test script from the database according to the data structure.
[0068] The database stores test script fragments or test scripts. The target test script may be an XML model and / or a Python model, which is not specifically limited in the present disclosure.
[0069] In some embodiments, after identifying the intent of a test case in natural language through a preset language understanding model and extracting entities, a data structure is obtained, and then the corresponding target test script is matched from the database based on the data structure.
[0070] In some embodiments, in the process of matching the corresponding target test script from the database according to the data structure, a preset machine learning (ML) model can be used. Optionally, the data structure is first input into the preset machine learning model to obtain the target test script corresponding to the data structure output by the machine learning model, wherein the preset machine learning model is a convergent model obtained by training based on the sample data structure and the corresponding test script examples in the database. The sample data structure includes a sample intent and a sample entity.
[0071] In some embodiments, the training process of the preset machine learning model includes: first obtaining a sample data structure from a database, using a test script example corresponding to the sample data structure, and then using the sample data structure as the input of the initial machine learning model to obtain a predictive test script output by the initial machine model. Furthermore, a first loss value is calculated based on the predictive test script (predicted value) and the test script example (actual value), and a preset loss function is applied during the calculation process. The first loss value is compared with the loss threshold. When the first loss value is greater than the loss threshold, it indicates that the model has not converged, then the initial machine learning model is adjusted and retrained until the loss value between the predictive test script output by the model and the test script example is less than or equal to the loss threshold, indicating that the model converges. The model parameters at this time are retained to obtain a preset machine learning model, and a target test script can be generated based on a data structure including intents and entities.
[0072] The above embodiment inputs the data structure into a preset machine learning model to generate a target test script corresponding to the data structure by the preset machine learning model. The preset machine learning model uses a database containing test script samples as a training set. The output target test script can understand the intention and realize automatic conversion of the target test script. No tester intervention is required during the conversion process, which complies with the automated testing framework, thereby facilitating improving the accuracy and stability of automated testing.
[0073] In some embodiments, after matching the corresponding target test script from the database according to the data structure, test parameters can also be extracted from the entity, and then test code is generated according to the test parameters and the target test script, so that the test code is input into the test framework for automated testing. It can be understood that the required parameters in the target test text are extracted from the entity, so as to obtain the test code that can be executed by the test framework for automated testing.
[0074] In summary, the embodiments of the present disclosure provide a test script conversion method, which first obtains a test case, and then inputs the test case into a preset language understanding model, so that the preset language understanding model automatically recognizes the test case in natural language form, and obtains a data structure output by the preset language understanding model, the data structure including the intent and entity corresponding to the test case, and then matches the corresponding target test script from the database according to the data structure. In this way, the present disclosure recognizes the intent and entity of the test case in natural language form through a preset language understanding model, and then matches the corresponding target test script according to the recognized intent and entity, realizing automatic conversion from test case to test script, without the intervention of test personnel, avoiding interference from human factors, improving the efficiency and quality of test script conversion, and helping to improve the efficiency and stability of automated testing.
[0075] like Figure 1B As shown, Figure 1B A flow chart of a test script conversion method provided in an embodiment of the present disclosure Figure 2 The test script conversion method includes the following steps S1 to S3:
[0076] S1. Obtain vehicle test cases.
[0077] Among them, the vehicle test cases are in natural language form.
[0078] S2. Input the test case into the preset language understanding model to obtain a data structure corresponding to the test case output by the preset language understanding model.
[0079] The preset language understanding model is an NLU model, that is, a model based on the Rasa NLU framework. It is pre-trained to convergence based on sample use cases and the intent labels and entity labels corresponding to the sample use cases.
[0080] The intent recognition and entity recognition of the test cases are performed through the preset language understanding model to obtain a data structure including intent and entity.
[0081] S3. Input the data structure into the preset machine learning model to obtain the target test script corresponding to the data structure output by the preset machine learning model.
[0082] The specific implementation of the above steps S1 to S3 may refer to the specific implementation of the above steps S101 to S103, and the present disclosure will not elaborate on them here.
[0083] The above steps S1 to S3 first obtain the test case of the vehicle, and then input the test case into the preset language understanding model, so that the preset language understanding model can automatically perform view entity recognition and intent recognition on the test case in natural language form, and obtain the data structure output by the preset language understanding model, which includes the intent and entity corresponding to the test case, and then use the data structure as the input of the preset machine learning model to obtain the target test script output by the preset machine learning model. In this way, the present disclosure recognizes the intent and entity of the test case in natural language form through the preset language understanding model, so as to obtain the target test script corresponding to the intent and entity through the preset machine learning model, and realizes the automatic conversion from test case to test script, without the intervention of test personnel, avoiding the interference of human factors, improving the efficiency and quality of test script conversion, and is conducive to improving the efficiency and stability of automated testing.
[0084] like Figure 2 As shown, Figure 2 A schematic diagram of a test script conversion device provided in an embodiment of the present disclosure, the test script conversion device comprising:
[0085] An acquisition module 201 is used to acquire a test case of a vehicle;
[0086] A language understanding module 202 is used to input the test case into a preset language understanding model to obtain a data structure corresponding to the test case output by the preset language understanding model, wherein the data structure includes the intent and entity corresponding to the test case;
[0087] The matching module 203 is used to match the corresponding target test script from the database according to the data structure.
[0088] As an optional implementation of the embodiment of the present disclosure, after acquiring the test case of the vehicle, the acquisition module 201 is further used to: calculate the similarity between multiple test cases; perform deduplication processing on the multiple test cases according to the similarity; and disassemble the test step text from the deduplication-processed test case;
[0089] The language understanding module 202 is specifically used to: input the test step text into a preset language understanding model, obtain a data structure corresponding to the test step text output by the preset language understanding model, and the data structure includes the intent and entity corresponding to the test step text.
[0090] As an optional implementation of the embodiment of the present disclosure, the acquisition module 201, after acquiring the test case of the vehicle, is also used to: obtain data format information of the test case; convert the data format of the test case into a text format according to a data conversion strategy corresponding to the data format information, and the content of the text format includes the test step text.
[0091] As an optional implementation of the embodiment of the present disclosure, the matching module 203 is specifically used to: input the data structure into a preset machine learning model to obtain a target test script corresponding to the data structure output by the preset machine learning model; wherein the preset machine learning model is trained based on the sample data structure and the corresponding test script examples.
[0092] As an optional implementation of the embodiment of the present disclosure, the test script conversion device also includes a training module, which is used to: obtain a sample data structure and a test script example corresponding to the sample data structure from a database; input the sample data structure into an initial machine learning model to obtain a predicted test script output by the initial machine learning model; calculate a first loss value between the predicted test script and the test script example corresponding to the sample data structure; when the first loss value is greater than a first loss threshold, adjust the initial machine learning model until the first loss value is less than or equal to the first loss threshold, so as to obtain a converged preset machine learning model.
[0093] As an optional implementation of the embodiment of the present disclosure, the matching module 203 is further used to: extract test parameters from the entity; generate test code according to the test parameters and the target test script, so as to input the test code into the test framework for automated testing.
[0094] As an optional implementation of the embodiment of the present disclosure, the test script conversion device also includes a training module, which is used to: obtain sample use cases, and intent labels and entity labels corresponding to the sample use cases; input the sample use cases into the initial language understanding model to obtain a prediction structure output by the preset language understanding model, wherein the prediction structure includes a predicted intent and a predicted entity; calculate a second loss value between the predicted intent and the intent label, and a third loss value between the predicted entity and the entity label; when the second loss value and / or the third loss value is greater than a loss threshold, adjust the model parameters of the initial language understanding model until the second loss value and the third loss value are both less than or equal to the loss threshold, thereby obtaining a converged preset language understanding model.
[0095] like Figure 3 As shown, the embodiment of the present disclosure provides an electronic device, which includes: a processor 301, a memory 302, and a computer program stored in the memory 302 and executable on the processor 301, and the computer program implements each process of the test script conversion method in the above method embodiment when executed by the processor 301. And the same technical effect can be achieved, so it will not be repeated here to avoid repetition.
[0096] An embodiment of the present disclosure provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the various processes of the test script conversion method in the above method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0097] The computer readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0098] An embodiment of the present disclosure provides a vehicle, which includes a test script conversion device as described above, or an electronic device, so as to implement each process of the test script conversion method in the above method embodiment and achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0099] An embodiment of the present disclosure provides a computer program product, which stores a computer program. When the computer program is executed by a processor, the various processes of the test script conversion method in the above method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0100] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program code.
[0101] In several embodiments provided by the present disclosure, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0102] In the present disclosure, the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0103] In the present disclosure, memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0104] In the present disclosure, computer-readable media include permanent and non-permanent, removable and non-removable storage media. Storage media can be implemented by any method or technology to store information, and the information can be computer-readable instructions, data structures, modules of programs or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. According to the definition in this article, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0105] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0106] The above are only specific embodiments of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to these embodiments herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A test script conversion method, characterized in that: include: Get the test cases for the vehicle; Input the test case into a preset language understanding model to obtain a data structure corresponding to the test case output by the preset language understanding model, wherein the data structure includes an intent and an entity corresponding to the test case; According to the data structure, a corresponding target test script is matched from a database.
2. The method according to claim 1, characterized in that After acquiring the vehicle test case, and before inputting the test case into a preset language understanding model and obtaining a data structure corresponding to the test case output by the preset language understanding model, the method further includes: Calculating the similarity between the plurality of test cases; Deduplication processing is performed on the plurality of test cases according to the similarity; Extract the test step text from the test case after deduplication processing; The step of inputting the test case into a preset language understanding model to obtain a data structure corresponding to the test case output by the preset language understanding model comprises: The test step text is input into the preset language understanding model to obtain a data structure corresponding to the test step text output by the preset language understanding model, wherein the data structure includes the intent and entity corresponding to the test step text.
3. The method according to claim 1, characterized in that: After acquiring the vehicle test case, and before inputting the test case into a preset language understanding model and obtaining a data structure corresponding to the test case output by the preset language understanding model, the method further includes: Obtaining data format information of the test case; According to the data conversion strategy corresponding to the data format information, the data format of the test case is converted into a text format, and the content of the text format includes a test step text.
4. The method according to claim 1, characterized in that: The step of matching a corresponding target test script from a database according to the data structure includes: Input the data structure into a preset machine learning model to obtain a target test script corresponding to the data structure output by the preset machine learning model; Among them, the preset machine learning model is obtained by training based on the sample data structure and the corresponding test script examples.
5. The method according to claim 4, characterized in that The training process of the preset machine learning model includes: Acquire a sample data structure and a test script example corresponding to the sample data structure from the database; Inputting the sample data structure into an initial machine learning model to obtain a prediction test script output by the initial machine learning model; Calculating a first loss value between the predicted test script and the test script sample corresponding to the sample data structure; When the first loss value is greater than the first loss threshold, the initial machine learning model is adjusted until the first loss value is less than or equal to the first loss threshold, so as to obtain the converged preset machine learning model.
6. The method according to claim 1, characterized in that: After matching the corresponding target test script from the database according to the data structure, the method further includes: extracting test parameters from said entity; A test code is generated according to the test parameters and the target test script, so as to input the test code into a test framework for automated testing.
7. The method according to claim 1, characterized in that The training process of the preset language understanding model includes: Obtaining sample use cases, as well as intent labels and entity labels corresponding to the sample use cases; Inputting the sample use case into an initial language understanding model to obtain a prediction structure output by the initial language understanding model, wherein the prediction structure includes a prediction intent and a prediction entity; Calculating a second loss value between the predicted intent and the intent label, and a third loss value between the predicted entity and the entity label; When the second loss value and / or the third loss value is greater than the loss threshold, the model parameters of the initial language understanding model are adjusted until the second loss value and the third loss value are both less than or equal to the loss threshold, so as to obtain the converged preset language understanding model.
8. A test script conversion device, characterized in that: include: An acquisition module is used to acquire the test cases of the vehicle; A language understanding module, used to input the test case into a preset language understanding model, and obtain a data structure corresponding to the test case output by the preset language understanding model, wherein the data structure includes an intent and an entity corresponding to the test case; The matching module is used to match the corresponding target test script from the database according to the data structure.
9. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the test script conversion method according to any one of claims 1 to 7 when executed by the processor.
10. A computer-readable storage medium, characterized in that: include: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the test script conversion method according to any one of claims 1 to 7 is implemented.
11. A vehicle, characterized in that: include: A camera, and a test script conversion device as claimed in claim 8, or an electronic device as claimed in claim 9.
Citation Information
Patent Citations
Method and device for generating test template script
CN109446059A
Generation of automated testing scripts by converting manual test cases
CN110018955A
Test case generation method and device, electronic equipment and storage medium
CN115454011A
Test case library construction method and device, equipment and storage medium
CN116383094A
Test case and test script generation method, device and system and medium
CN116841898A