Automatic testing method and system based on data combination keyword driving

By combining data-driven and keyword-driven methods in automated testing, extracting and marking keyword information in automated use cases, the problem that existing automated testing methods are difficult to achieve flexible configuration and reuse of use cases is solved, and the flexibility and efficiency of testing are improved.

CN120104482APending Publication Date: 2025-06-06SHENZHEN TIANYUAN CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510168463.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-17
Publication Date
2025-06-06

AI Technical Summary

Technical Problem

The existing automation testing methods mainly use simple data-driven or keyword-driven, making it difficult to achieve flexible configuration and reuse of automation use cases, and the readability and maintainability of keyword-driven methods are poor.

Method used

Using an automated testing method based on data combined with keyword-driven, we can obtain and split the automated use case data and data code by receiving automated use case test requests, extract keyword information and tagging, and combine the advantages of data-driven and keyword-driven to achieve flexible configuration and multiplexing of test cases.

Benefits of technology

It improves the flexibility, maintainability, reusability, scalability and readability of automated testing, enhances the efficiency and quality of software testing, and reduces the maintenance workload of test scripts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120104482A_ABST
    Figure CN120104482A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of automatic testing, and discloses an automatic testing method and system based on data combination keyword driving. The automatic test method is applied to automatic test equipment and specifically comprises the following steps that S101, an automatic use case test request is received, and the automatic use case test request carries automatic use case data and an automatic use case data code; and S102, obtaining a content text and a data code of the automatic use case data, and inputting the automatic use case data and the data code into a preset content text recognition model and a code recognition model. According to the method, the test data can be easily modified and managed through the data driver, different keywords can be flexibly combined to create the test case through the keyword driver, different test requirements and changes can be better adapted through the combination of the data driver and the keyword driver, and meanwhile the test data and the test steps are separately managed, so that the test script is easier to maintain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of automated testing, and in particular to an automated testing method and system based on data combined with keyword-driven. Background Art

[0002] Automated testing is a popular technology in current software development. Most automated testing methods use pure data-driven methods or keyword-driven testing methods. Pure data-driven methods basically cannot achieve flexible configuration of automated use cases and reuse of automated use cases.

[0003] The readability and maintainability of the keyword-driven method are also quite difficult. Combining data-driven and keyword-driven can improve the flexibility, maintainability, reusability, scalability and readability of testing, thereby improving the efficiency and quality of software testing. Summary of the invention

[0004] The purpose of the present invention is to provide an automated testing method and system based on data combined with keyword-driven, which is used to solve the flexibility, maintainability, reusability, scalability and readability of automated testing, thereby improving the efficiency and quality of software testing. It aims to solve the problem that most automated testing methods in the prior art use simple data-driven methods or keyword-driven testing methods, and simple data-driven methods basically cannot achieve flexible configuration of automated use cases and reuse of automated use cases.

[0005] The present invention is implemented in this way: an automated testing method based on data combined with keyword-driven is applied to automated testing equipment, specifically comprising the following steps:

[0006] S101: receiving an automated case test request, wherein the automated case test request carries automated case data and the automated case data code;

[0007] S102: Obtain the content text and data code of the automation use case data, and input the automation use case data and data code into a preset content text recognition model and a code recognition model;

[0008] S103: Obtain recognition results output by the content text recognition model and the code recognition model based on the automation use case data and the data code, and complete the automation use case data and code splitting and association in the recognition results;

[0009] S104: Acquire automation use case data, code splitting and associated data, extract keyword information and execution code corresponding to the keyword information in the automation use case data, and perform tag execution priority data parsing on the paired extracted keyword information, and transfer it to the data key-value pair and then store it in the cache;

[0010] S105: extract the marked priority execution data analysis, call the automated test case keywords and execute the automated test case content.

[0011] Further, in S101, receiving an automated use case test request includes:

[0012] Receiving a connection request sent by a user terminal through a preset network, wherein the connection request is used to request to establish a connection with the automated testing equipment;

[0013] Detecting whether the current account of the user terminal is the target account;

[0014] If the current account of the user terminal is the target account, a connection is made with the user terminal according to the connection request, and after the connection is completed, an automated use case test request is received.

[0015] Furthermore, the preset network includes one or a combination of wired broadband, 3G network, 4G network, 5G network, and WIFI network.

[0016] Furthermore, in S102, the automation use case data and the data code are input into a preset content text recognition model and a code recognition model, including:

[0017] Acquire multiple content text recognition models and code recognition models, and sort the multiple content text recognition models and code recognition models in order;

[0018] Acquire the content text of the automation use case data, and input the automation use case data into the content text recognition model ranked first;

