Method and device for generating test case for electronic product, equipment and storage medium
By receiving electronic product requirements documents, extracting key information, building a requirement matrix and inputting a neural network model, and generating a test case matrix, the problems of difficult test case generation and maintenance in the existing technology are solved, and automated test case generation with high coverage and high accuracy are achieved.
Patent Information
- Application Number
- CN202411961380.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-11
- Publication Date
- 2025-03-11
AI Technical Summary
The prior art is difficult to quickly and accurately generate test cases covering the complex functions and logic of vehicle electronic products, resulting in insufficient test coverage and difficulty in maintaining.
By receiving electronic product requirements documents, extracting input and output interfaces and configuration parameters, creating a keyword database, and building a requirement matrix based on scene logic description, inputting it into the trained neural network model to generate a test case matrix, and finally decoding to generate a test case for requirements.
It realizes automated generation of test cases with wide coverage and high accuracy, reduces the workload of manual writing and maintenance, and improves the reliability of test results.
Smart Images

Figure CN119597676A_ABST
Abstract
Description
[0001] This application is a divisional application of the invention patent application with the application date of September 11, 2023, application number 202311167912.3, and invention name "Method, device, equipment and storage medium for generating test cases for electronic products". Technical Field
[0002] The present disclosure relates to the technical field of vehicle electronic product testing, and more particularly, to a method, apparatus, device and non-transitory storage medium for generating test cases for electronic products. Background Art
[0003] A test case is a description of a test task for an electronic product. For example, a test case can usually contain four contents: a test case title, preconditions, test steps (or trigger actions), and expected results. The test case title mainly describes a certain function to be tested. Preconditions refer to the conditions that the test case title needs to meet. Test steps mainly describe the operation steps of the test case. Expected results refer to meeting the expected requirements (development specifications, requirement documents, user requirements, etc.).
[0004] In the automotive industry, automotive parts suppliers must test their products before delivering them to OEMs to ensure that the products delivered to OEMs are safe, stable, and reliable. In order to test the products, it is necessary to design a large number of accurate test cases to cover various situations that may occur during the operation of the products. With the continuous development of vehicle technology, the functions and logic of vehicles are becoming more and more complex, making the demand for various electronic products on vehicles more and more complex, which further increases the difficulty of generating test cases. Most of the existing test cases rely on manual design and writing by test engineers, and a few are generated by software tools that simply traverse the input and output of electronic products. These methods are difficult to cope with the growing demand for electronic products in the automotive industry. Summary of the invention
[0005] According to a first aspect of the present disclosure, a method for generating test cases for an electronic product is provided. The method includes receiving a requirement document describing the requirements of the electronic product, the requirement document including a scenario logic description, an input / output interface description, and a configuration parameter description of the requirement. The method also includes extracting a test object and its possible states from the input / output interface description and the configuration parameter description of the requirement. The method also includes creating a keyword for the test object based on the extracted test object and its possible states, the keyword description performing a corresponding test operation on the test object to achieve the possible state. The method also includes building a keyword library, the keyword library storing each keyword created and a code that uniquely identifies the keyword. The method also includes extracting keywords from the scenario logic description of the requirement, and building a requirement matrix for the requirement based on the order of appearance of the extracted keywords in the scenario logic description and the code in the keyword library. The method also includes inputting the requirement matrix into a trained neural network model to generate a test case matrix. The method also includes decoding the test case matrix based on the keyword library and the construction method of the requirement matrix to obtain a test case for the requirement.
[0006] According to a second aspect of the present disclosure, a device for generating test cases for an electronic product is provided. The device includes a receiving module, a keyword library construction module, a requirement matrix construction module, a test case matrix generation module, and a test case decoding module. The receiving module is configured to receive a requirement document describing the requirements of the electronic product, the requirement document including a scenario logic description, an input / output interface description, and a configuration parameter description of the requirement. The keyword library construction module is configured to: extract a test object and its possible states from the input / output interface description and the configuration parameter description of the requirement; create a keyword for the test object based on the extracted test object and its possible states, the keyword description performs a corresponding test operation on the test object to achieve the possible state; and construct a keyword library, the keyword library storing each created keyword and a code that uniquely identifies the keyword. The requirement matrix construction module is configured to extract keywords from the scenario logic description of the requirement, and construct a requirement matrix for the requirement based on the order of appearance of the extracted keywords in the scenario logic description and the code in the keyword library. The test case matrix generation module is configured to input the requirement matrix into a trained neural network model to generate a test case matrix. The test case decoding module is configured to decode the test case matrix based on the keyword library and the construction method of the requirement matrix to obtain the test case for the requirement.
[0007] According to a third aspect of the present disclosure, a computing device for generating test cases for an electronic product is provided. The computing device includes one or more processors and a memory storing computer executable instructions. When the computer executable instructions are executed by the one or more processors, the one or more processors execute the method for generating test cases for an electronic product according to the first aspect of the present disclosure.
[0008] According to a fourth aspect of the present disclosure, there is provided a non-transient storage medium having computer executable instructions stored thereon. When the computer executable instructions are executed by one or more processors, the one or more processors execute the method for generating test cases for an electronic product according to the first aspect of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] The foregoing and other features and advantages of the present disclosure will become apparent from the following description of the embodiments of the present disclosure in conjunction with the accompanying drawings. The accompanying drawings are incorporated herein and form a part of the specification, and are further used to explain the principles of the present disclosure and enable those skilled in the art to make and use the present disclosure. Among them:
[0010] Figure 1A A flowchart of a method for generating a test case for an electronic product according to some embodiments of the present disclosure is shown;
[0011] Figure 1B A flowchart of a method for generating a test case for an electronic product according to some embodiments of the present disclosure is shown;
[0012] Figure 2A A flowchart showing a method for training a neural network model according to some embodiments of the present disclosure is shown;
[0013] Figure 2B A flowchart showing a method for training a neural network model according to some embodiments of the present disclosure is shown;
[0014] Figure 3 Shows Figure 2A and Figure 2B A flowchart of a non-limiting example process of a method for training a neural network model is shown;
[0015] Figure 4 A schematic block diagram of an apparatus for generating test cases for an electronic product according to some embodiments of the present disclosure is shown;
[0016] Figure 5 A schematic block diagram of a computing device for generating test cases for an electronic product according to some embodiments of the present disclosure is shown;
[0017] Figure 6A schematic block diagram of a computer system is shown on which embodiments of the present disclosure may be implemented.
[0018] Note that in the embodiments described below, sometimes the same reference numerals are used in common between different drawings to represent the same parts or parts with the same functions, and their repeated descriptions are omitted. In some cases, similar numbers and letters are used to represent similar items, so once an item is defined in one drawing, it does not need to be further discussed in subsequent drawings.
[0019] For ease of understanding, the position, size, range, etc. of each structure shown in the drawings and the like may not represent the actual position, size, range, etc. Therefore, the present disclosure is not limited to the position, size, range, etc. disclosed in the drawings and the like. DETAILED DESCRIPTION
[0020] Various exemplary embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings. It should be noted that unless otherwise specifically stated, the relative arrangement of components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present disclosure.
[0021] The following description of at least one exemplary embodiment is in fact merely illustrative and is in no way intended to limit the present disclosure and its application or use. That is, the structures and methods herein are shown in an exemplary manner to illustrate different embodiments of the structures and methods in the present disclosure. However, those skilled in the art will appreciate that they merely illustrate exemplary ways of the present disclosure that can be implemented, rather than exhaustive ways. In addition, the drawings need not be drawn to scale, and some features may be enlarged to illustrate the details of specific components.
[0022] In addition, technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered as part of the specification.
[0023] In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not as limiting. Therefore, other examples of the exemplary embodiments may have different values.
[0024] The vehicle of the present disclosure will be described using a car as an example, but it should be understood that the vehicle described in the present disclosure is not limited to a car, but may also include various suitable means of transportation such as a train, a ship, and an aircraft.
[0025] The existing test case generation method for testing the functions of vehicle electronic products is mainly completed manually by test engineers. The test engineer first analyzes the usage scenario requirements and communication signal requirements from the automotive electronic product requirement document, and then manually analyzes and designs the test cases to be reviewed related to the scenario requirements, and uses relevant software to traverse to obtain the test cases to be reviewed related to the communication signal requirements, and finally manually reviews the test cases to be reviewed to obtain the test cases. The existing test case generation method is not only time-consuming and labor-intensive, but also highly dependent on the personal ability of the test engineer. The correspondence between test cases and requirements is easily overlooked, which makes it easy for test cases to be omitted and thus fail to fully cover the requirements. In addition, the subsequent upgrade and maintenance of manually written test cases also need to be completed manually, which is a huge workload.
[0026] In order to solve the above problems, the present disclosure provides a method for generating test cases for electronic products, which can automatically generate test cases with wide coverage and high accuracy based on the requirements document. This makes it unnecessary to manually upgrade and maintain the test cases, and each automatic generation can conveniently and reliably achieve the upgrade and maintenance of the test cases.
[0027] The following will be combined Figure 1A and Figure 1B Methods 100 and 100' for generating test cases for electronic products according to various embodiments of the present disclosure are described in detail. It is understood that the actual method for generating test cases for electronic products may also include other steps, but in order to avoid blurring the main points of the present disclosure, these other steps are not discussed herein and are not shown in the accompanying drawings. In addition, method 100' is an example variation of method 100, and the two share many steps. When referring to method 100', the different steps of method 100' and method 100 will be mainly described below.
[0028] like Figure 1A As shown, the method 100 may include steps S102 to S114.
[0029] In step S102, a requirement document describing the requirements of an electronic product is received, wherein the requirement document includes a scenario logic description, an input / output interface description, and a configuration parameter description of the requirement.
[0030] For example, a remote control key unlocking requirement document is shown below, which includes a scenario logic description, input and output interface description, and configuration parameter description of the remote control key unlocking requirement. It should be understood that the requirement document shown below is exemplary and non-restrictive, and the requirement document can be of any other suitable format / subject / type, as long as it includes the scenario logic description, input and output interface description, and configuration parameter description of the corresponding requirements. In addition, although the requirement document is shown below as a word document format described in natural language, other document formats are also feasible. It should also be noted that the content of the following " / …… / " does not have to appear in the document, but is only used to indicate which of the scenario logic description, input and output interface description, and configuration parameter description the corresponding document part corresponds to.
[0031] …
[0032] 1. Remote key unlock
[0033] …
[0034] / Scene logic description /
[0035] 1.1 Remote key unlocking
[0036] (1) Configuration:
[0037] Two-step unlock == 0
[0038] (2) Conditions:
[0039] Driver's door lock status feedback is locked
[0040] Passenger door lock status feedback is locked
[0041] (3) Event:
[0042] Received remote key unlock request == Yes
[0043] (4) Action:
[0044] The integrated body control module (IBCM) shall perform the passenger door unlock control and the driver door unlock control high voltage
[0045] …
[0046] / Input and output interface description /
[0047] 1.2.1 Input Signal
[0048] 1.2.1.1 Hardwire Input
[0049]
[0050] …
[0051] 1.2.2 Internal Signals 1.2.2.1 Internal Inputs
[0052]
[0053] …
[0054] 1.2.3 Output Signal 1.2.3.1 Hard-wired Output
[0055]
[0056] …
[0057] / Configuration parameter description /
[0058] 1.3 Configuration Parameters
[0059] 1.3.1 Electrically Erasable Programmable Read-Only Memory (EEPROM) Parameters
[0060]
[0061] …
[0062] In some embodiments, the requirement document may describe multiple requirements of the electronic product, and the method 100 further includes dividing the requirement document into multiple requirement units through a natural language processing (NLP) model, each requirement unit describing one requirement among the multiple requirements and including a scene logic description, an input / output interface description, and a configuration parameter description of the requirement. For example, the requirement document may include an automatic relocking requirement, a remote locking requirement, etc. in addition to the remote control key unlocking requirement. Therefore, the method 100 may divide the requirement document into a remote control key unlocking requirement unit, an automatic relocking requirement unit, a remote locking requirement unit, etc. based on the NLP model with each different requirement as a unit. It should be understood that the NLP model used herein is exemplary and not restrictive, and those skilled in the art may also use any other suitable algorithm or model. After the requirement document is divided into multiple requirement units, steps S104 to S114 described later may be performed on each requirement unit. The following will be further described by taking a separate remote control key unlocking requirement as an example.
[0063] In some embodiments, the scenario logic description includes preset conditions, triggering actions, and expected results. It is understandable that the preset conditions, triggering actions, and expected results may actually be described in various forms in the requirements document, but those skilled in the art can understand which content in the requirements document substantially corresponds to the preset conditions, triggering actions, and expected results. For example, in the above-mentioned remote control key unlocking requirements document, the "(1) Configuration" and "(2) Conditions" parts substantially correspond to the preset conditions, the "(3) Events" part substantially corresponds to the triggering actions, and the "(4) Actions" part substantially corresponds to the expected results.
[0064] Continue to refer Figure 1A At step 104, test objects and their possible states are extracted from the input and output interface descriptions and the configuration parameter descriptions of the requirements.
[0065] In some embodiments, extracting the test object and its possible state from the input and output interface description and configuration parameter description of the requirement is realized by an NLP model. In some embodiments, the test object and its possible state extracted from the input and output interface description and configuration parameter description of the requirement can also be semantically processed to standardize and uniquely make it so as to subsequently create keywords based on the standardized and unique test object and its possible state (how to create keywords based on the test object and its possible state will be described later). For example, there may be various semantically similar expressions in the requirement document, such as "the feedback of the door lock state beside the driver is unlocked", "the door lock of the main driver's side door is opened", etc. Therefore, after extracting the test object and its possible state from the requirement document, it is necessary to semantically process the extracted test object and its possible state into a unique standard expression with clear meaning based on a standardized use case language model or any other suitable algorithm or model. In the above example, the extracted test object and its possible state can be standardized and uniquely made into "driver's door lock state feedback" and "unlock" based on the standardized use case language model. Based on this, the standardized and unique test object and its possible state as shown in Table 1 below can be extracted from the input and output interface description and configuration parameter description of the above remote control key unlocking requirement document.
[0066] Table 1
[0067]
[0068]
[0069] Continue to refer Figure 1AAt step S106, a keyword is created for the test object based on the extracted test object and its possible states, wherein the keyword describes the corresponding test operation performed on the test object to achieve the possible state. At step S108, a keyword library is constructed, wherein the keyword library stores each created keyword and a code that uniquely identifies the keyword. In some embodiments, the keyword library also stores the type and / or input / output classification of each keyword.
[0070] For example, keywords are created for the test objects using the test objects and their possible states extracted in Table 1, and a keyword library as shown in Table 2 below is constructed based on the created keywords.
[0071] Table 2
[0072]
[0073]
[0074] In some embodiments, for example, reference Figure 1B , creating keywords for the test object based on the extracted test object and its possible states also includes creating a keyword group for the test object based on the extracted test object and its multiple possible states, each keyword in the keyword group describing a corresponding test operation performed on the test object to achieve a corresponding one of the multiple possible states (step S106' of method 100'). In this case, the keyword library of Table 2 can be further modified into the following Table 3.
[0075] Table 3
[0076]
[0077]
[0078] As can be seen from Table 2 and Table 3, the keyword library assigns a corresponding unique code (1 to 18) to each keyword. Of course, the form of coding is not limited to this, but any suitable coding form that can uniquely identify a keyword can be adopted. Each keyword describes the execution of a corresponding test operation on the corresponding test object to achieve a possible state, for example, keyword 1 "Set the driver's door lock state feedback to unlock" describes the execution of a setting operation (test operation) on the driver's door lock state feedback (test object) to make it in an unlocked state (possible state). Keywords with different states of the same test object belong to the same keyword group, for example, keywords 3 to 6 all belong to the keyword group TccSts, and each keyword in keywords 3 to 6 corresponds to a possible state of TccSts. In addition, the keywords in the keyword library can also have types and input-output classifications in addition to coding and keyword groups. Therefore, when the technician needs to retrieve the target keyword corresponding to a certain word in the keyword library, the keyword can also be screened according to the type and input-output classification of the word to quickly locate the target keyword. It should be understood that the keyword library shown in Table 2 and Table 3 is only exemplary and non-restrictive, and there can also be more other keywords in the keyword library and these keywords can have more other attributes.
[0079] Continue to refer Figure 1A At step S110, keywords are extracted from the scenario logic description of the requirement, and a requirement matrix is constructed for the requirement based on the order of appearance of the extracted keywords in the scenario logic description and the encoding in the keyword library.
[0080] In some embodiments, extracting keywords from the scenario logic description of the requirements is implemented by an NLP model. In some embodiments, extracting keywords from the scenario logic description of the requirements includes extracting key information associated with the keywords from the scenario logic description of the requirements and standardizing the key information into keywords. Taking the above remote control key unlocking requirement document as an example, the key information "two-step unlocking == 0", "driver's door lock status feedback is locked" and "passenger door lock status feedback is locked" are extracted from the "(1) Configuration" and "(2) Conditions" parts (pre-set conditions) of the scenario logic description and standardized as the keywords "configure two-step unlocking to disable", "set driver's door lock status feedback to locked" and "set passenger door lock status feedback to locked" respectively; the key information "receive remote control key unlocking request == yes" is extracted from the "(3) Event" part (trigger action) and standardized as the keyword "set remote control key unlocking request to yes"; the key information "IBCM should execute passenger door unlocking control and driver door unlocking control high voltage" is extracted from the "(4) Action" part (expected result) and standardized as the keywords "verify passenger door unlocking control is high level" and "verify driver door unlocking control is high level". Based on the order of appearance of the extracted keywords "configure two-step unlocking to disabled", "set driver's door lock status feedback to locked", "set passenger door lock status feedback to locked", "set remote control key unlock request to yes", "verify passenger door unlock control to high level" and "verify driver door unlock control to high level" in the scene logic description of the remote control key unlock requirement and their corresponding codes in the keyword library, the scene logic description can be re-described in a coded manner as: 10, 2, 13, 14, 7, 16. In some embodiments where the keyword library also stores the type and / or input-output classification of each keyword, extracting keywords from the scene logic description of the requirement can also include, for example, performing word segmentation on the scene logic description of the requirement, and querying the keyword library to obtain keywords and their codes corresponding to the segmented words according to the type (e.g., hardwired, internal, configured) and / or input-output classification of the segmented words. Given that the scene logic description may include preset conditions, trigger actions and expected results, the requirement matrix can be constructed accordingly to include a first column corresponding to the preset conditions, a second column corresponding to the trigger actions and a third column corresponding to the expected results. It can be understood that the "first", "second" and "third" here are only used for distinction and do not limit the order of the columns.
[0081] Extracting keywords from the scenario logic description of the requirement may include extracting a first keyword from a preset condition, extracting a second keyword from a trigger action, and extracting a third keyword from an expected result. For example, "configure two-step unlocking to be disabled", "set driver's door lock status feedback to be locked", "set passenger door lock status feedback to be locked" belong to the first keyword, "set remote control key unlock request to be yes" belongs to the second keyword, and "verify passenger door unlock control to be high level" and "verify driver door unlock control to be high level" belong to the third keyword.
[0082] In some embodiments, the number of rows of the demand matrix is at least the maximum of the number of first keywords, the number of second keywords, and the number of third keywords. For example, for the demand matrix, the arrangement order of the codes of the first keywords in the first column may correspond to the order of appearance of the first keywords in the pre-conditions of the scenario logic description of the demand, the arrangement order of the codes of the second keywords in the second column may correspond to the order of appearance of the second keywords in the triggering actions of the scenario logic description of the demand, and the arrangement order of the codes of the third keywords in the third column may correspond to the order of appearance of the third keywords in the expected results of the scenario logic description of the demand. Positions in the demand matrix that do not include keyword codes can be filled with zeros.
[0083] Based on this, taking the above remote key unlocking requirement document as an example, the requirement matrix constructed is: It can be seen from the matrix that the first column of the demand matrix corresponds to the three keywords of the preset conditions "configure two-step unlocking to disable" (coded as 10), "set driver's door lock status feedback to locked" (coded as 2), and "set passenger door lock status feedback to locked" (coded as 13), and the three keywords are arranged from the first row of the first column to the third row in the order in which they appear in the document; the first row of the second column of the demand matrix corresponds to a keyword of the trigger action "set remote control key unlock request to yes" (coded as 14); the third column of the demand matrix corresponds to the two keywords of the expected results "verify passenger door unlock control is high level" (coded as 7) and "verify driver door unlock control is high level" (coded as 16), and are arranged from the first row of the third column to the second row in the order in which the two keywords appear in the document; the positions in the demand matrix that do not include keyword codes are filled with 0.
[0084] In some cases, the demand matrix may have more rows and columns, which may be padded with zeros, for example, to adjust the size of the demand matrix to a state that is convenient for subsequent processing.
[0085] In addition, in some embodiments where a keyword group has been created for a test subject (S106' of method 100'), reference Figure 1B, it is also possible to construct a scenario possibility matrix for the demand in step S111' based on the codes of all the keywords in the keyword group to which the keywords extracted from the scenario logic description of the demand belong in the keyword library. For example, each row of the scenario possibility matrix may correspond to the keyword group to which a corresponding keyword extracted from the scenario logic description of the demand belongs, and the number of columns of the scenario possibility matrix may be at least the maximum number of keywords in the keyword group to which each keyword extracted from the scenario logic description of the demand belongs. Positions in the scenario possibility matrix that do not include keyword codes may also be filled with 0. In addition, the codes of the keywords extracted from the scenario logic description of the demand may be arranged in the same column of the scenario possibility matrix according to the order in which the keywords appear in the scenario logic description.
[0086] Taking the above remote control key unlocking requirement document as an example, the scenario possibility matrix constructed based on the encoding of all keywords in the keyword groups "two-step unlocking", "driver door lock status feedback", "passenger door lock status feedback", "remote control key unlocking request", "passenger door unlocking control" and "driver door unlocking control" to which the six keywords extracted from the scenario logic description belong respectively can be, for example, The scenario possibility matrix includes three columns and six rows, because the number of keywords in the two keyword groups "passenger door unlock control" and "driver door unlock control" is the largest and is 3, and a total of six keywords belonging to different keyword groups are extracted from the scenario logic description. The codes of the keywords extracted from the scenario logic description of the requirements (10, 2, 13, 14, 7, 16) are arranged in the first column of the scenario possibility matrix according to the order of appearance of the keywords in the scenario logic description, and the remaining columns are arranged with other keyword codes of the same group as the keyword codes in the first column, and the positions without keyword codes are filled with 0. Specifically, the first row of the scenario possibility matrix includes codes 10 and 11 of the two keywords of the keyword group “two-step unlocking”, the second row includes codes 2 and 1 of the two keywords of the keyword group “driver door lock status feedback”, the third row includes codes 13 and 12 of the two keywords of the keyword group “passenger door lock status feedback”, the fourth row includes codes 14 and 15 of the two keywords of the keyword group “remote control key unlocking request”, the fifth row includes codes 7, 8, and 9 of the three keywords of the keyword group “passenger door unlocking control”, and the sixth row includes codes 16, 17, and 18 of the three keywords of the keyword group “driver door unlocking control”.
[0087] In some cases, the scene likelihood matrix may have more rows and columns, which may be padded with 0s, for example, to adjust the size of the scene likelihood matrix to a state that is convenient for subsequent processing.
[0088] Continue to refer Figure 1AAt step S112, the requirement matrix is input into the trained neural network model to generate a test case matrix, or reference Figure 1B At step S112', the scenario possibility matrix and the requirement matrix are input into the trained neural network model to generate a test case matrix. Figure 1A and Figure 1B At step S114, the test case matrix is decoded based on the keyword library and the construction method of the requirement matrix to obtain test cases for the requirement.
[0089] In some embodiments, the test case matrix is generated to include a first column corresponding to a preset condition, a second column corresponding to a trigger action, and a third column corresponding to an expected result, and the arrangement of the first column, the second column, and the third column of the test case matrix corresponds to the arrangement of the first column, the second column, and the third column of the requirement matrix. The arrangement described here may include, for example, the order of these columns and the number and position of non-zero items in each column. Then, the generated test case matrix may be decoded into a test case based on the construction method of the keyword library and the requirement matrix (e.g., the arrangement order of the keyword encoding in the requirement matrix).
[0090] Continuing with the above remote key unlocking requirement document as an example, the above requirement matrix and scenario likelihood matrix After being input into the trained neural network model together, the generated test case matrix may include, for example and Each test case matrix may correspond to a test case. Then, based on the construction method of the keyword library and the requirement matrix, the generated test case matrix is decoded into a test case as shown in Table 4 below.
[0091] Table 4
[0092]
[0093]
[0094] The test cases in Table 4 may also be titled “Test remote key unlocking”. It should be understood that the above process is merely exemplary and not restrictive, and the test case matrix generated for testing remote key unlocking may be more than 6, and the test cases generated accordingly may also be more than 6.
[0095] Based on the generated test cases, the technicians can conduct a comprehensive test on the electronic products related to the remote key unlocking on the vehicle to ensure the normal use of the remote key unlocking function of the vehicle. In addition, if the technicians want to upgrade and maintain the test cases later, they can directly add / delete / modify the corresponding content in the requirement document, and the keyword library and test cases can be automatically updated through methods 100 and 100'.
[0096] Because in the actual testing process, a requirement requires a large number of test cases to cover the different expected results of different preset conditions and different triggering actions of the requirement in various scenarios. For example, a remote control key unlocking requirement may correspond to many different test cases, but the scenario logic description of the remote control key unlocking requirement document only records one scenario of the requirement (usually the correct use scenario). Therefore, the effect of generating test cases based only on the information in the scenario logic description of the requirement may be limited. If other possible scenarios associated with the requirements in the scenario logic description can be extracted from other information of the requirement (input and output interface description and configuration parameter description), and then all possible scenarios are used to generate test cases together, the generated test cases may have a wider coverage. Therefore, to some extent, inputting the scenario possibility matrix into the neural network model together with the requirement matrix can help the neural network model generate test cases more accurately and comprehensively, covering more complex test scenarios, compared with inputting the requirement matrix alone into the neural network model. However, it can be understood that no matter which method is used, the effect of automatically generating test cases can be achieved by reasonably training the neural network model. The following will combine Figure 2A and Figure 2B A method of training a neural network model according to some embodiments of the present disclosure is described.
[0097] Figure 2A A flowchart of a method 200 for training a neural network model according to some embodiments of the present disclosure is shown, which may be applicable to, for example, Figure 1A The neural network model described receives a single input of the demand matrix. Figure 2AAs shown, method 200 includes: at step S202, determining a benchmark scenario based on a scenario logic description of a sample requirement, wherein the benchmark scenario includes a benchmark preset condition, a benchmark trigger action, and a benchmark expected result; at step S204, constructing a benchmark requirement matrix for the benchmark scenario based on a benchmark appearance order of the benchmark preset condition, the benchmark trigger action, and the benchmark expected result in the scenario logic description of the sample requirement, and encoding of the corresponding keywords of the benchmark preset condition, the corresponding keywords of the benchmark trigger action, and the corresponding keywords of the benchmark expected result in the keyword library; at step S206, constructing a benchmark requirement matrix for the benchmark scenario based on the The scenario logic description, input and output interface description and configuration parameter description of the sample requirement are used to determine possible scenarios, and the possible scenarios include possible preset conditions, possible triggering actions and possible expected results; at step S208, based on the benchmark appearance order, and the encoding of the corresponding keywords of the possible preset conditions, the corresponding keywords of the possible triggering actions and the corresponding keywords of the possible expected results in the keyword library, a possible test case matrix is constructed for the possible scenarios; at step S210, the benchmark requirement matrix is used as a sample and the possible test case matrix is used as the label of the sample to train the neural network model. For example, taking the above remote control key unlocking requirement as a sample requirement, the requirement matrix can be As a sample, the possible test case matrix and As the label of the sample, the neural network model is trained.
[0098] Figure 2B A flowchart of a method 200' for training a neural network model according to some embodiments of the present disclosure is shown, which may be applicable to, for example, Figure 1B The neural network model described receives the combined input of the demand matrix and the scenario likelihood matrix. Figure 2B As shown, compared with method 200, method 200' is different in that it also includes, in step S205', building a benchmark scenario possibility matrix for the sample demand based on the encoding of all keywords in the keyword group to which the corresponding keywords of the benchmark preset conditions, the corresponding keywords of the benchmark triggering actions, and the corresponding keywords of the benchmark expected results belong in the keyword library, and in step S210' (instead of step S210), using the benchmark demand matrix and the benchmark scenario possibility matrix as samples and the possible test case matrix as labels of the samples to train the neural network model. For example, taking the above-mentioned remote control key unlocking demand as a sample demand as an example, the demand matrix and scenario likelihood matrix As a sample, the possible test case matrix
[0099] and As the label of the sample, the neural network model is trained.
[0100] Constructing a baseline requirement matrix and a baseline scenario possibility matrix (if any) as samples and constructing a possible test case matrix to label the samples can be done manually, for example, they can be manually written and reviewed by a test engineer. For example, a test engineer can analyze a requirement document to identify various possible scenarios of the requirements and write corresponding test cases for them, and then use the above-mentioned keyword library to encode the written test cases into a possible test case matrix. The possible test case matrix can be written as a label as accurately and comprehensively as possible to enhance the accuracy and comprehensiveness of the output results of the neural network model. In addition, with the application of the neural network model, the requirement matrix and scenario possibility matrix of the test cases to be generated received by it and the test case matrix generated by it can also be updated to the training sample set of the neural network model after manual review for retraining.
[0101] In some embodiments, training a neural network model may include: calculating the error between the test case matrix generated by the neural network model and the possible test case matrix; in response to the error being not less than a predetermined error threshold range, updating the parameters of the neural network model based on the error; and in response to the error being less than the predetermined error threshold range or in response to the number of updates exceeding a predetermined number threshold, ending the training of the neural network model and obtaining the trained neural network model. In some examples, calculating the error between the test case matrix generated by the neural network model and the possible test case matrix may include calculating the difference between the test case matrix generated by the neural network model and the possible test case matrix, and calculating the error based on the difference. The difference may, for example, be obtained by matrix subtraction operation. In other examples, calculating the error between the test case matrix generated by the neural network model and the possible test case matrix may also include calculating the similarity between the test case matrix generated by the neural network model and the possible test case matrix, and calculating the error based on the similarity. The similarity may, for example, include but is not limited to cosine similarity, Euclidean distance, Manhattan distance, Hamming distance, co-occurrence similarity, etc.
[0102] Figure 3 A non-limiting example process 300 for training a neural network model is shown. Figure 3As shown, a sample (e.g., a single benchmark requirement matrix, or a benchmark requirement matrix and a benchmark scenario possibility matrix) is input into a neural network model (S302), the error between the test case matrix generated by the neural network model and the possible test case matrix is calculated (S304), and it is determined whether the error is not less than a predetermined error threshold range (S306). If the error is determined to be less than the predetermined error threshold range (S306 "No"), the training of the neural network model is terminated and a trained neural network model is obtained (S312). If the error is determined to be not less than the predetermined error threshold range (S306 "Yes"), it is then determined whether the number of updates exceeds the predetermined number threshold (S308). If the number of updates does not exceed the predetermined number threshold (S308 "No"), the parameters of the neural network model are updated based on the error (S310), and the process returns to S302. If the number of updates exceeds the predetermined number threshold (S308 "Yes"), the training of the neural network model is terminated and a trained neural network model is obtained (S312).
[0103] Therefore, the present disclosure provides a method for generating test cases for electronic products, which has a high degree of automation, saves test case writing time, and eliminates the trouble of manual maintenance and upgrading of test cases; the test cases generated by it have a wide coverage, can cover complex test scenarios, and fully meet the needs; the test cases generated by it have high accuracy and can improve the reliability of test results.
[0104] In another aspect, the present disclosure also provides an apparatus for generating test cases for electronic products. Figure 4 , which shows a schematic block diagram of an apparatus 400 for generating test cases for an electronic product according to some embodiments of the present disclosure. Figure 4 As shown, the apparatus 400 includes a receiving module 402 , a keyword library building module 404 , a requirement matrix building module 406 , a test case matrix generating module 408 , and a test case decoding module 410 .
[0105] The receiving module 402 may be configured to receive a requirement document describing the requirements of an electronic product, the requirement document including a scenario logic description, an input / output interface description, and a configuration parameter description of the requirement. The keyword library construction module 404 may be configured to: extract a test object and its possible state from the input / output interface description and the configuration parameter description of the requirement; create a keyword for the test object based on the extracted test object and its possible state, the keyword description performs a corresponding test operation on the test object to achieve the possible state; and construct a keyword library, the keyword library storing each keyword created and a code that uniquely identifies the keyword. The requirement matrix construction module 406 may be configured to extract keywords from the scenario logic description of the requirement, and construct a requirement matrix for the requirement based on the order of appearance of the extracted keywords in the scenario logic description and the code in the keyword library. The test case matrix generation module 408 may be configured to input the requirement matrix into a trained neural network model to generate a test case matrix. The test case decoding module 410 may be configured to decode the test case matrix based on the keyword library and the construction method of the requirement matrix to obtain a test case for the requirement.
[0106] In some embodiments, the requirement document describes multiple requirements of the electronic product, and the device 400 may also include a requirement unitization module (not shown), which is configured to divide the requirement document into multiple requirement units through an NLP model, each requirement unit describes one requirement among the multiple requirements and includes a scenario logic description, input and output interface description, and configuration parameter description of the requirement.
[0107] In some embodiments, the keyword library construction module 404 is further configured to perform semantic processing on the test objects and their possible states extracted from the input-output interface description and the configuration parameter description of the requirement to standardize and uniquely make them, and create keywords for the test objects based on the standardized and uniquely extracted test objects and their possible states. In some embodiments, the keyword library construction module 404 is further configured to extract test objects and their possible states from the input-output interface description and the configuration parameter description of the requirement through an NLP model.
[0108] In some embodiments, the demand matrix construction module 406 is configured to extract keywords from the scenario logic description of the demand through an NLP model. In some embodiments, the demand matrix construction module 406 is further configured to extract keywords from the scenario logic description of the demand by performing the following operations: extracting key information associated with the keywords from the scenario logic description of the demand and normalizing the key information into keywords.
[0109] In some embodiments, the keyword library also stores the type and / or input-output classification of each keyword, and the requirement matrix construction module 406 is also configured to extract keywords from the scenario logic description of the requirement through the following operations: performing word segmentation on the scenario logic description of the requirement; and querying the keyword library to obtain keywords and their encodings corresponding to the segmented words according to the type and / or input-output classification of the segmented words.
[0110] In some embodiments, the scenario logic description includes a preset condition, a trigger action, and an expected result, and the demand matrix construction module 406 is configured to construct the demand matrix to include a first column corresponding to the preset condition, a second column corresponding to the trigger action, and a third column corresponding to the expected result. In some embodiments, the demand matrix construction module 406 is configured to extract a first keyword from the preset condition, a second keyword from the trigger action, and a third keyword from the expected result, and the demand matrix construction module 406 is configured to construct the demand matrix so that the number of rows of the demand matrix is at least the maximum value of the number of the first keyword, the number of the second keyword, and the number of the third keyword. In some embodiments, the demand matrix construction module 406 is configured to construct the demand matrix so that the arrangement order of the first keyword encoding in the first column corresponds to the appearance order of the first keyword in the preset condition of the scenario logic description of the demand, the arrangement order of the second keyword encoding in the second column corresponds to the appearance order of the second keyword in the trigger action of the scenario logic description of the demand, and the arrangement order of the third keyword encoding in the third column corresponds to the appearance order of the third keyword in the expected result of the scenario logic description of the demand. In some embodiments, the test case matrix generation module 408 is configured to generate the test case matrix to include a first column corresponding to preset conditions, a second column corresponding to trigger actions, and a third column corresponding to expected results, and the arrangement of the first column, the second column, and the third column of the test case matrix corresponds to the arrangement of the first column, the second column, and the third column of the requirement matrix.
[0111] In some embodiments, the keyword library construction module 404 is further configured to create a keyword group for the test object based on the extracted test object and its multiple possible states, each keyword in the keyword group describes the execution of a corresponding test operation on the test object to achieve a corresponding one of the multiple possible states, and the device 400 may also include a scenario possibility matrix construction module (not shown), which is configured to construct a scenario possibility matrix for the requirement based on the encoding of all keywords in the keyword group to which the keywords extracted from the scenario logic description of the requirement belong in the keyword library. The test case matrix generation module 408 may be configured to input the scenario possibility matrix together with the requirement matrix into the trained neural network model to generate a test case matrix.
[0112] In some embodiments, the scenario possibility matrix construction module can be configured to construct the scenario possibility matrix to satisfy at least one of the following: each row of the scenario possibility matrix corresponds to a keyword group to which a corresponding keyword extracted from the scenario logic description of the requirement belongs; the number of columns of the scenario possibility matrix is at least the maximum number of keywords in the keyword group to which each keyword extracted from the scenario logic description of the requirement belongs; the codes of the keywords extracted from the scenario logic description of the requirement are arranged in the same column of the scenario possibility matrix according to the order of appearance of the keywords in the scenario logic description.
[0113] In some embodiments, the device 400 may also include a neural network model training module (not shown), which is configured to train the neural network model through the following operations to obtain the trained neural network model: determine a benchmark scenario based on the scenario logic description of the sample requirements, the benchmark scenario including a benchmark preset condition, a benchmark trigger action and a benchmark expected result; construct a benchmark requirement matrix for the benchmark scenario based on the benchmark appearance order of the benchmark preset condition, the benchmark trigger action and the benchmark expected result in the scenario logic description of the sample requirements, and the encoding of the corresponding keywords of the benchmark preset condition, the corresponding keywords of the benchmark trigger action and the corresponding keywords of the benchmark expected result in the keyword library; determine possible scenarios based on the scenario logic description, input and output interface description and configuration parameter description of the sample requirements, the possible scenarios including possible preset conditions, possible trigger actions and possible expected results; construct a possible test case matrix for the possible scenarios based on the benchmark appearance order, and the encoding of the corresponding keywords of the possible preset condition, the corresponding keywords of the possible trigger action and the corresponding keywords of the possible expected result in the keyword library; train the neural network model using the benchmark requirement matrix as a sample and the possible test case matrix as a label of the sample.
[0114] In some embodiments, the device 400 may also include a neural network model training module (not shown), which is configured to train the neural network model through the following operations to obtain the trained neural network model: determine a benchmark scenario based on the scenario logic description of the sample requirements, the benchmark scenario including a benchmark preset condition, a benchmark trigger action and a benchmark expected result; construct a benchmark requirement matrix for the benchmark scenario based on the benchmark appearance order of the benchmark preset condition, the benchmark trigger action and the benchmark expected result in the scenario logic description of the sample requirements, and the encoding of the corresponding keywords of the benchmark preset condition, the corresponding keywords of the benchmark trigger action and the corresponding keywords of the benchmark expected result in the keyword library; and the encodings of all keywords in the keyword groups corresponding to the keywords of the benchmark expected results in the keyword library, construct a benchmark scenario possibility matrix for the sample demand; determine possible scenarios based on the scenario logic description, input and output interface description and configuration parameter description of the sample demand, and the possible scenarios include possible preset conditions, possible triggering actions and possible expected results; construct a possible test case matrix for the possible scenarios based on the benchmark appearance order and the encodings of the corresponding keywords of the possible preset conditions, the corresponding keywords of the possible triggering actions and the corresponding keywords of the possible expected results in the keyword library; use the benchmark demand matrix and the benchmark scenario possibility matrix as samples and use the possible test case matrix as the label of the samples to train the neural network model.
[0115] In some embodiments, the neural network model training module is further configured to train the neural network model by: calculating the error between the test case matrix generated by the neural network model and the possible test case matrix; in response to the error being not less than a predetermined error threshold range, updating the parameters of the neural network model based on the error; and in response to the error being less than the predetermined error threshold range or in response to the number of updates exceeding a predetermined number threshold, ending the training of the neural network model and obtaining the trained neural network model. In some embodiments, the neural network model training module is further configured to calculate the error by: calculating the difference between the test case matrix generated by the neural network model and the possible test case matrix, and calculating the error based on the difference; or calculating the similarity between the test case matrix generated by the neural network model and the possible test case matrix, and calculating the error based on the similarity.
[0116] Various embodiments of the apparatus 400 for generating test cases for electronic products are similar to the various embodiments of the aforementioned methods 100, 100' for generating test cases for electronic products. Therefore, reference may be made to the aforementioned description of the various embodiments of the methods 100, 100' for generating test cases for electronic products, which will not be repeated here.
[0117] The present disclosure also provides a computing device for generating test cases for electronic products, which may include one or more processors and a memory storing computer executable instructions, wherein when the computer executable instructions are executed by the one or more processors, the one or more processors execute the method for generating test cases for electronic products according to any of the aforementioned embodiments of the present disclosure. Figure 5 As shown, the computing device 500 includes (one or more) processors 502 and a memory 504 storing computer executable instructions, which, when executed by the (one or more) processors 502, causes the (one or more) processors 502 to perform the method 100, 100' for generating test cases for electronic products according to any of the aforementioned embodiments of the present disclosure. (One or more) processors 502 may be, for example, a central processing unit (CPU) of the computing device 500. (One or more) processors 502 may be any type of general-purpose processor, or may be a processor specifically designed to generate test cases for electronic products, such as an application-specific integrated circuit ("ASIC"). The memory 504 may include various computer-readable media accessible by (one or more) processors 502. In various embodiments, the memory 504 described herein may include volatile and non-volatile media, removable and non-removable media. For example, the memory 504 may include any combination of the following: random access memory ("RAM"), dynamic RAM ("DRAM"), static RAM ("SRAM"), read-only memory ("ROM"), flash memory, cache memory, and / or any other type of non-transient computer-readable media. The memory 504 may store instructions that, when executed by the processor 502 , enable the processor 502 to perform the method 100 , 100 ′ for generating a test case for an electronic product according to any of the aforementioned embodiments of the present disclosure.
[0118] The present disclosure also provides a non-transitory storage medium having computer executable instructions stored thereon, which, when executed by a computer, enables the computer to execute the method 100, 100' for generating test cases for an electronic product according to any of the aforementioned embodiments of the present disclosure.
[0119] Figure 6A schematic block diagram of a computer system 600 on which an embodiment of the present disclosure may be implemented is shown. The computer system 600 includes a bus 602 or other communication mechanism for transmitting information, and a processing device 604 coupled to the bus 602 for processing information. The computer system 600 also includes a memory 606 coupled to the bus 602 for storing instructions to be executed by the processing device 604, which may be a random access memory (RAM) or other dynamic storage device. The memory 606 may also be used to store temporary variables or other intermediate information during the execution of instructions to be executed by the processing device 604. The computer system 600 also includes a read-only memory (ROM) 608 or other static storage device coupled to the bus 602 for storing static information and instructions for the processing device 604. A storage device 610 such as a magnetic disk or optical disk is provided and coupled to the bus 602 for storing information and instructions. The computer system 600 may be coupled to an output device 612 via the bus 602 for providing output to a user, such as, but not limited to, a display (such as a cathode ray tube (CRT) or a liquid crystal display (LCD)), a speaker, etc. An input device 614 such as a keyboard, a mouse, a microphone, etc. is coupled to the bus 602 for transmitting information and command selections to the processing device 604. The computer system 600 may perform embodiments of the present disclosure. Consistent with certain implementations of the present disclosure, the results are provided by the computer system 600 in response to the processing device 604 executing one or more sequences of one or more instructions contained in the memory 606. Such instructions may be read into the memory 606 from another computer-readable medium such as the storage device 610. Execution of the sequence of instructions contained in the memory 606 causes the processing device 604 to perform the methods described herein. Alternatively, hard-wired circuitry may be used instead of or in combination with software instructions to implement the present teachings. Therefore, implementations of the present disclosure are not limited to any particular combination of hardware circuitry and software. In various embodiments, computer system 600 can be connected to one or more other computer systems such as computer system 600 across a network via network interface 616 to form a networked system. The network can include a private network or a public network such as the Internet. In a networked system, one or more computer systems can store data and supply data to other computer systems. The term "computer-readable medium" as used herein refers to any medium that participates in providing instructions to processing device 604 for execution. Such media can take many forms, including but not limited to non-volatile media, volatile media, and transmission media. Non-volatile media include, for example, optical disks or disks such as storage device 610. Volatile media include dynamic memories such as memory 606. Transmission media include coaxial cables, copper wires, and optical fibers, including wiring that includes bus 602.Common forms of computer-readable media or computer program products include, for example, floppy disks, flexible disks, hard disks, tapes, or any other magnetic media, CD-ROMs, digital video disks (DVDs), Blu-ray disks, any other optical media, thumb drives, memory cards, RAMs, PROMs and EPROMs, flash EPROMs, any other memory chips or cartridges, or any other tangible media from which a computer can read. Various forms of computer-readable media may be involved when carrying one or more sequences of one or more instructions to processing device 604 for execution. For example, the instructions may initially be carried on a disk of a remote computer. The remote computer may load the instructions into its dynamic memory and send the instructions over a telephone line using a modem. A modem local to computer system 600 may receive data over the telephone line and convert the data into an infrared signal using an infrared transmitter. An infrared detector coupled to bus 602 may receive the data carried in the infrared signal and place the data on bus 602. Bus 602 carries the data to memory 606, from which processing device 604 retrieves the instructions and executes them. Optionally, the instructions received by memory 606 may be stored on storage device 610 either before or after execution by processing device 604 .
[0120] According to various embodiments, instructions configured to be executed by a processing device to perform a method are stored on a computer readable medium. A computer readable medium may be a device that stores digital information. For example, a computer readable medium includes a compact disk read-only memory (CD-ROM) as known in the art for storing software. The computer readable medium is accessed by a processor adapted to execute the instructions configured to be executed.
[0121] One or more exemplary embodiments of the present disclosure are described above. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0122] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a server system. Of course, the present disclosure does not exclude that with the development of computer technology in the future, the computer that implements the functions of the above embodiments may be, for example, a personal computer, a laptop computer, a vehicle-mounted human-computer interaction device, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0123] Although one or more embodiments of the present disclosure provide method operation steps as described in the embodiments or flowcharts, more or fewer operation steps may be included based on conventional or non-creative means. The order of steps listed in the embodiments is only one way of executing the order of many steps and does not represent the only execution order. When the device or terminal product in practice is executed, it can be executed in sequence or in parallel according to the method shown in the embodiments or the drawings (for example, in a parallel processor or multi-threaded processing environment, or even a distributed data processing environment).
[0124] The terms "comprises", "includes" or any other variation thereof are intended to cover non-exclusive inclusion, so that a process, method, product or apparatus comprising 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, product or apparatus. In the absence of further restrictions, it is not excluded that there are other identical or equivalent elements in the process, method, product or apparatus comprising the elements. For example, if the words "first", "second" and the like are used to indicate names, they do not indicate any particular order.
[0125] For the convenience of description, the above devices are described in various modules according to their functions. Of course, when implementing one or more embodiments of the present disclosure, the functions of each module can be implemented in the same or more software and / or hardware, or the module implementing the same function can be implemented by a combination of multiple sub-modules or sub-units, etc. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0126] The present disclosure is described with reference to the flowchart and / or block diagram of the method, device (system), and computer program product according to the embodiment of the present disclosure. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the process and / or box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the functions specified in one process or multiple processes in the flowchart and / or one box or multiple boxes in the block diagram.
[0127] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0128] These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0129] Those skilled in the art will appreciate that one or more embodiments of the present disclosure may be in the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, one or more embodiments of the present disclosure may be in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0130] One or more embodiments of the present disclosure may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present disclosure may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communications network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0131] The same or similar parts between the various embodiments of the present disclosure can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts refer to the partial description of the method embodiment. In the description of the present disclosure, the description of the reference terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present disclosure. In the present disclosure, the schematic representation of the above terms does not necessarily target the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, in the absence of mutual contradiction, those skilled in the art can combine and combine the different embodiments or examples described in the present disclosure and the features of the different embodiments or examples.
[0132] In addition, when used in the present disclosure, the words "herein", "above", "below", "hereunder", "above" and words of similar meaning shall refer to the present disclosure as a whole rather than any particular portion of the present disclosure. In addition, unless otherwise expressly stated or understood in other ways in the context of use, the conditional language used herein, such as "may", "might", "for example", "such as", etc., is generally intended to express that certain embodiments include, while other embodiments do not include certain features, elements and / or states. Therefore, such conditional language is generally not intended to imply that one or more embodiments require features, elements and / or states in any way, or whether these features, elements and / or states are included or performed in any particular embodiment.
[0133] The above description is only an example of one or more embodiments of the present disclosure, and is not intended to limit one or more embodiments of the present disclosure. For those skilled in the art, one or more embodiments of the present disclosure may have various changes and variations. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present disclosure shall be included in the scope of the claims.
Claims
1. A method for generating test cases for an electronic product, comprising: Receive a requirement document describing the requirement of the electronic product, wherein the requirement document includes a scenario logic description, an input and output interface description, and a configuration parameter description of the requirement; Extracting test objects and possible states thereof from the input and output interface description and the configuration parameter description of the requirement; Creating keywords for the test object based on the extracted test object and its possible states, the keywords describing corresponding test operations to be performed on the test object to achieve the possible states; Building a keyword library, wherein the keyword library stores each created keyword and a code that uniquely identifies the keyword; Extracting keywords from the scenario logic description of the requirement, and constructing a requirement matrix for the requirement based on the order of appearance of the extracted keywords in the scenario logic description and the codes in the keyword library; Inputting the requirement matrix into a trained neural network model to generate a test case matrix; as well as The test case matrix is decoded based on the keyword library and the construction method of the requirement matrix to obtain test cases for the requirement.
2. The method according to claim 1, wherein: The requirement document describes multiple requirements of the electronic product, and the method further includes: The requirement document is divided into a plurality of requirement units through a natural language processing model, each requirement unit describes one requirement among the plurality of requirements and includes a scenario logic description, an input and output interface description and a configuration parameter description of the requirement.
3. The method according to claim 1, further comprising: The test objects and their possible states extracted from the input / output interface description and the configuration parameter description of the requirement are semantically processed to make them standardized and unique, and keywords are created for the test objects based on the standardized and unique extracted test objects and their possible states.
4. The method according to claim 1, wherein: Extracting keywords from the scenario logic description of the requirement includes extracting key information associated with the keywords from the scenario logic description of the requirement and normalizing the key information into keywords.
5. The method according to claim 1, wherein: Extracting the test object and its possible states from the input-output interface description and the configuration parameter description of the requirement is achieved through a natural language processing model, and / or extracting keywords from the scenario logic description of the requirement is achieved through a natural language processing model.
6. The method according to claim 1, wherein: The scenario logic description includes preset conditions, triggering actions and expected results, and wherein the requirement matrix is constructed to include a first column corresponding to the preset conditions, a second column corresponding to the triggering actions and a third column corresponding to the expected results.
7. The method according to claim 6, wherein: Extracting keywords from the scenario logic description of the requirement includes extracting a first keyword from a preset condition, extracting a second keyword from a trigger action, and extracting a third keyword from an expected result, and the number of rows of the requirement matrix is at least the maximum value of the number of the first keywords, the number of the second keywords, and the number of the third keywords.
8. The method according to claim 7, wherein: The arrangement order of the first keyword codes in the first column corresponds to the appearance order of the first keyword in the preset conditions described in the scenario logic of the requirement, the arrangement order of the second keyword codes in the second column corresponds to the appearance order of the second keyword in the trigger action described in the scenario logic of the requirement, and the arrangement order of the third keyword codes in the third column corresponds to the appearance order of the third keyword in the expected results described in the scenario logic of the requirement.
9. The method according to claim 6, wherein: The test case matrix is generated to include a first column corresponding to preset conditions, a second column corresponding to trigger actions, and a third column corresponding to expected results, and an arrangement of the first column, the second column, and the third column of the test case matrix corresponds to an arrangement of the first column, the second column, and the third column of the requirement matrix.
10. The method according to claim 1, wherein: Creating keywords for the test object based on the extracted test object and its possible states includes creating a keyword group for the test object based on the extracted test object and its multiple possible states, each keyword in the keyword group describing a corresponding test operation performed on the test object to achieve a corresponding one of the multiple possible states, and wherein the method further includes: Constructing a scenario possibility matrix for the requirement based on the codes in the keyword library of all keywords in the keyword group to which the keywords extracted from the scenario logic description of the requirement belong; The scenario likelihood matrix is input into the trained neural network model together with the requirement matrix to generate a test case matrix.
11. The method according to claim 10, wherein: Each row of the scenario possibility matrix corresponds to a keyword group to which a corresponding keyword extracted from the scenario logic description of the requirement belongs, and the number of columns of the scenario possibility matrix is at least the maximum number of keywords in the keyword group to which each keyword extracted from the scenario logic description of the requirement belongs.
12. The method according to claim 11, wherein: The codes of the keywords extracted from the scenario logic description of the requirements are arranged in the same column of the scenario possibility matrix according to the order in which the keywords appear in the scenario logic description.
13. The method according to claim 10, further comprising training a neural network model to obtain the trained neural network model by: Determine a benchmark scenario based on the scenario logic description of the sample requirements, wherein the benchmark scenario includes a benchmark preset condition, a benchmark trigger action, and a benchmark expected result; Constructing a benchmark requirement matrix for the benchmark scenario based on the benchmark appearance order of the benchmark preset conditions, the benchmark triggering actions and the benchmark expected results in the scenario logic description of the sample requirements, and the encoding of the corresponding keywords of the benchmark preset conditions, the corresponding keywords of the benchmark triggering actions and the corresponding keywords of the benchmark expected results in the keyword library; Constructing a benchmark scenario possibility matrix for the sample demand based on the codes of all keywords in the keyword group to which the corresponding keywords of the benchmark preset condition, the corresponding keywords of the benchmark trigger action and the corresponding keywords of the benchmark expected result belong respectively in the keyword library; Determine possible scenarios based on the scenario logic description, input and output interface description, and configuration parameter description of the sample requirements, wherein the possible scenarios include possible preset conditions, possible triggering actions, and possible expected results; Based on the occurrence order of the benchmarks, and the encodings of the corresponding keywords of the possible preset conditions, the corresponding keywords of the possible triggering actions, and the corresponding keywords of the possible expected results in the keyword library, constructing a possible test case matrix for the possible scenarios; The neural network model is trained by using the benchmark requirement matrix and the benchmark scenario possibility matrix as samples and using the possible test case matrix as labels of the samples.
14. The method according to claim 1, further comprising training a neural network model to obtain the trained neural network model by: Determine a benchmark scenario based on the scenario logic description of the sample requirements, wherein the benchmark scenario includes a benchmark preset condition, a benchmark trigger action, and a benchmark expected result; Constructing a benchmark requirement matrix for the benchmark scenario based on the benchmark appearance order of the benchmark preset conditions, the benchmark triggering actions and the benchmark expected results in the scenario logic description of the sample requirements, and the encoding of the corresponding keywords of the benchmark preset conditions, the corresponding keywords of the benchmark triggering actions and the corresponding keywords of the benchmark expected results in the keyword library; Determine possible scenarios based on the scenario logic description, input and output interface description, and configuration parameter description of the sample requirements, wherein the possible scenarios include possible preset conditions, possible triggering actions, and possible expected results; Based on the occurrence order of the benchmarks, and the encodings of the corresponding keywords of the possible preset conditions, the corresponding keywords of the possible triggering actions, and the corresponding keywords of the possible expected results in the keyword library, constructing a possible test case matrix for the possible scenarios; The neural network model is trained by using the benchmark requirement matrix as samples and the possible test case matrix as labels of the samples.
15. The method according to claim 13 or 14, wherein: Training the neural network model includes: Calculating the error between the test case matrix generated by the neural network model and the possible test case matrix; In response to the error being not less than a predetermined error threshold range, updating a parameter of the neural network model based on the error; and In response to the error being less than the predetermined error threshold range or in response to the number of updates exceeding a predetermined number threshold, the training of the neural network model is terminated and the trained neural network model is obtained.
16. The method according to claim 15, wherein: Calculating the error includes: Calculating the difference between the test case matrix generated by the neural network model and the possible test case matrix, and calculating the error based on the difference; or The similarity between the test case matrix generated by the neural network model and the possible test case matrix is calculated, and the error is calculated based on the similarity.
17. The method according to claim 1, wherein: The keyword library also stores the type and / or input / output classification of each keyword, and wherein extracting keywords from the scenario logic description of the requirement includes: Performing word segmentation on the scenario logic description of the requirement; According to the types of segmented words and / or input-output classifications, the keyword library is queried to obtain keywords and their codes corresponding to the segmented words.
18. A device for generating test cases for an electronic product, comprising: A receiving module is configured to receive a requirement document describing the requirement of the electronic product, wherein the requirement document includes a scenario logic description, an input and output interface description, and a configuration parameter description of the requirement; The keyword library building module is configured as follows: Extracting test objects and possible states thereof from the input and output interface description and the configuration parameter description of the requirement; Creating keywords for the test object based on the extracted test object and its possible states, the keywords describing corresponding test operations to be performed on the test object to achieve the possible states; Building a keyword library, wherein the keyword library stores each created keyword and a code that uniquely identifies the keyword; A requirement matrix building module, configured to extract keywords from the scenario logic description of the requirement, and build a requirement matrix for the requirement based on the order of appearance of the extracted keywords in the scenario logic description and the codes in the keyword library; A test case matrix generation module, configured to input the requirement matrix into the trained neural network model to generate a test case matrix; as well as The test case decoding module is configured to decode the test case matrix based on the keyword library and the construction method of the requirement matrix to obtain a test case for the requirement.
19. A computing device for generating test cases for an electronic product, comprising: one or more processors; as well as A memory storing computer executable instructions, wherein when the computer executable instructions are executed by the one or more processors, the one or more processors execute the method for generating test cases for an electronic product according to any one of claims 1 to 17.
20. A non-transitory storage medium having computer executable instructions stored thereon, wherein when the computer executable instructions are executed by a computer, the computer is caused to perform the method for generating test cases for an electronic product according to any one of claims 1 to 17. 21 . A computer program product, comprising instructions, which, when executed by a processor, implement the method for generating test cases for an electronic product according to claim 1 .