Automatic test case generation method and related equipment

The automatic generation of test cases for client user interfaces addresses the challenges of high cost and complexity in manual testing by using neural networks for semantic analysis and database-driven driver information retrieval, enhancing test coverage and defect discovery.

CN119248644APending Publication Date: 2025-01-03BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411346081.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-25
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

The high cost and complexity of manually writing test cases for different device types in automated testing of client user interfaces, due to diversity of device types, lack of basic libraries and methods, and complexity of multi-terminal interaction, result in insufficient test coverage and defect discovery.

Method used

A method and equipment for automatically generating test cases by determining target clients and device types from a test case description, retrieving pre-built driver information from a database, and generating test cases using neural networks for semantic analysis and keyword recognition, enabling consistent test case generation across different device types.

Benefits of technology

Reduces test case writing costs and ensures consistent test case generation across multiple device types, improving test coverage and defect discovery efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248644A_ABST
    Figure CN119248644A_ABST
Patent Text Reader

Abstract

The invention provides a test case automatic generation method and related equipment, at least one target client and a target equipment type of the target client can be determined based on test case description received and input in an input area of a test case, and for any client, no matter how many equipment types the client supports, the test case can be automatically generated. According to the method, the drive information is constructed according to the same mode and packaged in the pre-constructed database, so that the corresponding target drive information can be directly called from the database according to the equipment type during calling, and finally, the test case can be generated by calling the target drive information according to the description of the test case. Therefore, the test case can be generated in the same mode for any type of equipment supported by the client, and the cost of the test case is saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of software testing technology, and in particular to a method for automatically generating test cases and related equipment. Background Art

[0002] The User Interface (UI) is the medium for interaction and information exchange between the client and the user. During the testing process, in order to verify whether the client's user interface meets the expected functions and performance, it is often necessary to use test cases to discover its existing problems so that they can be repaired and improved in a timely manner.

[0003] However, the same client usually supports different device types, and different device types require different test case writing methods, which requires higher test case writing costs. Summary of the invention

[0004] In view of this, the purpose of this application is to propose a test case automatic generation method and related equipment to solve or partially solve the above technical problems.

[0005] Based on the above purpose, the first aspect of the present application provides a method for automatically generating test cases, comprising:

[0006] Receiving an input test case description in an input area of ​​the test case, and determining at least one target client and a target device type of the target client based on the test case description;

[0007] Retrieving target driver information corresponding to the target device type from a pre-built database, wherein the database includes driver information corresponding to different device types;

[0008] The target driver information is called according to the test case description to generate a test case for the target client.

[0009] Based on the same inventive concept, the second aspect of the present application proposes a test case automatic generation device, comprising:

[0010] An acquisition module is configured to receive a test case description input in an input area of ​​the test case, and determine at least one target client and a target device type of the target client based on the test case description;

[0011] A calling module is configured to call target driver information corresponding to the target device type from a pre-built database, wherein the database includes driver information corresponding to different device types;

[0012] A generating module is configured to call the target driver information according to the test case description to generate a test case for the target client.

[0013] Based on the same inventive concept, the third aspect of the present application proposes an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect when executing the program.

[0014] Based on the same inventive concept, the fourth aspect of the present application proposes a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable a computer to execute the method described in the first aspect.

[0015] Based on the same inventive concept, the fifth aspect of the present application provides a computer program product, including computer program instructions, which, when executed on a computer, enable the computer to execute the method described in the first aspect.

[0016] From the above, it can be seen that the test case automatic generation method and related equipment provided by the present application can determine at least one target client and the target device type of the target client based on the test case description received in the input area of ​​the test case. For any client, no matter how many device types it supports, the driver information is constructed in the same way and encapsulated in a pre-constructed database. When calling, the corresponding target driver information can be directly retrieved from the database according to the device type. Finally, the test case can be generated by calling the target driver information according to the test case description, thereby achieving the goal of generating test cases in the same way for any type of device type supported by the client, thereby saving the cost of test cases. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the present application or related technologies, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0018] Figure 1 A schematic diagram of an application scenario of an embodiment of the present application;

[0019] Figure 2 A flowchart of a method for automatically generating test cases according to an embodiment of the present application;

[0020] Figure 3A A first schematic diagram of an exemplary page of an embodiment of the present application;

[0021] Figure 3B A second schematic diagram of an exemplary page of an embodiment of the present application;

[0022] Figure 4 A schematic diagram of the structure of a test case automatic generation device according to an embodiment of the present application;

[0023] Figure 5 A schematic diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0024] It is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.

[0025] The principles and spirit of the present application will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the present application, and are not intended to limit the scope of the present application in any way. On the contrary, these embodiments are provided to make the present application more thorough and complete, and to fully convey the scope of the present application to those skilled in the art.