[0019] The data code of the automation use case data is obtained, and the data code of the automation use case data is input into the code recognition model that is ranked first.

[0020] Further, in S103, in the recognition result, the automated use case data, code splitting and association are completed, including:

[0021] The automation use case data is sequentially split into three file levels;

[0022] The first file level is the test layer, which calls the step keyword as a test case. A test can call multiple step keywords.

[0023] The second file level is the step layer, which is used to store all test steps assembled by calling API keywords and generate keyword data of the steps. One step can call multiple API keywords.

[0024] The third level is the API file layer, which is used to store basic information and data of all API interfaces and generate keywords for a single API.

[0025] Further, in S104, keyword information and execution codes corresponding to the keyword information are extracted from the automation use case data, and the paired extracted keyword information is marked for execution priority data parsing, including:

[0026] The keyword information and the execution code corresponding to the keyword information in the extracted automation case data are converted into Ymal file format for storage, and data parsing is performed first when executing the test;

[0027] After executing test parsing, the YAML data is stored in the cache as a keyword plus data key-value pair, and the test function obtains the data through the key;

[0028] The extracted automated use case data is analyzed again, and based on the customized parsing function, the encapsulated http request method is called to implement the request and generate the test results.

[0029] Further, in S105, the marked priority execution data is extracted for parsing, the automated test case keywords are called and the automated test case contents are executed, including:

[0030] All automated use case data is stored in Ymal file format. All YAML files are read and converted to JSON format.

[0031] Parse and determine whether the step references the api keyword identifier. If not, skip the step of obtaining the value through the api key cache, call the automated test case keyword and execute the automated test case content.

[0032] Furthermore, the analysis determines whether the step references the api keyword identifier, including:

[0033] If there is a value obtained through the API key cache, the value obtained through the API key cache is written to the JSON data;

[0034] Then determine whether the step keyword identifier referenced by test exists. If so, get the keyword value in the cache through the step key keyword and fill it back into the json data. Then parse the step keyword referenced by test. If the identifier that references the step keyword exists in the json data, get the keyword value in the cache through the keyword and fill it back into the json data.

[0035] If the step keyword identifier referenced by test does not exist, the step key keyword is skipped and the value of the keyword in the cache is obtained.

[0036] Compared with the prior art, the data-based keyword-driven automated testing method and system provided by the present invention have the following beneficial effects:

[0037] 1. Data-driven makes it easy to modify and manage test data, while keyword-driven can flexibly combine different keywords to create test cases. Combining the two can better adapt to different test requirements and changes. At the same time, the test data and test steps are managed separately, making the test scripts easier to maintain. When the test data or test steps change, you only need to modify the corresponding data files or keywords without modifying a large number of test scripts.

[0038] 2. Keyword-driven test steps can be reused as an independent keyword library. Different test cases can perform the same operation by calling the same keyword. This can improve the reuse rate of test cases and reduce the workload of writing test scripts. By adding new keywords or extending data files, the functions of test scripts can be easily extended, which can better cope with new test requirements or changes. In addition, separating test data and test steps can make test scripts clearer and easier to read. Test scripts only contain keyword calls and parameter transfers, but not specific operation steps and data.

[0039] An automated testing system based on data combined with keyword-driven execution of the above-mentioned automated testing method, the automated testing system comprising:

[0040] A receiving module, used for receiving automated use case test requests;

[0041] An identification and association module is used to obtain the identification results of the automation use case data and data code output, and complete the automation use case data and code splitting and association in the identification results;

[0042] A primary parsing module, used to obtain automated use case data, code splitting and associated data, extract keyword information in the automated use case data and execution code corresponding to the keyword information;

[0043] A secondary parsing module is used to mark the paired extracted keyword information and the execution code corresponding to the keyword information after the primary parsing module completes the extraction of keyword information in the automation case data, perform data parsing with priority, transmit it to the data key-value pair and store it in the cache, and call the automation test case keyword;

[0044] The execution module is used to extract the marked priority execution data for parsing and execute the automated test case content.

[0045] Specifically, the secondary analysis module includes:

[0046] The format reading unit is used to store the YAML data after the test is parsed into the cache as a keyword plus data key-value pair. The test function obtains the data through the key.

[0047] The format conversion unit is used to convert the format of the extracted automation use case data. According to the parsing custom function, the encapsulated http request method is called to implement the request and convert it into the file format content required for the subsequent process. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 A schematic flow chart of the automated testing method based on data combined with keyword drive proposed by the present invention;

[0049] Figure 2 A schematic diagram of splitting the automated test case file into three levels in the automated test method based on data combined with keyword drive proposed by the present invention;

