Test case generation method and device, computer equipment, readable storage medium and program product
By analyzing the specification information of the network application program interface and preset matching rules, the problem of low generation efficiency in the existing technology is solved and efficient test case generation is achieved.
Patent Information
- Application Number
- CN202510682990.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-26
- Publication Date
- 2025-07-04
AI Technical Summary
In the prior art, the test cases for generating network application program interfaces are less efficient and mainly rely on manual generation.
By analyzing the specification information of the target network application program interface, test cases are automatically generated using ARTE algorithms and preset matching rules, including determining the attribute information of test parameters, obtaining target predicates and building query tasks, and finally determining the test cases when the preset conditions are met.
It improves the efficiency of generating network application program interface test cases, reduces manual intervention, and improves the speed and accuracy of test cases generation.
Smart Images

Figure CN120256268A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of data processing, and particularly to a test case generation method, apparatus, computer device, computer-readable storage medium, and computer program product. Background Art
[0002] In the current rapid development of digital technology, as a bridge for data interaction and function call between different software systems, the performance of network application programming interfaces directly affects the efficiency and stability of data transmission between systems. Test cases for network application programming interfaces play a key role in ensuring the performance of network application programming interfaces, and can be used to test the functional integrity, data accuracy, performance, security, and compatibility of network application programming interfaces.
[0003] In the prior art, most test cases for network application programming interfaces are manually generated by technical personnel.
[0004] However, this method of manually generating test cases for network application programming interfaces by technical personnel results in poor efficiency in generating test cases. Summary of the Invention
[0005] Based on this, in view of the above technical problems, it is necessary to provide a test case generation method, apparatus, computer device, computer-readable storage medium, and computer program product that can improve the efficiency of generating test cases.
[0006] In a first aspect, this application provides a test case generation method, including:
[0007] Determine the attribute information of the test parameters of the target network application programming interface according to the specification information of the target network application programming interface;
[0008] Obtain a preset matching rule, and determine a target predicate corresponding to the test parameter based on the preset matching rule and the attribute information;
[0009] Construct a query task according to the target predicate, and determine the test case of the target network application programming interface based on the query result when the query result of the query task meets a preset condition.
[0010] In one of the embodiments, the determining the attribute information of the test parameters of the target network application programming interface according to the specification information of the target network application programming interface includes: obtaining the name of the test parameters of the target network application programming interface and the description information of the test parameters from the specification information of the target network application programming interface based on the ARTE algorithm; determining the name and the description information as the attribute information of the test parameter.
[0011] In one embodiment, the preset matching rule includes a plurality of sub-rules, and the sub-rule includes a matching condition and a keyword determination strategy. Determining a target predicate corresponding to the test parameter based on the preset matching rule and the attribute information includes: when the name and the description information meet the matching condition of the first sub-rule with the highest priority among the plurality of sub-rules, determining a keyword according to the keyword determination strategy of the first sub-rule; constructing a SPARQL query statement according to the keyword, and performing a search in a preset database based on the SPARQL query statement to obtain candidate predicates; determining the support degree of the candidate predicates, and when the support degree of the candidate predicates is greater than a preset threshold, determining the candidate predicates as the target predicates.
[0012] In one embodiment, the method further includes: when the support degree of the candidate predicates is less than or equal to the preset threshold, determining whether the name and the description information meet the matching condition of a second sub-rule, where the priority of the second sub-rule is lower than that of the first sub-rule and higher than that of the sub-rules other than the first sub-rule among the plurality of sub-rules; if so, determining a new keyword according to the keyword determination strategy of the second sub-rule, and constructing a new SPARQL query statement according to the new keyword; performing a search in the preset database based on the new SPARQL query statement to obtain new candidate predicates, and when the support degree of the new candidate predicates is greater than the preset threshold, determining the new candidate predicates as the target predicates.
[0013] In one embodiment, constructing a query task according to the target predicate, and when the query result of the query task meets a preset condition, determining a test case of the target network application programming interface based on the query result includes: constructing the query task by combining the target predicates, and executing the query task based on a preset database; obtaining the query result of the query task, where the query result includes matching items of each of the target predicates for constructing the query task; when the matching items of each of the target predicates are all greater than a preset matching item quantity threshold, determining the combination of the matching items of each of the target predicates as the test case.
[0014] In one embodiment, the method further includes: when there are matching items of each of the target predicates that are less than the preset matching item quantity threshold, performing an adjustment process on the query task; where the adjustment process includes reducing the quantity of target predicates used for constructing the query task.
[0015] In a second aspect, the present application further provides a test case generation device, including:
[0016] A determination module, configured to determine attribute information of test parameters of the target network application programming interface according to specification information of the target network application programming interface;
[0017] An acquisition module, configured to acquire a preset matching rule, and determine a target predicate corresponding to the test parameter based on the preset matching rule and the attribute information;
[0018] An execution module, configured to construct a query task according to the target predicate, and determine a test case for the target network application interface based on the query result when the query result of the query task meets a preset condition.
[0019] In a third aspect, the present application further provides a computer device, including a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the steps of the method described in any one of the embodiments in the first aspect are implemented.
[0020] In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method described in any one of the embodiments in the first aspect are implemented.
[0021] In a fifth aspect, the present application further provides a computer program product, including a computer program. When the computer program is executed by a processor, the steps of the method described in any one of the embodiments in the first aspect are implemented.
[0022] For the above test case generation method, device, computer device, computer-readable storage medium and computer program product, first determine the attribute information of the test parameters of the target network application interface according to the specification information of the target network application interface; then acquire a preset matching rule, and determine a target predicate corresponding to the test parameter based on the preset matching rule and the attribute information; finally, construct a query task according to the target predicate, and determine a test case for the target network application interface based on the query result when the query result of the query task meets a preset condition. The test case generation method provided by the present application can automatically generate test cases for network application interfaces through the specification information of the target network application interface. Compared with the prior art in which technicians need to manually generate test cases for network application interfaces, the efficiency of generating test cases for network application interfaces is effectively improved. Description of the Drawings
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following will briefly introduce the drawings required to be used in the description of the embodiments of the present application or related technologies. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other related drawings can also be obtained based on these drawings.
[0024] Figure 1Schematic flowchart of a test case generation method in an embodiment;
[0025] Figure 2 Schematic flowchart of a method for determining attribute information of test parameters of a target network application programming interface in an embodiment;
[0026] Figure 3 Schematic flowchart of a method for determining a target predicate corresponding to test parameters based on a preset matching rule and attribute information in an embodiment;
[0027] Figure 4 Schematic flowchart of a method in the case where the support degree of a candidate predicate is less than or equal to a preset threshold in an embodiment;
[0028] Figure 5 Schematic flowchart of a method for determining test cases of a target network application programming interface based on query results in an embodiment;
[0029] Figure 6 Schematic flowchart of a test case generation method in another embodiment;
[0030] Figure 7 Block diagram of the structure of a test case generation device in an embodiment;
[0031] Figure 8 Internal structure diagram of a computer device in an embodiment;
[0032] Figure 9 Internal structure diagram of a computer device in another embodiment;
[0033] Figure 10 Schematic diagram of a tree structure in an embodiment. Detailed implementation manners
[0034] In order to make the objectives, technical solutions and advantages of the present application clearer and more understandable, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0035] In the current rapid development of digital technology, as a bridge for data interaction and function call between different software systems, the performance of network application programming interfaces directly affects the efficiency and stability of data transmission between systems. Test cases of network application programming interfaces play a key role in ensuring the performance of network application programming interfaces, and can be used to test the functional integrity, data accuracy, performance, security, and compatibility of network application programming interfaces.
[0036] In the prior art, most test cases for network application programming interfaces are manually generated by technicians.
[0037] However, this method of manually generating test cases for network application interfaces by technical personnel results in relatively low efficiency in generating test cases.
[0038] In view of this, the present application provides a test case generation method, which can automatically generate test cases for network application interfaces based on the specification information of the target network application interface. Compared with the prior art in which technical personnel need to manually generate test cases for network application interfaces, the efficiency of generating test cases for network application interfaces is effectively improved.
[0039] The test case generation method provided by the present application may have a computer device as its execution subject, and this computer device may be a terminal or a server.
[0040] In an exemplary embodiment, as Figure 1 shown, a test case generation method is provided, and this method includes the following steps:
[0041] Step 101: Determine the attribute information of the test parameters of the target network application interface according to the specification information of the target network application interface.
[0042] Optionally, the target network application interface refers to a network application interface used for testing based on the to-be-generated test cases. This network application interface (Web API, Web Application Programming Interface) refers to an interface that enables communication between different software systems through the HTTP / HTTPS protocol. Exemplarily, this network application interface can implement storage services, message services, computing services, etc.
[0043] The specification information may be the OpenAPI specification (OAS, OpenAPI Specification), and this OpenAPI specification is a set of standardized API description languages that can be used to define, describe, and record the target network application interface. Specifically, the OpenAPI specification can describe the endpoints, request methods, parameters, data models, authentication mechanisms, etc. of the target network application interface through a structured file.
[0044] Optionally, the attribute information of the test parameters refers to a kind of metadata used to describe the detailed features and constraints of the parameters in the target network application interface.
[0045] Exemplarily, the attribute information may include identification - type attribute information, description - type attribute information, data - type and format - constraint - type attribute information, and syntax and numerical - constraint - type attribute information. Among them, the identification - type attribute information may include a parameter name and a parameter position. The description - type attribute information may be used to describe the function of the parameter. The data - type and format - constraint - type attribute information may be used to indicate the allowed data types and formats of the parameter. The syntax and numerical - constraint - type attribute information may include a regular expression, a maximum value, and a minimum value.
[0046] In some exemplary embodiments, the computer device may first obtain the specification information of the target network application programming interface.
[0047] Further, after obtaining the specification information of the target network application programming interface, the computer device may input the specification information of the target network application programming interface into a pre - trained specification information analysis model to obtain the parsing result of the specification information of the target network application programming interface output by the specification information analysis model.
[0048] Further, the attribute information of the test parameters of the target network application programming interface may be determined according to the parsing result. The parsing result may also be directly determined as the attribute information of the test parameters of the target network application programming interface.
[0049] Step 102: Obtain a preset matching rule, and determine a target predicate corresponding to the test parameter based on the preset matching rule and the attribute information.
[0050] Optionally, the preset matching rule may be pre - set by a technician according to actual needs. The prediction matching rule may be used to determine the attributes or conditions related to the test parameter. The predicate is used to describe the relationship or attributes between test parameters. Specifically, the target predicate may be used to describe the conditions or constraints that the test parameter needs to meet.
[0051] In some exemplary embodiments, after determining the attribute information of the test parameters of the target network application programming interface, the computer device may obtain a preset matching rule.
[0052] Further, after obtaining the preset matching rule, the computer device may determine a target predicate corresponding to the test parameter based on the preset matching rule and the attribute information.
[0053] Specifically, the computer device may input the preset matching rule and the attribute information into a pre - trained target - predicate determination model to obtain the target predicate corresponding to the test parameter output by the target - predicate determination model.
[0054] Step 103: Construct a query task based on the target predicate, and when the query result of the query task meets the preset conditions, determine the test cases for the target network application programming interface based on the query result.
[0055] Optionally, the preset conditions can be pre-set by technicians according to actual needs.
[0056] In some exemplary embodiments, after obtaining the target predicate, the computer device can first construct a query task based on the target predicate.
[0057] Furthermore, after constructing the query task according to the target predicate, the computer device can execute the query task to obtain the query result of the query task, and when the query result meets the preset conditions, determine the test cases for the target network application programming interface based on the query result.
[0058] The above test case generation method first determines the attribute information of the test parameters of the target network application programming interface according to the specification information of the target network application programming interface; then obtains the preset matching rule, and determines the target predicate corresponding to the test parameter based on the preset matching rule and the attribute information; finally, constructs a query task according to the target predicate, and when the query result of the query task meets the preset conditions, determines the test cases for the target network application programming interface based on the query result. The test case generation method provided in this application can automatically generate test cases for network application programming interfaces through the specification information of the target network application programming interface. Compared with the prior art where technicians need to manually generate test cases for network application programming interfaces, the efficiency of generating test cases for network application programming interfaces is effectively improved.
[0059] In an exemplary embodiment, as Figure 2 shown, determining the attribute information of the test parameters of the target network application programming interface according to the specification information of the target network application programming interface includes the following steps:
[0060] Step 201: Based on the ARTE algorithm, obtain the name of the test parameter of the target network application programming interface and the description information of the test parameter from the specification information of the target network application programming interface.
[0061] Step 202: Determine the name and the description information as the attribute information of the test parameter.
[0062] ARTE (Automated Generation of Realistic Test Inputs for Web APIs) refers to an automated test input generation technology for network application programming interfaces.
[0063] In some exemplary embodiments, after obtaining the specification information of the target network application interface, the computer device may, based on the ARTE algorithm, obtain the name of the test parameter of the target network application interface and the description information of the test parameter from the specification information of the target network application interface, and determine the name and the description information as the attribute information of the test parameter.
[0064] Specifically, since the ARTE algorithm needs to meet two conditions: syntactically valid and semantically valid, the computer device can use the specification information through the ARTE algorithm to search for syntactic and semantic test data in the DBpedia knowledge base. Among them, syntactically valid means that the input test parameter must conform to the format and structure expected by the target network application interface.
[0065] For example, if the target network application interface expects a date field, then the value of this field must be in a valid date format. If the target network application interface expects an integer, then the input cannot contain non-numeric characters. This kind of verification is usually based on the documentation or schema definition of the target network application interface.
[0066] Semantically valid means that the input test parameter is valid in terms of logic or business meaning, that is, the test parameter should represent a valid entity or concept in the real world and conform to the business rules of the data processed by the target network application interface. For example, if the target network application interface is used to query the weather of a certain city, then the city name must be an actual existing city name, rather than a fictional or misspelled name. This kind of verification can rely on external data sources or business logic rules.
[0067] In an alternative embodiment, the computer device can also generate different types of test inputs according to the test case generation requirements through the ARTE algorithm, such as normal inputs, boundary inputs, abnormal inputs, etc., to cover various usage scenarios and potential problems of the target network application interface.
[0068] Furthermore, in order to generate regular expressions, the test parameters must be marked as valid or invalid. Specifically, if the test parameter value appears in the target network application interface call with a successful response, it is classified as valid. If the test parameter value appears in the target network application interface call with a "client error" response and meets any of the following conditions, it is classified as invalid: (1) It is the only parameter used in the target network application interface call; (2) It is used together with other test parameter values that have been classified as valid. Test parameter values that do not meet any of the above constraints are marked as unclassified and ignored when inferring regular expressions.
[0069] In an exemplary embodiment, as Figure 3 shown, the preset matching rule includes a plurality of sub-rules, the sub-rule includes a matching condition and a keyword determination strategy, and determining a target predicate corresponding to the test parameter based on the preset matching rule and the attribute information includes the following steps:
[0070] Step 301, when the name and the description information meet the matching condition of the first sub-rule with the highest priority among the plurality of sub-rules, determine a keyword according to the keyword determination strategy of the first sub-rule.
[0071] Exemplarily, the plurality of sub-rules are respectively a first sub-rule, a second sub-rule, a third sub-rule, a fourth sub-rule, a fifth sub-rule, and a sixth sub-rule, and the priorities among the first sub-rule, the second sub-rule, the third sub-rule, the fourth sub-rule, the fifth sub-rule, and the sixth sub-rule are in descending order.
[0072] Among them, the matching condition of the first sub-rule is: the name appears in the description information, and there are two words, "code" or "id", after the name. The keyword determination strategy of the first sub-rule is: connect these two words with the name. For example, if the name is country and the description information is "A valid country code", then the first sub-rule is matched, and the determined keyword is "countryCode".
[0073] The matching condition of the second sub-rule is: there is a word K with the same first character as the name in the description information, and there is "code" or "id" after the word K. The keyword determination strategy of the second sub-rule is: connect the name and K with "code" or "id". For example, if the name is lang and the description information is "A language code", the determined keywords are langCode and languageCode.
[0074] The matching condition of the third sub-rule is: there are nouns or unknown words in the description information, such as abbreviations or non-English words, and there is "code" or "id" after the nouns or unknown words. The keyword determination strategy of the third sub-rule is: connect the nouns or unknown words with "code" or "id". If multiple keywords are determined, they are selected in the order of appearance. For example, if the name is origin and the description information is "A valid country code or airport code", the determined keywords are countryCode and airportCode.
[0075] The matching condition of the fourth sub-rule is: unconditional. The keyword determination strategy of the fourth sub-rule is: determine the unmodified name as the keyword.
[0076] The matching condition of the fifth sub-rule is that the name is in snake case or kebab case. The keyword determination strategy of the fifth sub-rule is to convert the name to camel case and determine it as the keyword.
[0077] The matching condition of the sixth sub-rule is that the name is in snake case, kebab case or camel case. The keyword determination strategy of the sixth sub-rule is to split the name into multiple words and determine each word as the keyword.
[0078] In some exemplary embodiments, after obtaining the attribute information of the test parameter and the preset matching rules, the computer device can first determine whether the name and description information in the attribute information of the test parameter meet the matching condition of the first sub-rule with the highest priority among the multiple sub-rules. If so, the keyword is determined according to the keyword determination strategy of the first sub-rule.
[0079] Further, if not, it can then determine whether the name and description information in the attribute information of the test parameter meet the matching condition of the second sub-rule with a priority lower than that of the first sub-rule among the multiple sub-rules. If so, the keyword is determined according to the keyword determination strategy of the second sub-rule.
[0080] If not, it is matched with the matching condition of the third sub-rule according to the above scheme until the name and description information in the attribute information of the test parameter meet one of the multiple sub-rules.
[0081] Step 302: Construct a SPARQL query statement based on the keyword and search in the preset database based on the SPARQL query statement to obtain candidate predicates.
[0082] Optionally, the SPARQL (SPARQL Protocol and RDF Query Language) is a standard query language for querying Semantic Web data. Exemplarily, the SPARQL is used to execute queries on a dataset represented in the form of RDF (Resource Description Framework) triples. And the preset database is composed of RDF graphs, which are formed by linking triples from various sources and can be searched using SPARQL query statements.
[0083] Optionally, the preset database may be the DBpedia database. The information in the DBpedia database is structured information, including but not limited to people, places, organizations, events, etc. The DBpedia database can convert this information into the form of RDF triples to form a large multi-domain RDF dataset. RDF is a standard data model for representing information on web applications, allowing the structuring and interoperability of information.
[0084] In some exemplary embodiments, after determining the keywords, for each keyword, a SPARQL query statement can be constructed, and the SPARQL query statement can be expressed as:
[0085]
[0086]
[0087]
[0088] ;
[0089] The SPARQL query statement corresponding to the keyword can be obtained by replacing the string "keyword" in the above SPARQL query statement with the keyword. This SPARQL query statement can be used to search for candidate predicates containing the keyword and filtered by regular expressions, where "i" means "case-insensitive".
[0090] Step 303: Determine the support degree of the candidate predicate, and in the case where the support degree of the candidate predicate is greater than the preset threshold, determine the candidate predicate as the target predicate.
[0091] Optionally, the support degree of a candidate predicate refers to the number of unique RDF triples containing the candidate predicate. The preset threshold can be set in advance by those skilled in the art according to actual needs.
[0092] In some exemplary embodiments, the computer device can sort the candidate predicates in ascending order of length, and each candidate predicate contains the exact keyword. The computer device can select the first n candidate predicates returned by the query through the ARTE algorithm and calculate the support degree of each candidate predicate.
[0093] Furthermore, the computer device can determine the candidate predicate as the target predicate in the case where the support degree of the candidate predicate is greater than the preset threshold.
[0094] It should be noted that, as described above, the preset matching rules include multiple sub-rules. After determining a keyword through a certain sub-rule based on the name and description information, the keyword can be used to search for candidate predicates. If the target predicate can be determined according to the candidate predicates, the search for this test parameter ends, and the search for the next test parameter is carried out. If the target predicate is not determined according to the candidate predicates, new keywords are determined based on the name and description information through the next sub-rule.
[0095] In an exemplary embodiment, as Figure 4 shown, when the support degree of the candidate predicate is less than or equal to the preset threshold, the method further includes the following steps:
[0096] Step 401: Determine whether the name and the description information meet the matching conditions of the second sub-rule.
[0097] Wherein, the priority of the second sub-rule is lower than that of the first sub-rule and higher than that of the sub-rules other than the first sub-rule among the multiple sub-rules.
[0098] In some exemplary embodiments, when the support degree of the candidate predicate of the computer device is less than or equal to the preset threshold, it can also be determined whether the name and the description information meet the matching conditions of the second sub-rule.
[0099] Step 402: If it is satisfied, determine new keywords according to the keyword determination strategy of the second sub-rule, and construct a new SPARQL query statement according to the new keywords.
[0100] In some exemplary embodiments, if the name and the description information meet the matching conditions of the second sub-rule, new keywords can be determined according to the keyword determination strategy of the second sub-rule, and a new SPARQL query statement can be constructed according to the new keywords.
[0101] Further, if the name and the description information do not meet the matching conditions of the second sub-rule, it can be determined whether the name and the description information meet the matching conditions of the second sub-rule. If it is satisfied, new keywords can be determined according to the keyword determination strategy of the third sub-rule, and a new SPARQL query statement can be constructed according to the new keywords. If not, continue to determine whether the name and the description information meet the matching conditions of the next sub-rule until new keywords are determined, and a new SPARQL query statement is constructed according to the keywords.
[0102] Step 403: Search in the preset database based on the new SPARQL query statement to obtain new candidate predicates, and when the support degree of the new candidate predicates is greater than the preset threshold, determine the new candidate predicates as the target predicates.
[0103] In some exemplary embodiments, after constructing a new SPARQL query statement according to a new keyword, the computer device may search in the preset database based on the new SPARQL query statement to obtain new candidate predicates.
[0104] Further, after obtaining the new candidate predicates, the computer device may determine the support degree of the new candidate predicates, and in the case where the support degree of the new candidate predicates is greater than the preset threshold, determine the new candidate predicates as the target predicates.
[0105] In one exemplary embodiment, as Figure 5 shown, constructing a query task according to the target predicate, and in the case where the query result of the query task meets the preset conditions, determining a test case for the target network application interface based on the query result includes the following steps:
[0106] Step 501: Construct the query task by combining the target predicates, and execute the query task based on the preset database.
[0107] Step 502: Obtain the query result of the query task.
[0108] Wherein, the query result includes matching items of each of the target predicates for constructing the query task.
[0109] Step 503: In the case where the matching items of each of the target predicates are all greater than the preset matching item quantity threshold, determine the combination of the matching items of each of the target predicates as the test case.
[0110] Optionally, the query task may be a SPARQL query.
[0111] In some exemplary embodiments, the computer device may combine the target predicates to form a query task, and execute the query task based on the preset database.
[0112] For example, the query task may be expressed as:
[0113]
[0114]
[0115]
[0116]
[0117] ;
[0118] The test parameters targeted by this query task are title, director, and langCode.
[0119] Further, after executing this query task based on the DBpedia database, the query result of the query task is obtained. And when the number of matching items of each of these target predicates is greater than the preset matching item quantity threshold, the combination of the matching items of each of these target predicates is determined as this test case. This preset matching item quantity threshold can be pre-set by technicians according to actual needs.
[0120] Specifically, assume that the preset matching item quantity threshold is 100. If in the query result, the number of matching items of title is 150, the number of matching items of director is 120, and the number of matching items of langCode is 130, all of which are greater than the preset matching item quantity threshold, then the combination of these matching items can be determined as this test case.
[0121] In an exemplary embodiment, when the number of matching items of each of these target predicates is less than the preset matching item quantity threshold, this method further includes: performing an adjustment process on this query task.
[0122] Wherein, this adjustment process includes reducing the number of target predicates used to construct this query task.
[0123] In some exemplary embodiments, when the number of matching items of each of these target predicates is less than the preset matching item quantity threshold, the computer device can perform an adjustment process on this query task, that is, it includes reducing the number of target predicates used to construct this query task.
[0124] Specifically, the computer device can compare the number of matching items of each target predicate with the preset threshold one by one, and filter out the predicates with insufficient quantities. For example, if among the three predicates of title, director, and langCode, the number of matching items of title and director are both less than the threshold, and the number of matching items of langCode meets the standard, then title and director are listed as the objects to be reduced.
[0125] To ensure that valuable test inputs can still be obtained after reduction, it is necessary to give priority to reducing the predicates that have less impact on the overall semantics. In the above example, if langCode is the least important parameter, then it can be preferentially reduced, and only title and director are retained to construct a new query task.
[0126] Further, after adjusting the query task, the computer device can recombine the remaining target predicates to generate a new query task. For example, after deleting langCode, the new SPARQL query task will be used to search for entities that contain both title and director, and its query statement will be adjusted accordingly.
[0127] If the result of the adjusted query task still does not meet the threshold requirement, the computer device will repeat the above steps and continue to delete other target predicates until the number of predicate matching items meets the standard or no further deletion is possible.
[0128] In an optional embodiment of the present application, as described above, since the ARTE algorithm needs to meet two conditions: being syntactically valid and semantically valid, the computer device can use the ARTE algorithm to utilize the canonical information to search for syntactic and semantic test data in the DBpedia knowledge base, where semantic search can be implemented through the RC-BERT model that combines RoBERTa and CodeBERT.
[0129] Specifically, the BERT model is essentially a bidirectional encoder based on Transformer. BERT can be applied to any network application interface that exposes its functions through URI and HTTP and uses a hierarchically organized parameter document for data exchange. The Transformer architecture consists of an encoder that converts the input text into a context vector and a decoder that converts the context vector into output text. Although the Seq2Seq model relies on recurrent neural networks, Transformer only uses a stack of pointwise, fully connected layers with self-attention mechanisms.
[0130] Compared with the original Transformer architecture, BERT only contains one encoder that takes the numerical representation of the text as input and calculates the context vector. This context vector must be interpreted according to individual pre-training or downstream tasks. The BERT model combines two self-supervised tasks during pre-training, namely masked language modeling (MLM) and next sentence prediction (NSP). By taking a pair of sentences, i.e., sequences of tokens, as input, BERT must predict whether the second sentence logically follows the first sentence, while in the MLM task, it predicts the tokens removed from the two sentences. In 50% of the training samples, the second sentence actually follows the first sentence. In the other 50%, the second sentence is randomly selected. Additionally, 15% of all tokens in the two sentences are randomly replaced with a special [MASK] token or a random token, and the two sentences are separated by a special separator token [SEP]. Moreover, the entire sequence starts with a classification token [CLS] and ends with a sequence end token [EOS].
[0131] CodeBERT is a model optimized for source code-related NLP tasks. The goal of CodeBERT is to capture the semantic connections between the two language domains of natural language and programming language, and provide a model that can be used for different natural language and programming language-related tasks, such as code search and code documentation generation.
[0132] The goal of the BERT model fine-tuned by combining CodeBERT and RoBERTa is to extract network application interface elements from a set of elements, whose syntactic appearance matches the semantics described in the natural language query. As Figure 10 shown Figure 10 It shows the serialization of the hierarchical payload architecture (a) and the uniform resource identifier model (b) into a parameter list (c) and an endpoint path list (d) respectively. The payload architecture of a JSON or XML document can be described by a tree structure composed of nodes, where the labels of the nodes are the syntactic names of the corresponding attributes. Internal nodes represent objects or arrays, while leaf nodes are parameters. Similarly, the endpoints of a network application interface usually rely on a hierarchical URI model, whose path and operations can be described by a tree structure: internal nodes represent path segments, while leaf nodes are operations in the form of HTTP verbs. In both cases, the network application interface elements, i.e., parameters or endpoints, are uniquely identified by naming all the nodes from the root of the tree to the corresponding leaf node.
[0133] Further, by extracting all web application interface elements and their paths to serialize a syntax tree structure, each element pointing to either a parameter or an endpoint path is converted to an XPath-like notation. Additionally, a [*] tag is added after all attributes representing arrays in the parameter path. Similarly, curly braces, i.e., {...}, are used to indicate URI parameters in the endpoint path. The result is a linear list of paths, which enables each possible answer to form a continuous text span, satisfying the continuous span constraint. The model needs to select an answer by naming the path of the target web application interface element. Sorting the list of paths alphabetically places Web API elements under the same parent node relatively close in the generated list of paths, helping the model infer the hierarchical relationship from the generated linear text.
[0134] In addition to the beneficial effects described above, the ARTE algorithm in this application also introduces a regular expression automatic inference mechanism, which can automatically learn and refine the regular expression patterns of test parameters applicable to each web application interface based on the generated test parameters. These regular expressions not only improve the efficiency and accuracy of subsequent test case generation but also enhance the ability to identify exceptions and boundary conditions.
[0135] Further, to enhance the flexibility and depth of queries, by combining the SPARQL query language, the SPARQL query is deeply integrated with the database to directly perform in-depth queries on the database, such as DBpedia and Wikidata. The SPARQL query language, designed for RDF (Resource Description Framework) data, can precisely express complex query requirements, enabling more accurate, relevant, and business-logic-compliant test cases to be retrieved from the database.
[0136] Moreover, the combination of ARTE and BERT can enhance the characteristics in specific tasks. ARTE is optimized for search query tasks, and the combination of the two can enhance the generalization ability of the model in different fields and tasks, enabling more factors to be considered when processing text and thus making more accurate judgments. ARTE supports dynamically adjusting and optimizing the RC-BERT model during the test process. According to the newly generated test inputs and feedback results, the model parameters are continuously optimized to ensure that the model always remains in the best state, providing strong support for web application interface testing.
[0137] In an exemplary embodiment, as Figure 6 shown, another test case generation method is provided, and this method includes the following steps:
[0138] Step 601: Based on the ARTE algorithm, obtain the name of the test parameter of the target network application interface and the description information of the test parameter from the specification information of the target network application interface; determine the name and the description information as the attribute information of the test parameter;
[0139] Step 602: Obtain a preset matching rule, where the preset matching rule includes multiple sub-rules, and the sub-rule includes a matching condition and a keyword determination strategy; when the name and the description information meet the matching condition of the first sub-rule with the highest priority among the multiple sub-rules, determine the keyword according to the keyword determination strategy of the first sub-rule; construct a SPARQL query statement based on the keyword, and perform a search in a preset database based on the SPARQL query statement to obtain candidate predicates; determine the support degree of the candidate predicates, and when the support degree of the candidate predicates is greater than a preset threshold, determine the candidate predicates as the target predicates;
[0140] Step 603: When the support degree of the candidate predicates is less than or equal to the preset threshold, determine whether the name and the description information meet the matching condition of the second sub-rule, where the priority of the second sub-rule is lower than that of the first sub-rule and higher than that of the sub-rules other than the first sub-rule among the multiple sub-rules; if so, determine a new keyword according to the keyword determination strategy of the second sub-rule, and construct a new SPARQL query statement based on the new keyword; perform a search in the preset database based on the new SPARQL query statement to obtain new candidate predicates, and when the support degree of the new candidate predicates is greater than the preset threshold, determine the new candidate predicates as the target predicates;
[0141] Step 604: Construct the query task by combining the target predicates, and execute the query task based on a preset database; obtain the query result of the query task, where the query result includes the matching items of each target predicate for constructing the query task; when the matching items of each target predicate are all greater than a preset matching item quantity threshold, determine the combination of the matching items of each target predicate as the test case;
[0142] Step 605: When there are matching items of each target predicate that are less than the preset matching item quantity threshold, perform adjustment processing on the query task; where the adjustment processing includes reducing the number of target predicates used to construct the query task.
[0143] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are shown in sequence according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear indication in this article, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or steps or stages in other steps.
[0144] Based on the same inventive concept, an embodiment of the present application also provides a test case generation device for implementing the above-mentioned test case generation method. The solution provided by this device to solve the problem is similar to the solution described in the above method. Therefore, the specific limitations in one or more embodiments of the test case generation device provided below can refer to the limitations on the test case generation method in the above text, and will not be repeated here.
[0145] In an exemplary embodiment, as Figure 7 shown, a test case generation device 700 is provided, including: a determination module 701, an acquisition module 702, and an execution module 703, where:
[0146] The determination module 701 is configured to determine the attribute information of the test parameters of the target network application programming interface according to the specification information of the target network application programming interface;
[0147] The acquisition module 702 is configured to acquire a preset matching rule, and determine a target predicate corresponding to the test parameter based on the preset matching rule and the attribute information;
[0148] The execution module 703 is configured to construct a query task according to the target predicate, and determine a test case of the target network application programming interface based on the query result when the query result of the query task meets a preset condition.
[0149] In one embodiment, the determination module 701 is specifically configured to obtain the name of the test parameter of the target network application programming interface and the description information of the test parameter from the specification information of the target network application programming interface based on the ARTE algorithm; and determine the name and the description information as the attribute information of the test parameter.
[0150] In one embodiment, the preset matching rule includes a plurality of sub-rules, and each sub-rule includes a matching condition and a keyword determination strategy. The obtaining module 702 is specifically configured to, when the name and the description information meet the matching condition of the first sub-rule with the highest priority among the plurality of sub-rules, determine a keyword according to the keyword determination strategy of the first sub-rule; construct a SPARQL query statement based on the keyword, and perform a search in a preset database based on the SPARQL query statement to obtain candidate predicates; determine the support degree of the candidate predicates, and when the support degree of the candidate predicates is greater than a preset threshold, determine the candidate predicates as the target predicates.
[0151] In one embodiment, the obtaining module 702 is further configured to, when the support degree of the candidate predicates is less than or equal to the preset threshold, determine whether the name and the description information meet the matching condition of a second sub-rule, where the priority of the second sub-rule is lower than that of the first sub-rule and higher than that of the sub-rules other than the first sub-rule among the plurality of sub-rules; if so, determine a new keyword according to the keyword determination strategy of the second sub-rule, and construct a new SPARQL query statement according to the new keyword; perform a search in the preset database based on the new SPARQL query statement to obtain new candidate predicates, and when the support degree of the new candidate predicates is greater than the preset threshold, determine the new candidate predicates as the target predicates.
[0152] In one embodiment, the execution module 703 is specifically configured to construct the query task by combining the target predicates, and execute the query task based on a preset database; obtain a query result of the query task, where the query result includes matching items of each of the target predicates for constructing the query task; when the matching items of each of the target predicates are all greater than a preset matching item quantity threshold, determine a combination of the matching items of each of the target predicates as the test case.
[0153] In one embodiment, the execution module 703 is further configured to, when there are matching items of each of the target predicates that are less than the preset matching item quantity threshold, perform an adjustment process on the query task; where the adjustment process includes reducing the quantity of target predicates used for constructing the query task.
[0154] Each module in the above test case generation device can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in a processor in a computer device in a hardware form or be independent of the processor, or can be stored in a memory in a computer device in a software form, so that the processor can call and execute operations corresponding to the above respective modules.
[0155] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be asFigure 8 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals through a network connection. When the computer program is executed by the processor, it implements a test case generation method.
[0156] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as Figure 9 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface, the display unit, and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals in a wired or wireless manner. The wireless manner can be achieved through WIFI, a mobile cellular network, near field communication (Near Field Communication, NFC), or other technologies. When the computer program is executed by the processor, it implements a test case generation method. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covering the display screen, or a button, a trackball, or a touchpad provided on the housing of the computer device, or an external keyboard, touchpad, or mouse, etc.
[0157] Those skilled in the art can understand, Figure 8 and Figure 9The structure shown is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0158] In an exemplary embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory. When the processor executes the computer program, the following steps are implemented:
[0159] According to the specification information of the target network application interface, determine the attribute information of the test parameters of the target network application interface;
[0160] Obtain a preset matching rule, and based on the preset matching rule and the attribute information, determine the target predicate corresponding to the test parameter;
[0161] Construct a query task according to the target predicate, and when the query result of the query task meets the preset conditions, determine the test case of the target network application interface based on the query result.
[0162] In one embodiment, when the processor executes the computer program, the following steps are further implemented: Based on the ARTE algorithm, obtain the name of the test parameter of the target network application interface and the description information of the test parameter from the specification information of the target network application interface; Determine the name and the description information as the attribute information of the test parameter.
[0163] In one embodiment, when the processor executes the computer program, the following steps are further implemented: When the name and the description information meet the matching conditions of the first sub-rule with the highest priority among the multiple sub-rules, determine the keyword according to the keyword determination strategy of the first sub-rule; Construct a SPARQL query statement according to the keyword, and search in a preset database based on the SPARQL query statement to obtain candidate predicates; Determine the support degree of the candidate predicates, and when the support degree of the candidate predicates is greater than a preset threshold, determine the candidate predicates as the target predicates.
[0164] In one embodiment, when the processor executes the computer program, the following steps are further implemented: when the support degree of the candidate predicate is less than or equal to a preset threshold, determine whether the name and the description information satisfy the matching conditions of the second sub-rule, where the priority of the second sub-rule is lower than that of the first sub-rule and higher than that of the sub-rules other than the first sub-rule among the multiple sub-rules; if satisfied, determine new keywords according to the keyword determination strategy of the second sub-rule, and construct a new SPARQL query statement according to the new keywords; search in the preset database based on the new SPARQL query statement to obtain new candidate predicates, and when the support degree of the new candidate predicates is greater than the preset threshold, determine the new candidate predicates as the target predicates.
[0165] In one embodiment, when the processor executes the computer program, the following steps are further implemented: construct the query task by combining the target predicates, and execute the query task based on the preset database; obtain the query result of the query task, where the query result includes the matching items of each target predicate for constructing the query task; when the matching items of each target predicate are all greater than the preset matching item quantity threshold, determine the combination of the matching items of each target predicate as the test case.
[0166] In one embodiment, when the processor executes the computer program, the following steps are further implemented: when there are matching items of each target predicate that are less than the preset matching item quantity threshold, perform adjustment processing on the query task; where the adjustment processing includes reducing the quantity of target predicates used to construct the query task.
[0167] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0168] According to the specification information of the target network application interface, determine the attribute information of the test parameters of the target network application interface;
[0169] Obtain a preset matching rule, and determine the target predicate corresponding to the test parameter based on the preset matching rule and the attribute information;
[0170] Construct a query task according to the target predicate, and when the query result of the query task meets the preset conditions, determine the test case of the target network application interface based on the query result.
[0171] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: based on the ARTE algorithm, obtain the name of the test parameter of the target network application interface and the description information of the test parameter from the specification information of the target network application interface; determine the name and the description information as the attribute information of the test parameter.
[0172] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented: when the name and the description information meet the matching conditions of the first sub-rule with the highest priority among the multiple sub-rules, determine the policy determination keyword according to the keyword of the first sub-rule; construct a SPARQL query statement according to the keyword, and search in a preset database based on the SPARQL query statement to obtain candidate predicates; determine the support degree of the candidate predicates, and when the support degree of the candidate predicates is greater than a preset threshold, determine the candidate predicates as the target predicates.
[0173] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented: when the support degree of the candidate predicates is less than or equal to the preset threshold, determine whether the name and the description information meet the matching conditions of the second sub-rule, the priority of the second sub-rule is lower than that of the first sub-rule and higher than that of the sub-rules other than the first sub-rule among the multiple sub-rules; if so, determine a new keyword according to the keyword determination policy of the second sub-rule, and construct a new SPARQL query statement according to the new keyword; search in the preset database based on the new SPARQL query statement to obtain new candidate predicates, and when the support degree of the new candidate predicates is greater than the preset threshold, determine the new candidate predicates as the target predicates.
[0174] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented: construct the query task by combining the target predicates, and execute the query task based on a preset database; obtain the query result of the query task, the query result includes the matching items of each target predicate for constructing the query task; when the matching items of each target predicate are all greater than a preset matching item quantity threshold, determine the combination of the matching items of each target predicate as the test case.
[0175] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented: when there are matching items of each target predicate that are less than the preset matching item quantity threshold, perform adjustment processing on the query task; wherein, the adjustment processing includes reducing the quantity of target predicates used for constructing the query task.
[0176] In one embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0177] According to the specification information of the target network application interface, determine the attribute information of the test parameters of the target network application interface;
[0178] Obtain a preset matching rule, and determine a target predicate corresponding to the test parameter based on the preset matching rule and the attribute information;
[0179] Construct a query task according to the target predicate, and when the query result of the query task meets the preset conditions, determine the test case of the target network application interface based on the query result.
[0180] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented: obtain the name of the test parameter of the target network application interface and the description information of the test parameter from the specification information of the target network application interface based on the ARTE algorithm; determine the name and the description information as the attribute information of the test parameter.
[0181] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented: when the name and the description information meet the matching conditions of the first sub-rule with the highest priority among the multiple sub-rules, determine a keyword according to the keyword determination strategy of the first sub-rule; construct a SPARQL query statement according to the keyword, and search in a preset database based on the SPARQL query statement to obtain candidate predicates; determine the support degree of the candidate predicates, and when the support degree of the candidate predicates is greater than a preset threshold, determine the candidate predicates as the target predicates.
[0182] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented: when the support degree of the candidate predicates is less than or equal to the preset threshold, determine whether the name and the description information meet the matching conditions of the second sub-rule, the priority of the second sub-rule is lower than that of the first sub-rule and higher than that of the sub-rules other than the first sub-rule among the multiple sub-rules; if so, determine a new keyword according to the keyword determination strategy of the second sub-rule, and construct a new SPARQL query statement according to the new keyword; search in the preset database based on the new SPARQL query statement to obtain new candidate predicates, and when the support degree of the new candidate predicates is greater than the preset threshold, determine the new candidate predicates as the target predicates.
[0183] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented: construct the query task by combining the target predicates, and execute the query task based on a preset database; obtain the query result of the query task, the query result includes the matching items of each target predicate for constructing the query task; when the matching items of each target predicate are all greater than a preset matching item quantity threshold, determine the combination of the matching items of each target predicate as the test case.
[0184] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented: when the number of matches of each target predicate is less than the preset match number threshold, perform adjustment processing on the query task; wherein, the adjustment processing includes reducing the number of target predicates used to construct the query task.
[0185] Those of ordinary skill in the art can understand that all or part of the processes of implementing the methods in the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in this application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in this application can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, data processing logics based on quantum computing, artificial intelligence (AI) processors, etc., without limitation.
[0186] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this application.
[0187] The above-described embodiments merely represent several implementation manners of this application. The description is relatively specific and detailed, but it should not be construed as a limitation on the patent scope of this application. It should be noted that for those of ordinary skill in the art, without departing from the concept of this application, several modifications and improvements can still be made, and these all belong to the protection scope of this application. Therefore, the protection scope of this application shall be subject to the appended claims.
Claims
1. A test case generation method, characterized in that, The method includes: Determine the attribute information of the test parameters of the target network application programming interface according to the specification information of the target network application programming interface; Obtain a preset matching rule, and determine a target predicate corresponding to the test parameter based on the preset matching rule and the attribute information; Construct a query task according to the target predicate, and determine a test case for the target network application programming interface based on the query result when the query result of the query task meets a preset condition.
2. The method according to claim 1, wherein The determining the attribute information of the test parameters of the target network application programming interface according to the specification information of the target network application programming interface includes: Based on the ARTE algorithm, obtain the name of the test parameter of the target network application programming interface and the description information of the test parameter from the specification information of the target network application programming interface; Determine the name and the description information as the attribute information of the test parameter.
3. The method according to claim 2, wherein The preset matching rule includes a plurality of sub-rules, and the sub-rule includes a matching condition and a keyword determination strategy. The determining a target predicate corresponding to the test parameter based on the preset matching rule and the attribute information includes: When the name and the description information meet the matching condition of the first sub-rule with the highest priority among the plurality of sub-rules, determine a keyword according to the keyword determination strategy of the first sub-rule; Construct a SPARQL query statement according to the keyword, and search in a preset database based on the SPARQL query statement to obtain candidate predicates; Determine the support degree of the candidate predicate, and when the support degree of the candidate predicate is greater than a preset threshold, determine the candidate predicate as the target predicate.
4. The method according to claim 3, wherein The method further includes: When the support degree of the candidate predicate is less than or equal to the preset threshold, determine whether the name and the description information meet the matching condition of a second sub-rule, where the priority of the second sub-rule is lower than that of the first sub-rule and higher than that of the sub-rules other than the first sub-rule among the plurality of sub-rules; If it is satisfied, determine a new keyword according to the keyword determination strategy of the second sub-rule, and construct a new SPARQL query statement according to the new keyword; Search in the preset database based on the new SPARQL query statement to obtain a new candidate predicate, and when the support degree of the new candidate predicate is greater than the preset threshold, determine the new candidate predicate as the target predicate.
5. The method according to claim 1, characterized in that, The constructing a query task according to the target predicate, and determining a test case for the target network application programming interface based on the query result when the query result of the query task meets a preset condition includes: Construct the query task by combining the target predicates, and execute the query task based on a preset database; Obtain the query result of the query task, where the query result includes matching items of the respective target predicates for constructing the query task; When the number of matches of each of the target predicates is greater than a preset match number threshold, determine the combination of the matches of each of the target predicates as the test case.
6. The method according to claim 5, characterized in that the method further comprises: When the number of matches of each of the target predicates is less than the preset match number threshold, perform adjustment processing on the query task; Wherein, the adjustment processing includes reducing the number of target predicates used to construct the query task.
7. A test case generation device, characterized in that The apparatus comprises: a determination module, configured to determine the attribute information of the test parameters of the target network application interface according to the specification information of the target network application interface; an acquisition module, configured to acquire a preset matching rule, and determine a target predicate corresponding to the test parameter based on the preset matching rule and the attribute information; an execution module, configured to construct a query task according to the target predicate, and when the query result of the query task meets a preset condition, determine a test case of the target network application interface based on the query result.
8. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 6 are implemented.