[0026] It is understandable that before using the technical solutions of each embodiment of the present application, the type, scope of use, usage scenarios, etc. of the personal information involved will be informed to the user in an appropriate manner, and the user's authorization will be obtained.

[0027] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly remind the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can independently choose whether to provide personal information to the electronic device, application, server, storage medium or other software or hardware that performs the operation of the technical solution of the present application according to the prompt message.

[0028] As an optional but non-limiting implementation, in response to receiving the user's active request, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0029] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation method of this application. Other methods that meet relevant laws and regulations may also be applied to the implementation method of this application.

[0030] In the present application, it should be understood that any number of elements in the drawings is for illustration rather than limitation, and any naming is only for distinction and does not have any limiting meaning.

[0031] Based on the description of the above background technology, the present application finds that the following situations still exist in the related technology:

[0032] Currently, test cases used for automated testing of client user interfaces are mainly written manually, which is costly and often leads to insufficient test coverage, making it difficult to effectively discover and fix defects.

[0033] Among them, the reasons why the test case writing cost of automated testing in related technologies is high are mainly due to the following aspects:

[0034] (1) Diversity of device types: A client often needs to run on multiple terminal devices. Different device types (such as Mac / Windows / Android / iOS) may have different operation methods and performance forms. This requires testers to write different test cases for different device types, which increases the difficulty and complexity of writing.

[0035] (2) Lack of basic libraries and basic methods: If there is no complete basic library and basic methods, testers need to write them from scratch, which is time-consuming and increases the difficulty of writing.

[0036] (3) Complexity of multi-terminal interaction: The interaction between different clients cannot be ignored. This requires testers to consider the issue of multi-terminal interaction and write test cases that can adapt to multi-terminal interaction, which increases the difficulty and complexity of writing and also increases the cost of writing.

[0037] Based on the above description, the principle and spirit of the present application are explained in detail below with reference to several representative implementations of the present application.

[0038] refer to Figure 1, which is a schematic diagram of an application scenario of the test case automatic generation method provided in an embodiment of the present application. The application scenario includes a terminal device 101, a server 102, and a data storage system 103. Among them, the terminal device 101, the server 102 and the data storage system 103 can be connected through a wired or wireless communication network. The terminal device 101 includes but is not limited to a desktop computer, a mobile phone, a mobile computer, a tablet computer, a media player, a smart wearable device, a personal digital assistant (PDA) or other electronic devices capable of realizing the above functions. The server 102 and the data storage system 103 can both be independent physical servers, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.

[0039] The user interacts with the terminal device 101, receives the input test case description in the test case input area, and then sends the test case description to the server 102 through the terminal device 101, and determines at least one target client and the target device type of the target client based on the test case description through the server 102; then the target driver information corresponding to the target device type is retrieved from the pre-built database through the server 102, and the target driver information is called according to the test case description to generate the test case of the target client, and then the test case of the target client is sent to the terminal device 101 through the server 102 for display. The data storage system 103 provides data storage support for the operation of the server 102, for example, for storing the running program code and the relevant data of the test case of the target client.

[0040] Combine the following Figure 1 The test case automatic generation method according to the exemplary embodiment of the present application is described by using the application scenario. It should be noted that the above application scenario is only shown to facilitate understanding of the spirit and principle of the present application, and the embodiment of the present application is not limited in this respect. On the contrary, the embodiments of the present application can be applied to any applicable scenario.

[0041] The present application provides a method for automatically generating test cases. Figure 2 As shown, the method includes:

[0042] Step 201: receiving an input test case description in an input area of ​​a test case, and determining at least one target client and a target device type of the target client based on the test case description.

[0043] In some embodiments, the input area of ​​the test case may be a text editing window, in which the user may input the corresponding test case description. Specifically, the test case description may include a functional description, a scenario description, a data description, etc. of the test case.

[0044] Based on the text content in the test case description, the target client to be tested and the device type of the terminal device where the target client is located are identified, for example Figure 3A As shown, the user enters a test case description in the test case input area 301, and the test case description is as follows: "Start xx device type xx document, select insert picture, click search, and enter the keyword 'xx'". After the user triggers the generation of the test case code control 302 through touch, voice command or mouse, the client and device type can be extracted from the text content of the test case description, where xx device type can be mac / windows / android / ios system, for example, xx device type is android system, and xx document is a Word document, so it can be determined that the target client is a Word document and the target device type is android system.

[0045] A neural network may be used to perform text recognition training in advance to obtain a large language model (LLM) that can perform text recognition based on the test case description. The large language model is then used to perform text recognition on the test case description to determine at least one target client and the target device type of the target client.