[0050] Figure 3 It is a keyword parsing diagram of automated use case data in the automated testing method based on data combined with keyword drive proposed by the present invention;

[0051] Figure 4 The analysis and implementation process of step and api keywords in the automated testing method based on data combined with keyword drive proposed by the present invention Figure 1 ;

[0052] Figure 5 The analysis and implementation process of step and api keywords in the automated testing method based on data combined with keyword drive proposed by the present invention Figure 2 ;

[0053] Figure 6 This is a schematic diagram of the structure of the automated testing system based on data combined with keyword drive proposed by the present invention;

[0054] Figure 7This is a structural schematic diagram of the secondary analysis module in the automated testing system based on data combined with keyword drive proposed by the present invention. DETAILED DESCRIPTION

[0055] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0056] The implementation of the present invention is described in detail below in conjunction with specific embodiments.

[0057] The same or similar numbers in the drawings of this embodiment correspond to the same or similar parts; in the description of the present invention, it should be understood that if the terms "upper", "lower", "left", "right" and the like indicate directions or positional relationships based on the directions or positional relationships shown in the drawings, it is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific direction, be constructed and operated in a specific direction. Therefore, the terms describing the positional relationship in the drawings are only used for illustrative purposes and cannot be understood as limitations on the present invention. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.

[0058] Reference Figure 1-5 As shown, the automated testing method based on data combined with keyword-driven is applied to automated testing equipment, and specifically includes the following steps:

[0059] S101: receiving an automated use case test request, where the automated use case test request carries automated use case data and automated use case data code;

[0060] Receiving an automated test case request includes:

[0061] Receiving a connection request sent by a user terminal through a preset network, the connection request is used to request to establish a connection with the automated test equipment;

[0062] Check whether the current account of the user terminal is the target account;

[0063] If the current account of the user terminal is the target account, connect to the user terminal according to the connection request, and after the connection is completed, receive the automated use case test request;

[0064] S102: Obtain content text and data code of automation use case data, and input the automation use case data and data code into a preset content text recognition model and a code recognition model;

[0065] The automated use case data and data code are input into the preset content text recognition model and code recognition model, including:

[0066] Obtaining multiple content text recognition models and code recognition models, and sorting the multiple content text recognition models and code recognition models in order;

[0067] Obtaining content text of automated use case data, and inputting the automated use case data into a content text recognition model ranked first;

[0068] Obtaining a data code of the automated use case data, and inputting the data code of the automated use case data into a code recognition model ranked first;

[0069] S103: Obtain recognition results outputted by the content text recognition model and the code recognition model based on the automated use case data and the data code, and complete the automated use case data and code splitting and association in the recognition results;

[0070] S104: Obtaining automation use case data, code splitting and associated data, extracting keyword information and execution code corresponding to the keyword information in the automation use case data, and marking the paired extracted keyword information for execution priority data parsing, and transmitting it to the data key-value pair and then storing it in the cache;

[0071] Among them, reference Figure 3 , extract the keyword information and the execution code corresponding to the keyword information in the automated use case data, and mark the paired extracted keyword information for execution priority data parsing, including:

[0072] The keyword information and the execution code corresponding to the keyword information in the extracted automation case data are converted into Ymal file format for storage, and data parsing is performed first when executing the test;

[0073] After executing test parsing, the YAML data is stored in the cache as a keyword plus data key-value pair, and the test function obtains the data through the key;

[0074] Perform secondary analysis on the extracted automated use case data, call the encapsulated http request method to implement the request based on the customized parsing function, and generate the test results;

[0075] S105: Extract the marked data for priority execution, call the automated test case keywords and execute the automated test case content. The data-driven approach of this technical solution allows test data to be easily modified and managed, while the keyword-driven approach can flexibly combine different keywords to create test cases. Combining the two can better adapt to different test requirements and changes. At the same time, the test data and test steps are managed separately, making the test script easier to maintain. When the test data or test steps change, only the corresponding data files or keywords need to be modified, without modifying a large number of test scripts.

[0076] In this embodiment, the preset network includes one or a combination of wired broadband, 3G network, 4G network, 5G network, and WIFI network.

[0077] In S103 of this embodiment, referring to Figure 2 In the recognition results, complete the automated use case data, code splitting and association, including:

[0078] The automation use case data is split into three file levels in turn;

[0079] The first file level is the test layer. The test layer calls the step keyword as a test case to execute. A test can call multiple step keywords.

[0080] The second file level is the step layer, which is used to store all test steps assembled by calling API keywords and generate keyword data for the steps. One step can call multiple API keywords.