[0046] In some embodiments, in step 201, determining at least one target client and a target device type of the target client based on the test case description includes:

[0047] Step A1, performing semantic analysis on the test case description to obtain a semantic analysis result.

[0048] Step A2: performing keyword recognition on the test case description based on the semantic analysis result to obtain keywords associated with the target client.

[0049] Step A3: determining at least one target client according to the keywords associated with the target client, and determining the target device type of the target client from the test case description using the semantic analysis result.

[0050] In some embodiments, the test case description is processed by the large language model as follows to determine at least one target client and a target device type of the target client:

[0051] Semantic analysis of test case descriptions can be performed to deeply understand the meaning of test case descriptions and identify deep-level information such as concepts, entities, and relationships in test case descriptions. This is crucial for subsequent accurate keyword extraction and determination of target clients and device types.

[0052] After completing the semantic analysis, keywords related to the target client are identified based on the semantic analysis results. These keywords may include the client's name, type, function description, etc.

[0053] The identified keywords can then be used to further determine which clients are targeted by the test case. After determining the target clients, it is also necessary to determine the target device types on which these clients run.

[0054] Relying on the in-depth understanding and analysis of the test case description by the large language model, the target client and target device type can be accurately determined through semantic analysis and keyword recognition.

[0055] In some embodiments, step A1 includes:

[0056] Step A11, performing word segmentation processing on the test case description to obtain a plurality of word segmentation words.

[0057] Step A12, performing relationship analysis on the multiple segmentation words to obtain relationship analysis results corresponding to the multiple segmentation words, and using the relationship analysis results as the semantic analysis results.

[0058] In some embodiments, word segmentation processing can split a complete sentence or text in the test case description into several meaningful vocabulary units (usually referred to as "words" or "terms").

[0059] Use a word segmentation algorithm (such as rule-based word segmentation, statistical-based word segmentation, or a hybrid method) to process the test case description and split it into multiple independent words.

[0060] Relationship analysis is based on word segmentation processing and further analyzes the semantic relationship between these words to understand the overall meaning and structure of the test case description.

[0061] By performing word segmentation and relationship analysis on the test case description, a semantic analysis result can be obtained. This result not only contains the specific words in the test case description, but also reveals the internal connection and structure between these words. This is of great significance for subsequent test case understanding, automated test generation, test case management, etc. For example, based on the semantic analysis results, the key information of the test case can be automatically extracted, or the test case can be mapped to a specific test framework.

[0062] In some embodiments, step A2 comprises:

[0063] Step A21, performing named entity recognition on the test case description to obtain multiple named entities.

[0064] Step A22: extracting a target named entity associated with the target client from the multiple naming recognition results using the semantic analysis result, and using the target named entity as a keyword associated with the target client.

[0065] In some embodiments, named entities that may contain important information or specific meanings can be identified from the test case description through named entity recognition. These named entities may be function names, method names, interface element names, device models, etc., depending on the content and context of the test case description.

[0066] However, not all of these named entities are directly related to the target client. Therefore, the results of semantic analysis are needed to further screen these named entities. The results of semantic analysis are used to evaluate the relevance between each named entity and the target client. Specific methods can include checking the context of the named entity, analyzing its semantic relationship with other parts of the test case description, or using pre-defined rules or models to make judgments.

[0067] Then, those named entities that are judged to be closely related to the target client are extracted as keywords associated with the target client. Keywords associated with the target client can be effectively extracted from the test case description, providing important support for subsequent automated testing and test management.

[0068] In some embodiments, in step A3, determining at least one target client according to the keyword associated with the target client includes:

[0069] A pre-constructed first mapping relationship table is searched based on the keyword associated with the target client to obtain at least one target client, wherein the first mapping relationship table includes a plurality of mapping relationships between keywords associated with the client and the client.

[0070] In some embodiments, the first mapping relationship table is a table storing mapping relationships between a plurality of clients and their respective associated keywords.

[0071] Each row (or record) in the first mapping relationship table usually includes two main parts: one part is the identifier of the client, and the other part is a keyword list associated with the client.

[0072] By querying the first mapping relationship table, all clients associated with a specific keyword can be quickly found, so that the target client can be accurately determined.

[0073] In some embodiments, in step A3, determining the target device type of the target client from the test case description using the semantic analysis result includes:

[0074] Step B1, extracting a target device type description associated with a device type from the test case description based on the semantic analysis result.

[0075] Step B2: searching a pre-built second mapping relationship table according to the target device type description to obtain the target device type of the target client, wherein the second mapping relationship table includes mapping relationships between multiple device type descriptions and device types.

[0076] In some embodiments, the target device type description may be a keyword, phrase, or sentence related to the device type.

[0077] The second mapping relationship table is a table storing mapping relationships between multiple device types and device type descriptions.

[0078] By comparing the device type description extracted from the test case description with the entries in the second mapping relationship table, the entry matching the target device type description can be quickly found, and the target device type of the target client can be accurately determined accordingly.

[0079] Step 202: retrieve target driver information corresponding to the target device type from a pre-built database, wherein the database includes driver information corresponding to different device types.

[0080] In some embodiments, for any client, no matter how many device types it supports, the driver information is constructed in the same way and packaged in a pre-built database. Constructing the driver information in the same way enables different device types to use the same packaging method, and thus the test case writing method used is also the same.

[0081] In addition, by pre-establishing the association between device type and driver information in the database, the target driver information can be quickly located. In other words, different device types correspond to different driver information constructed in the same way, and each driver information contains various elements that can drive the application, such as interface elements, menu elements, button elements, etc. Therefore, the target driver information corresponding to the target device type can be found by querying the association between device type and driver information.

[0082] In some embodiments, step 202 includes:

[0083] Step C1, obtaining mapping information corresponding to the target device type.

[0084] Step C2: searching the database for target driver information corresponding to the target device type based on the mapping information.

[0085] In some embodiments, in order to quickly locate the target driver information, the association relationship between the device type and the driver information can be established in advance. Specifically, a mapping table can be established, which records the name of each device type and the address of the driver information corresponding to it. In this way, after receiving the test case description, the mapping information corresponding to the target device type can be found in the mapping table first, and then the target driver information can be found in the database based on the mapping information, which can improve the search speed of the target driver information and reduce unnecessary waiting time.

[0086] Step 203: Call the target driver information according to the test case description to generate a test case for the target client.

[0087] In some embodiments, the relevant elements in the target driver information can be called according to the test case description, and the test case can be generated based on the called elements, such as Figure 3A As shown, the test case of the target client is displayed in the test case generation area 303 .

[0088] For example, the target driver information includes three interface elements A, B, and C. The test case description entered by the user is "Start xx device type xx document, select insert image, click search, and enter keyword 'xx'". Then, the interface element that matches it can be found from the test case description. For example, the interface element "A" matches the description of "Start xx device type xx document", and the interface element "C" matches the description of "Enter keyword 'xx'". Then, these two interface elements can be used as driver sources to drive the actual xx document and complete the generation of the test case.

[0089] In some embodiments, the target drive information includes a plurality of interface elements and execution descriptions corresponding to each interface element.

[0090] Step 203 includes:

[0091] Step D1, searching for a target interface element corresponding to the test case description from a plurality of interface elements, and retrieving a target execution description corresponding to the target interface element from the execution descriptions corresponding to the respective interface elements.

[0092] Step D2, driving the target interface element to generate a test case for the target client based on the target execution description.

[0093] In some embodiments, since different device types correspond to different driver information constructed in the same way, different driver information will contain interface elements specific to the device type. For example, for an Android system whose terminal device is a mobile phone, its driver information may contain some interface elements related to the touch screen, while for a Windows system on a personal computer (PC), its driver information may contain some interface elements related to the mouse and keyboard. In addition, the driver information will also contain execution descriptions corresponding to each interface element, so that the interface element can be driven according to the execution description later.

[0094] In some embodiments, the interface element that matches the test case description can be first found from the test case description, and then the execution description corresponding to the interface element can be retrieved from the driver information, and finally the interface element can be driven according to the execution description to generate the test case. For example, if the test case description is "start xx device type xx document, select insert image, click search, and enter keyword 'xx'", then the interface element that matches the description of "start xx device type xx document" can be found from the driver information, and then the execution description corresponding to the interface element can be found, and finally the interface element can be driven according to the execution description to generate the test case.

[0095] In some embodiments, the target execution description includes a target execution operation and a target execution status.

[0096] Step B2 comprises:

[0097] Step E1, controlling the operation of the target interface element according to the target execution operation, generating an operation description, and combining the operation description with the target execution state to obtain a test case of the target client.

[0098] In some embodiments, the execution description generally consists of two parts, namely, execution operation (Action) and execution state (State). The execution operation represents the operation process required to drive the interface element, such as moving the mouse, clicking a button, dragging and sliding, etc.

[0099] The execution status indicates the status change of the interface elements after being driven, such as color change, position change, display and hiding, etc.

[0100] By building driver information through a combined framework of execution operations and execution status, it is convenient to generate test cases for the target client later.

[0101] In some embodiments, in step E1, combining the operation description with the target execution state to obtain a test case of the target client includes:

[0102] Step F1, obtaining the requirement description of the test case.

[0103] Step F2, describing and processing the operation description and the target execution status respectively according to the requirement description.