[0081] The third level is the API file layer, which is used to store the basic information and data of all API interfaces and generate keywords for a single API.

[0082] Reference Figure 4-5 In S104-S105 of this embodiment, extracting the marked priority execution data analysis, calling the automated test case keyword and executing the automated test case content, includes:

[0083] All automated use case data is stored in Ymal file format. All YAML files are read and converted to JSON format.

[0084] Parse and determine whether the step references the api keyword identifier. If not, skip the step of obtaining the value through the api key cache, call the automated test case keyword and execute the automated test case content.

[0085] If the analysis determines whether the step references the api keyword identifier, it includes:

[0086] If there is a value obtained through the API key cache, the value obtained through the API key cache is written to the JSON data;

[0087] Then determine whether the step keyword identifier referenced by test exists. If so, get the keyword value in the cache through the step key keyword and fill it back into the json data. Then parse the step keyword referenced by test. If the identifier that references the step keyword exists in the json data, get the keyword value in the cache through the keyword and fill it back into the json data.

[0088] If the step keyword identifier referenced by test does not exist, the step key keyword is skipped and the value of the keyword in the cache is obtained.

[0089] The keyword-driven test steps of the present invention can be reused as an independent keyword library. Different test cases can perform the same operation by calling the same keyword, reducing the workload of writing test scripts. By adding new keywords or extending data files, the functions of the test scripts can be easily expanded, which can better cope with new test requirements or changes. In addition, separating test data and test steps can make the test script clearer and easier to read. The test script only contains keyword calls and parameter passing, but does not contain specific operation steps and data.

[0090] Reference Figure 6-7As shown, the automated testing system based on data combined with keyword drive is executed in the above-mentioned automated testing method, and the automated testing system includes: a receiving module, which is used to receive an automated case test request; an identification and association module, which is used to obtain the identification results of the automated case data and the data code output, and complete the automated case data, code splitting and association in the identification results; a primary parsing module, which is used to obtain the automated case data, code splitting and associated data, and extract the keyword information in the automated case data and the execution code corresponding to the keyword information; a secondary parsing module, which is used to match the extracted keywords after the primary parsing module completes the extraction of the keyword information in the automated case data and the execution code corresponding to the keyword information. The keyword information is marked for priority execution data analysis, and is transferred to the data key-value pair and then stored in the cache, as well as calling the automated test case keyword; an execution module is used to extract the marked priority data analysis and execute the automated test case content. The data-driven nature of the present technical solution allows test data to be easily modified and managed, while the keyword-driven nature allows for flexible combination of different keywords to create test cases. The combination of the two can better adapt to different test requirements and changes, while managing test data and test steps separately, making test scripts easier to maintain. When test data or test steps change, only the corresponding data files or keywords need to be modified without modifying a large number of test scripts.

[0091] The secondary parsing module includes: a format reading unit, which is used to store the YAML data after test parsing into the cache as keyword plus data key-value pairs, and the test function obtains data through the key; a format conversion unit, which is used to convert the format of the extracted automation case data, and according to the parsing custom function, call the encapsulated http request method to implement the request and convert it into the file format content required for the subsequent operation. The keyword-driven test steps can be reused as an independent keyword library, and different test cases can perform the same operation by calling the same keyword.

[0092] This can improve the reuse rate of test cases, reduce the workload of writing test scripts, and easily expand the functionality of test scripts by adding new keywords or extended data files, which can better respond to new test requirements or changes. In addition, separating test data and test steps can make test scripts clearer and easier to read. Test scripts only contain keyword calls and parameter passing, but not specific operation steps and data.

[0093] In this embodiment, the entire operation process can be controlled by a computer to achieve automatic operation control, and in each operation link, signal feedback can be performed by setting sensing components to achieve sequential execution of steps. These are all common knowledge of current automatic control and will not be described in detail in this embodiment.

[0094] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. An automated testing method based on data combined with keyword-driven, characterized in that: Applied to automated test equipment, specifically including the following steps: S101: receiving an automated case test request, wherein the automated case test request carries automated case data and the automated case data code; S102: Obtaining the content text and data code of the automation use case data, and inputting the automation use case data and data code into a preset content text recognition model and a code recognition model; S103: Obtain recognition results output by the content text recognition model and the code recognition model based on the automation use case data and the data code, and complete the automation use case data and code splitting and association in the recognition results; S104: Acquire automation use case data, code splitting and associated data, extract keyword information and execution code corresponding to the keyword information in the automation use case data, and perform tag execution priority data parsing on the paired extracted keyword information, and transfer it to the data key-value pair and then store it in the cache; S105: extract the marked priority execution data analysis, call the automated test case keywords and execute the automated test case content.