[0104] Step F3, integrating the described operation description and the described target execution status to obtain the test case of the target client.

[0105] In some embodiments, in order to make the generated test case code more in line with expectations and thereby ensure the accuracy and completeness of the test case, in addition to directly combining the run description and the target execution status, the test case requirement description (requirements) can also be obtained first, and then the run description and the target execution status are described and processed separately according to the requirement description, and finally the processed results are integrated to obtain the test case.

[0106] For example, if the test case requirement description is "Check whether the Word document can be saved correctly", then you can add the operation of "clicking the Save button" in the run description and the condition of "determining whether the file has been saved successfully" in the execution status to ensure the accuracy and completeness of the test case.

[0107] In some embodiments, multiple target clients and target device types of each target client are determined based on the test case description, and the target device types of each target client are the same; the target driver information corresponding to the target device type of each target client includes multiple interface elements and execution descriptions corresponding to each interface element.

[0108] Step 203 includes:

[0109] Step G1: in response to the plurality of target clients not having any interaction operation, perform the following operations on each of the target clients:

[0110] Step G11, searching for a target interface element corresponding to the test case description from a plurality of interface elements, and retrieving a target execution description corresponding to the target interface element from the execution descriptions corresponding to each interface element;

[0111] Step G12, driving the target interface element to generate a test case for the target client based on the target execution description.

[0112] In some embodiments, if there is no interaction between multiple target clients determined based on the test case description, each target client can be treated separately and respective test cases can be generated in sequence. Specifically, the interface element matching the test case description can be found first, and then the execution description corresponding to the interface element can be retrieved from the driver information, and finally the interface element can be driven according to the execution description to generate the test case.

[0113] In some embodiments, multiple target clients and target device types of each target client are determined based on the test case description, and the target device types of each target client are the same; the target driver information corresponding to the target device type of each target client includes multiple interface elements and execution descriptions corresponding to each interface element.

[0114] Step 203 includes:

[0115] Step H1, in response to the existence of interactive operations among the multiple target clients, performing the following operations on each of the target clients:

[0116] Step H11, searching for a target interface element corresponding to the test case description from a plurality of interface elements, and retrieving a target execution description corresponding to the target interface element from the execution descriptions corresponding to the respective interface elements.

[0117] Step H12, driving the target interface element based on the target execution description to obtain a driving result, and verifying the interactive operation according to the driving result to obtain a verification result.

[0118] Step H13, integrating the driving result and the verification result to generate a test case for the target client.

[0119] In some embodiments, if there is interaction between multiple target clients, each target client cannot be treated individually, but the synergy between the multiple target clients needs to be considered.

[0120] At this point, the interactive operation needs to be verified to ensure that all target clients can correctly perform their respective tasks. Specifically, you can first find the interface element that matches it from the test case description, then retrieve the execution description corresponding to the interface element from the driver information, and finally drive the interface element according to the execution description to obtain the driving result. Then, verify the interactive operation according to the driving result to obtain the verification result. Finally, integrate the driving result and the verification result to obtain the test case.

[0121] For example, Figure 3BAs shown, the test case description input by the user in the test case input area 301 is as follows:

[0122] "1. Start xx device type A

[0123] 2.B Start the meeting

[0124] 3.AJoin the meeting

[0125] 4.B sent the emoticon "OK"

[0126] 5. A received this expression"

[0127] According to the above test case description, there are two target clients, namely, target client A and target client B, and there is an interactive operation between target client A and target client B, wherein the device type may be a mac / windows / android / ios system. After the user triggers the test case code generation control 302 through touch, voice command or mouse, the test case code generated in the test case generation area 303 includes checking whether the target client A successfully joins the meeting, or checking whether the target client A receives the "OK" expression, for example:

[0128] 1. Checked whether only one expression was received;

[0129] 2. Verify whether it is sent by the target client B;

[0130] 3. Check whether the expression is "OK".

[0131] In some embodiments, after step 203, the method further includes:

[0132] Step I1, using the test case to run the test on the target client to obtain the test result.

[0133] Step I2, based on the comparison between the test result and the preset target test result, determine whether the test case is qualified.

[0134] In some embodiments, after the test case is generated, it is also necessary to perform an actual running test on it to confirm the validity and reliability of the test case. Specifically, the test case can be applied to an actual test environment to observe whether the test result meets expectations.

[0135] If the test results match the preset target test results, it means that the test case is qualified; otherwise, the test case needs to be modified again until the requirements are met.

[0136] Through the above scheme, based on the test case description received in the input area of ​​the test case, at least one target client and the target device type of the target client can be determined. For any client, no matter how many device types it supports, the driver information is constructed in the same way and encapsulated in a pre-constructed database. When calling, the corresponding target driver information can be directly retrieved from the database according to the device type. Finally, the test case can be generated by calling the target driver information according to the test case description, thereby achieving the goal of using the same method to generate test cases for any type of device type supported by the client, thereby saving the cost of test cases.

[0137] It should be noted that the method of the embodiment of the present application can be performed by a single device, such as a computer or server. The method of this embodiment can also be applied to a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of the embodiment of the present application, and the multiple devices will interact with each other to complete the described method.

[0138] It should be noted that the above describes some embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0139] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a test case automatic generation device.

[0140] refer to Figure 4 , the test case automatic generation device comprises:

[0141] The acquisition module 401 is configured to receive a test case description input in an input area of ​​the test case, and determine at least one target client and a target device type of the target client based on the test case description;

[0142] The retrieval module 402 is configured to retrieve target driver information corresponding to the target device type from a pre-built database, wherein the database includes driver information corresponding to different device types;

[0143] The generating module 403 is configured to call the target driver information according to the test case description to generate a test case for the target client.

[0144] In some embodiments, the calling module 402 is specifically configured to:

[0145] Acquire mapping information corresponding to the target device type;

[0146] The target driver information corresponding to the target device type is searched from the database based on the mapping information.

[0147] In some embodiments, the target drive information includes a plurality of interface elements and execution descriptions corresponding to each interface element;

[0148] The generating module 403 includes:

[0149] A search unit is configured to search for a target interface element corresponding to the test case description from a plurality of interface elements, and retrieve a target execution description corresponding to the target interface element from the execution descriptions corresponding to the respective interface elements;

[0150] A driving unit is configured to drive the target interface element to generate a test case of the target client based on the target execution description.

[0151] In some embodiments, the target execution description includes a target execution operation and a target execution status;

[0152] The driving unit comprises:

[0153] The running subunit is configured to control the running of the target interface element according to the target execution operation, generate a running description, and combine the running description with the target execution state to obtain a test case of the target client.

[0154] In some embodiments, the operation subunit is specifically configured to:

[0155] Get the test case requirement description;

[0156] Describing and processing the operation description and the target execution status respectively according to the requirement description;

[0157] The described operation description and the described target execution status are integrated to obtain a test case of the target client.

[0158] In some embodiments, multiple target clients and target device types of each target client are determined based on the test case description, and the target device types of each target client are the same; the target driver information corresponding to the target device type of each target client includes multiple interface elements and execution descriptions corresponding to each interface element;

[0159] The generating module 403 is specifically configured as follows:

[0160] In response to the plurality of target clients not having any interactive operation, performing the following operations on each of the target clients:

[0161] Searching for a target interface element corresponding to the test case description from a plurality of interface elements, and retrieving a target execution description corresponding to the target interface element from the execution descriptions corresponding to each interface element;

[0162] The target interface element is driven based on the target execution description to generate a test case for the target client.

[0163] In some embodiments, multiple target clients and target device types of each target client are determined based on the test case description, and the target device types of each target client are the same; the target driver information corresponding to the target device type of each target client includes multiple interface elements and execution descriptions corresponding to each interface element;

[0164] The generating module 403 is specifically configured as follows:

[0165] In response to the multiple target clients having interactive operations, performing the following operations on each of the target clients:

[0166] Searching for a target interface element corresponding to the test case description from a plurality of interface elements, and retrieving a target execution description corresponding to the target interface element from the execution descriptions corresponding to each interface element;

[0167] driving the target interface element based on the target execution description to obtain a driving result, and verifying the interactive operation according to the driving result to obtain a verification result;

[0168] The driving result and the verification result are integrated to generate a test case for the target client.

[0169] In some embodiments, the test case automatic generation device further includes a test module. After calling the target driver information to generate the test case of the target client according to the test case description, the test module is specifically configured as follows:

[0170] Using the test case to run the test on the target client to obtain a test result;

[0171] Based on the comparison between the test result and the preset target test result, it is determined whether the test case is qualified.

[0172] In some embodiments, the acquisition module 401 includes:

[0173] A semantic analysis unit, configured to perform semantic analysis on the test case description to obtain a semantic analysis result;

[0174] A keyword recognition unit, configured to perform keyword recognition on the test case description based on the semantic analysis result to obtain keywords associated with the target client;

[0175] The determination unit is configured to determine at least one target client according to the keywords associated with the target client, and determine the target device type of the target client from the test case description using the semantic analysis result.

[0176] In some embodiments, the semantic analysis unit is specifically configured to:

[0177] Performing word segmentation processing on the test case description to obtain multiple word segmentation words;

[0178] Relation analysis is performed on the multiple segmentation words to obtain relationship analysis results corresponding to the multiple segmentation words, and the relationship analysis results are used as the semantic analysis results.