2. The automated testing method based on data combined with keyword-driven as claimed in claim 1, characterized in that: In S101, receiving an automated use case test request includes: Receiving a connection request sent by a user terminal through a preset network, wherein the connection request is used to request to establish a connection with the automated testing equipment; Detecting whether the current account of the user terminal is the target account; If the current account of the user terminal is the target account, a connection is made with the user terminal according to the connection request, and after the connection is completed, an automated use case test request is received.

3. The automated testing method based on data combined with keyword-driven as claimed in claim 2, characterized in that: The preset network includes one or a combination of wired broadband, 3G network, 4G network, 5G network, and WIFI network.

4. The automated testing method based on data combined with keyword-driven as claimed in claim 3, characterized in that: In S102, the automation use case data and the data code are input into a preset content text recognition model and a code recognition model, including: Acquire multiple content text recognition models and code recognition models, and sort the multiple content text recognition models and code recognition models in order; Acquire the content text of the automation use case data, and input the automation use case data into the content text recognition model ranked first; The data code of the automation use case data is obtained, and the data code of the automation use case data is input into the code recognition model that is ranked first.

5. The automated testing method based on data combined with keyword-driven as claimed in claim 4, characterized in that: In S103, in the recognition result, the automated use case data, code splitting and association are completed, including: The automation use case data is sequentially split into three file levels; The first file level is the test layer, which calls the step keyword as a test case. A test can call multiple step keywords. The second file level is the step layer, which is used to store all test steps assembled by calling API keywords and generate keyword data of the steps. One step can call multiple API keywords. The third level is the API file layer, which is used to store basic information and data of all API interfaces and generate keywords for a single API.

6. The automated testing method based on data combined with keyword-driven as claimed in claim 5, characterized in that: In S104, keyword information and execution codes corresponding to the keyword information are extracted from the automation use case data, and the paired extracted keyword information is marked for execution priority data parsing, including: The keyword information and the execution code corresponding to the keyword information in the extracted automation case data are converted into Ymal file format for storage, and data parsing is performed first when executing the test; After executing test parsing, the YAML data is stored in the cache as a keyword plus data key-value pair, and the test function obtains the data through the key; The extracted automated use case data is analyzed again, and based on the customized parsing function, the encapsulated http request method is called to implement the request and generate the test results.

7. The automated testing method based on data combined with keyword-driven as claimed in claim 6, characterized in that: In S105, the marked priority execution data is extracted for parsing, the automated test case keywords are called and the automated test case contents are executed, including: All automated use case data is stored in Ymal file format. All YAML files are read and converted into JSON format. Parse and determine whether the step references the api keyword identifier. If not, skip the step of obtaining the value through the api key cache, call the automated test case keyword and execute the automated test case content.

8. The automated testing method based on data combined with keyword-driven as claimed in claim 7, characterized in that: Parse and determine whether the step references the api keyword identifier, including: If there is a value obtained through the API key cache, the value obtained through the API key cache is written to the JSON data; Then determine whether the step keyword identifier referenced by test exists. If so, get the keyword value in the cache through the step key keyword and fill it back into the json data. Then parse the step keyword referenced by test. If the identifier that references the step keyword exists in the json data, get the keyword value in the cache through the keyword and fill it back into the json data. If the step keyword identifier referenced by test does not exist, the step key keyword is skipped and the value of the keyword in the cache is obtained.

9. The automated testing system based on data combined with keyword-driven, characterized in that: The automated testing method according to any one of claims 1 to 8 is implemented, wherein the automated testing system comprises: A receiving module, used for receiving automated use case test requests; An identification and association module is used to obtain the identification results of the automation use case data and data code output, and complete the automation use case data and code splitting and association in the identification results; A primary parsing module, used to obtain automated use case data, code splitting and associated data, extract keyword information in the automated use case data and execution code corresponding to the keyword information; A secondary parsing module is used to mark the paired extracted keyword information and the execution code corresponding to the keyword information after the primary parsing module completes the extraction of keyword information in the automation case data, perform data parsing with priority, transmit it to the data key-value pair and store it in the cache, and call the automation test case keyword; The execution module is used to extract the marked priority execution data for parsing and execute the automated test case content.

10. The data-based keyword-driven automated testing system according to claim 9, characterized in that: The secondary analysis module comprises: The format reading unit is used to store the YAML data after the test is parsed into the cache as a keyword plus data key-value pair. The test function obtains the data through the key. The format conversion unit is used to convert the format of the extracted automation use case data. According to the parsing custom function, the encapsulated http request method is called to implement the request and convert it into the file format content required for the subsequent process.