[0179] In some embodiments, the keyword identification unit is specifically configured to:

[0180] Performing named entity recognition on the test case description to obtain multiple named entities;

[0181] The semantic analysis result is used to extract a target named entity associated with the target client from the multiple naming recognition results, and the target named entity is used as a keyword associated with the target client.

[0182] In some embodiments, the determining unit is specifically configured to:

[0183] A pre-constructed first mapping relationship table is searched based on the keyword associated with the target client to obtain at least one target client, wherein the first mapping relationship table includes a plurality of mapping relationships between keywords associated with the client and the client.

[0184] In some embodiments, the determining unit is specifically configured to:

[0185] Extracting a target device type description associated with a device type from the test case description based on the semantic analysis result;

[0186] A pre-constructed second mapping relationship table is searched according to the target device type description to obtain the target device type of the target client, wherein the second mapping relationship table includes mapping relationships between multiple device type descriptions and device types.

[0187] For the convenience of description, the above device is described in terms of functions divided into various modules. Of course, when implementing the present application, the functions of each module can be implemented in the same or multiple software and / or hardware.

[0188] The device of the above embodiment is used to implement the corresponding test case automatic generation method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.

[0189] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for automatically generating test cases described in any of the above embodiments is implemented.

[0190] Figure 5 A more specific schematic diagram of the hardware structure of an electronic device provided in this embodiment is shown, and the device may include: a processor 501, a memory 502, an input / output interface 503, a communication interface 504, and a bus 505. The processor 501, the memory 502, the input / output interface 503, and the communication interface 504 are connected to each other through the bus 505 in the device.

[0191] The processor 501 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.

[0192] The memory 502 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 502 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program codes are stored in the memory 502 and called and executed by the processor 501.

[0193] The input / output interface 503 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.

[0194] The communication interface 504 is used to connect a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WIFI, Bluetooth, etc.).

[0195] The bus 505 includes a path for transmitting information between various components of the device (eg, the processor 501 , the memory 502 , the input / output interface 503 , and the communication interface 504 ).

[0196] It should be noted that, although the above device only shows a processor 501, a memory 502, an input / output interface 503, a communication interface 504, and a bus 505, in a specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include components necessary for implementing the embodiments of the present specification, and does not necessarily include all the components shown in the figure.

[0197] The electronic device of the above embodiment is used to implement the corresponding test case automatic generation method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.

[0198] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the test case automatic generation method described in any of the above embodiments.

[0199] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.

[0200] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the test case automatic generation method described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0201] Based on the same concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a computer program product, including computer program instructions. When the computer program instructions are run on a computer, the computer executes the method described in any of the above embodiments, which has the beneficial effects of the corresponding method embodiments and will not be repeated here.

[0202] A person skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present application is limited to these examples. In line with the concept of the present application, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present application as described above, which are not provided in detail for the sake of simplicity.

[0203] In addition, to simplify the description and discussion, and in order not to make the embodiments of the present application difficult to understand, the known power supply / ground connection with the integrated circuit (IC) chip and other components may or may not be shown in the provided drawings. In addition, the device can be shown in the form of a block diagram to avoid making the embodiments of the present application difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform to be implemented in the embodiments of the present application (that is, these details should be fully within the scope of understanding of those skilled in the art). In the case of elaborating specific details (e.g., circuits) to describe exemplary embodiments of the present application, it is obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details or when these specific details are changed. Therefore, these descriptions should be considered to be illustrative rather than restrictive.

[0204] Although the present application has been described in conjunction with specific embodiments of the present application, many replacements, modifications and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.

[0205] The embodiments of the present application are intended to cover all such substitutions, modifications and variations that fall within the broad scope of the present application. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application should be included in the protection scope of the present application.

Claims

1. A method for automatically generating test cases, characterized in that: include: Receiving an input test case description in an input area of ​​the test case, and determining at least one target client and a target device type of the target client based on the test case description; Retrieving target driver information corresponding to the target device type from a pre-built database, wherein the database includes driver information corresponding to different device types; The target driver information is called according to the test case description to generate a test case for the target client.

2. The method according to claim 1, characterized in that The step of retrieving target drive information corresponding to the target device type from a pre-built database includes: Acquire mapping information corresponding to the target device type; The target driver information corresponding to the target device type is searched from the database based on the mapping information.

3. The method according to claim 1, characterized in that The target drive information includes a plurality of interface elements and an execution description corresponding to each interface element; The step of calling the target driver information according to the test case description to generate a test case for the target client includes: Searching for a target interface element corresponding to the test case description from a plurality of interface elements, and retrieving a target execution description corresponding to the target interface element from the execution descriptions corresponding to each interface element; The target interface element is driven based on the target execution description to generate a test case for the target client.

4. The method according to claim 3, characterized in that The target execution description includes a target execution operation and a target execution status; The step of driving the target interface element to generate a test case for the target client based on the target execution description includes: The target interface element is controlled to run according to the target execution operation, an operation description is generated, and the operation description is combined with the target execution state to obtain a test case of the target client.

5. The method according to claim 4, characterized in that The step of combining the operation description with the target execution state to obtain a test case of the target client includes: Get the test case requirement description; Describing and processing the operation description and the target execution status respectively according to the requirement description; The described operation description and the described target execution status are integrated to obtain a test case of the target client.

6. The method according to claim 1, characterized in that Determine multiple target clients and target device types of each target client based on the test case description, wherein the target device types of each target client are the same; target driver information corresponding to the target device type of each target client includes multiple interface elements and execution descriptions corresponding to each interface element; The step of calling the target driver information according to the test case description to generate a test case for the target client includes: In response to the plurality of target clients not having any interactive operation, performing the following operations on each of the target clients: Searching for a target interface element corresponding to the test case description from a plurality of interface elements, and retrieving a target execution description corresponding to the target interface element from the execution descriptions corresponding to each interface element; The target interface element is driven based on the target execution description to generate a test case for the target client.

7. The method according to claim 1, characterized in that Determine multiple target clients and target device types of each target client based on the test case description, wherein the target device types of each target client are the same; target driver information corresponding to the target device type of each target client includes multiple interface elements and execution descriptions corresponding to each interface element; The step of calling the target driver information according to the test case description to generate a test case for the target client includes: In response to the multiple target clients having interactive operations, performing the following operations on each of the target clients: Searching for a target interface element corresponding to the test case description from a plurality of interface elements, and retrieving a target execution description corresponding to the target interface element from the execution descriptions corresponding to each interface element; driving the target interface element based on the target execution description to obtain a driving result, and verifying the interactive operation according to the driving result to obtain a verification result; The driving result and the verification result are integrated to generate a test case for the target client.

8. The method according to claim 1, characterized in that After calling the target driver information according to the test case description to generate the test case of the target client, the method further includes: Using the test case to run the test on the target client to obtain a test result; Based on the comparison between the test result and the preset target test result, it is determined whether the test case is qualified.

9. The method according to claim 1, characterized in that: The determining at least one target client and a target device type of the target client based on the test case description includes: Performing semantic analysis on the test case description to obtain a semantic analysis result; Performing keyword recognition on the test case description based on the semantic analysis result to obtain keywords associated with the target client; At least one target client is determined according to the keywords associated with the target client, and a target device type of the target client is determined from the test case description using the semantic analysis result.

10. The method according to claim 9, characterized in that The performing semantic analysis on the test case description to obtain a semantic analysis result includes: Performing word segmentation processing on the test case description to obtain multiple word segmentation words; Relation analysis is performed on the multiple segmentation words to obtain relationship analysis results corresponding to the multiple segmentation words, and the relationship analysis results are used as the semantic analysis results.

11. The method according to claim 9, characterized in that The performing keyword recognition on the test case description based on the semantic analysis result to obtain keywords associated with the target client includes: Performing named entity recognition on the test case description to obtain multiple named entities; The semantic analysis result is used to extract a target named entity associated with the target client from the multiple naming recognition results, and the target named entity is used as a keyword associated with the target client.

12. The method according to claim 9, characterized in that The determining at least one target client according to the keyword associated with the target client comprises: A pre-constructed first mapping relationship table is searched based on the keyword associated with the target client to obtain at least one target client, wherein the first mapping relationship table includes a plurality of mapping relationships between keywords associated with the client and the client.

13. The method according to claim 9, characterized in that The step of determining the target device type of the target client from the test case description using the semantic analysis result includes: Extracting a target device type description associated with a device type from the test case description based on the semantic analysis result; A pre-constructed second mapping relationship table is searched according to the target device type description to obtain the target device type of the target client, wherein the second mapping relationship table includes mapping relationships between multiple device type descriptions and device types.

14. A test case automatic generation device, characterized in that: include: An acquisition module is configured to receive a test case description input in an input area of ​​the test case, and determine at least one target client and a target device type of the target client based on the test case description; A calling module is configured to call target driver information corresponding to the target device type from a pre-built database, wherein the database includes driver information corresponding to different device types; A generating module is configured to call the target driver information according to the test case description to generate a test case for the target client.

15. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 13 is implemented.

16. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to enable a computer to execute the method according to any one of claims 1 to 13.

17. A computer program product comprising computer program instructions, characterized in that When the computer program instructions are executed on a computer, the computer is caused to perform the method according to any one of claims 1 to 13.