Test method and device, electronic equipment and storage medium

By obtaining step description information in the test request, and using text-format metadata to generate and distribute target step code, the problem of low reusability of test cases is solved, and a more efficient and adaptable test solution is achieved.

CN120407390APending Publication Date: 2025-08-01TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410147541.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-31
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

In the prior art, the reusability of test cases is low, resulting in low software testing efficiency.

Method used

Provide a testing method, by obtaining step description information in the test request, determining the target test steps from the test step set based on the business function information, and generating the target step code using text format metadata, and distributing it to the target device for execution according to the execution environment information.

Benefits of technology

It improves the preparation efficiency of test case code and the adaptability of tests, enhances the efficiency and adaptability of tests, and supports a diverse execution environment and business scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120407390A_ABST
    Figure CN120407390A_ABST
Patent Text Reader

Abstract

The invention relates to a test method and device, electronic equipment and a storage medium. The method comprises the steps of obtaining a test request, wherein the test request comprises at least one piece of step description information; determining at least one target test step from a test step set based on the at least one piece of service function class information; for each target test step, determining a step code corresponding to the target test step based on the step description information to obtain at least one target step code; and for each target step code, distributing the target step code to the corresponding target equipment according to the execution environment class information, so that the target step code is executed in the target equipment. The invention provides a more efficient and more adaptive test scheme. The embodiment of the invention can be applied to various scenes such as cloud technology, artificial intelligence, intelligent transportation, intelligent entertainment and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of Internet communication technologies, and in particular, to a testing method, apparatus, electronic device, and storage medium. Background Art

[0002] A test case is a description of the test tasks for a specific software product, which embodies test schemes, methods, technologies, and strategies. The content of a test case mainly includes test objectives, test environments, input data, test steps, expected results, test scripts, etc., and finally forms a document. Briefly speaking, a test case is a set of test inputs, execution conditions, and expected results prepared to meet a specific software requirement, used to verify whether the requirement is met. In related technologies, corresponding test cases are often written for related software, and the reusability of different test cases is low. Correspondingly, the testing efficiency for related software is also low. Therefore, a more efficient testing scheme is needed. Summary of the Invention

[0003] To solve at least one of the above-mentioned technical problems, this application provides a testing method, apparatus, electronic device, and storage medium:

[0004] According to a first aspect of this application, there is provided a testing method, the method comprising:

[0005] Obtain a test request, the test request including at least one step description information, each of the step description information including a service function type information and an execution environment type information;

[0006] Based on at least one of the service function type information, determine at least one target test step from a test step set, the at least one target test step corresponding one-to-one to the at least one service function type information, and the test steps in the test step set being metadata in text format;

[0007] For each of the target test steps, determine a step code corresponding to the target test step based on the step description information, so as to obtain at least one target step code;

[0008] For each of the target step codes, distribute the target step code to a corresponding target device according to the execution environment type information, so that the target step code is executed in the target device.

[0009] According to a second aspect of this application, there is provided a testing method, characterized in that the apparatus comprises:

[0010] Acquisition module: configured to acquire a test request, where the test request includes at least one step description information, and each step description information includes a business function type information and an execution environment type information;

[0011] Test step determination module: configured to determine at least one target test step from a test step set based on at least one of the business function type information, where the at least one target test step corresponds to the at least one business function type information one by one, and the test steps in the test step set are metadata in text format;

[0012] Step code determination module: configured to, for each target test step, determine a step code corresponding to the target test step based on the step description information to obtain at least one target step code;

[0013] Step code execution module: configured to, for each target step code, distribute the target step code to a corresponding target device according to the execution environment type information, so that the target step code is executed in the target device.

[0014] According to a third aspect of the present application, there is provided an electronic device, which includes at least one processor and a memory communicatively connected to the at least one processor; wherein, at least one instruction or at least one program segment is stored in the memory, and the at least one instruction or at least one program segment is loaded and executed by the at least one processor to implement the test method as described in the first aspect.

[0015] According to a fourth aspect of the present application, there is provided a computer-readable storage medium, in which at least one instruction or at least one program segment is stored, and the at least one instruction or at least one program segment is loaded and executed by a processor to implement the test method as described in the first aspect.

[0016] According to a fifth aspect of the present application, there is provided a computer program product, which includes at least one instruction or at least one program segment, and the at least one instruction or at least one program segment is loaded and executed by a processor to implement the test method as described in the first aspect.

[0017] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and do not limit the present application.

[0018] Implementing the present application has the following beneficial effects:

[0019] The present application provides a more efficient and adaptable test solution. In the present application, a test request is obtained, and the test request includes at least one step description information; then, at least one target test step is determined from a set of test steps based on at least one business function class information; next, for each target test step, a step code corresponding to the target test step is determined based on the step description information to obtain at least one target step code; furthermore, for each target step code, the target step code is distributed to a corresponding target device according to the execution environment class information, so that the target step code is executed in the target device. The test steps in the set of test steps are metadata in text format, and the maintenance of the test steps is realized by using the metadata in text format. On this basis, by virtue of the easy convertibility of the test steps and the independence of the test step dimension, it is beneficial to improve the preparation efficiency of the test case code before the test by reusing the test steps, thereby improving the test efficiency. At the same time, each step description information includes a business function class information and an execution environment class information, and the connotation of the step description information ensures the adaptability of the step code corresponding to the target test step in terms of business scenarios and execution environments, thus improving the adaptability of the test.

[0020] Other features and aspects of the present application will become clear from the following detailed description of the exemplary embodiments with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0022] Figure 1 FIG. shows a schematic diagram of an application environment according to an embodiment of the present application;

[0023] Figure 2 FIG. shows a schematic flowchart of a test method according to an embodiment of the present application;

[0024] Figure 3 FIG. shows a schematic flowchart of extracting at least one metadata segment from target metadata according to an embodiment of the present application;

[0025] Figure 4 FIG. shows a schematic flowchart of determining a step code corresponding to a target test step based on step description information according to an embodiment of the present application;

[0026] Figure 5 FIG. shows a schematic flowchart of determining, distributing, and executing step codes according to an embodiment of the present application;

[0027] Figure 6 Also shows a schematic flowchart of a test method according to an embodiment of the present application;

[0028] Figure 7 Shows a schematic diagram of the interface for writing test cases according to an embodiment of the present application;

[0029] Figure 8 Also shows a schematic diagram of the interface for writing test cases according to an embodiment of the present application;

[0030] Figure 9 Shows a schematic diagram of metadata using tags according to an embodiment of the present application;

[0031] Figure 10 Shows a schematic flowchart of metadata using parameter combinations according to an embodiment of the present application;

[0032] Figure 11 Shows a comparison schematic diagram of metadata and metadata fragments according to an embodiment of the present application;

[0033] Figure 12 Shows a comparison schematic diagram of test steps and step codes corresponding to the test steps according to an embodiment of the present application;

[0034] Figure 13 Shows a schematic diagram of the work responsible by the execution dispatcher according to an embodiment of the present application;

[0035] Figure 14 Shows a schematic diagram of the execution record of step codes according to an embodiment of the present application;

[0036] Figure 15 Shows a schematic diagram of the code execution result according to an embodiment of the present application;

[0037] Figure 16 Shows a schematic diagram of the test report according to an embodiment of the present application;

[0038] Figure 17 Shows a schematic diagram of the device block according to an embodiment of the present application;

[0039] Figure 18 Shows a schematic diagram of an electronic device according to an embodiment of the present application. Detailed implementation manners

[0040] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts shall fall within the protection scope of the present application.

[0041] It should be noted that the terms "first", "second", etc. in the description, claims and the above-mentioned drawings of this application are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of this application described here can be implemented in an order other than those illustrated or described here. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or server that comprises a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0042] In the embodiments of this application, the term "module" or "unit" refers to a computer program with a predetermined function or a part of a computer program, which works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as a processing circuit or a memory), or a combination thereof. Similarly, one processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of an overall module or unit that includes the functions of that module or unit.

[0043] Various exemplary embodiments, features and aspects of this application will be described in detail below with reference to the drawings. The same reference numerals in the drawings denote elements with the same or similar functions. Although various aspects of the embodiments are shown in the drawings, the drawings do not have to be drawn to scale unless otherwise specified.

[0044] The special term "exemplary" here means "serving as an example, an embodiment". Any embodiment described here as "exemplary" does not have to be construed as superior to or better than other embodiments.

[0045] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the term "at least one" in this article means any one of a plurality or any combination of at least two of a plurality. For example, including at least one of A, B, and C can represent including any one or more elements selected from the set composed of A, B, and C.

[0046] In addition, to better illustrate this application, numerous specific details are given in the following specific implementation manners. Those skilled in the art should understand that this application can also be implemented without certain specific details. In some instances, methods, means, elements and circuits well-known to those skilled in the art are not described in detail in order to highlight the gist of this application.

[0047] Before further elaborating on the embodiments of the present application, the nouns and terms involved in the embodiments of the present application are described. The nouns and terms involved in the embodiments of the present application are applicable to the following explanations.

[0048] A Domain-Specific Language (DSL) refers to a computer language that focuses on a specific application domain. It is usually designed to solve specific problems or complete specific tasks and can be customized according to requirements to adapt to a specific environment or meet specific requirements. A DSL can be a completely independent language or an extension or variant of an existing programming language. The advantage of a DSL is that it enables relevant personnel to more intuitively express concepts and logics in a specific domain, thereby improving efficiency and quality. At the same time, a DSL also has flexibility and scalability and can change with the changes in domain requirements, continuously adapting to new requirements and the development of technologies.

[0049] Automated testing: Generally refers to the automation of software testing. Software testing is to run a system or application under preset conditions, evaluate the running results, and the preset conditions should include normal conditions and abnormal conditions.

[0050] Technology stack, an IT term, is a general term for a series of skill combinations that need to be mastered for a certain job or position.

[0051] Please refer to Figure 1 , Figure 1 , which shows a schematic diagram of an application environment according to an embodiment of the present application. The application environment may include a terminal 10 and a server side 20. The terminal 10 and the server side 20 can be directly or indirectly connected through wired or wireless communication means. A target object (such as a target user) sends a test request to the server side 20 through the terminal 10. The server side 20 obtains the test request, and the test request includes at least one step description information. Each step description information includes a business function type information and an execution environment type information; then, based on at least one business function type information, at least one target test step is determined from the test step set. The at least one target test step corresponds one-to-one to the at least one business function type information. The test steps in the test step set are metadata in text format; then, for each target test step, the step code corresponding to the target test step is determined based on the step description information to obtain at least one target step code; furthermore, for each target step code, the target step code is distributed to the corresponding target device according to the execution environment type information, so that the target step code is executed in the target device. It should be noted that Figure 1 is only an example.

[0052] The terminal 10 can be an entity device of types such as a smart phone, a computer (such as a desktop computer, a tablet computer, a laptop computer), an augmented reality (AR) / virtual reality (VR) device, a digital assistant, a smart voice interaction device (such as a smart speaker), a smart wearable device, a smart home appliance, a vehicle-mounted terminal, etc. The operating system of the terminal 10 can be an Android system, an iOS system (a mobile operating system developed by Apple Inc.), a Linux system (an operating system), a Microsoft Windows system (Microsoft Windows operating system), etc. Software can be installed on the terminal 10.

[0053] The server-side 20 can be an independent physical server, or a server cluster or a 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 (Content Delivery Network), and big data and artificial intelligence platforms. The server can include a network communication unit, a processor, a memory, and so on.

[0054] In practical applications, the testing method provided by the embodiments of the present application can utilize artificial intelligence technology. Artificial Intelligence (AI) is to use a digital computer or a machine controlled by a digital computer to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use the knowledge to obtain the best results of theory, method, technology, and application system. In other words, artificial intelligence is a comprehensive technology of computer science, which attempts to understand the essence of intelligence and produce a new intelligent machine that can react in a way similar to human intelligence. Artificial intelligence is also to study the design principles and implementation methods of various intelligent machines to enable the machines to have the functions of perception, reasoning, and decision-making. Artificial intelligence technology is an interdisciplinary subject, involving a wide range of fields, including both hardware-level technologies and software-level technologies. Artificial intelligence basic technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. Artificial intelligence software technologies mainly include several major directions such as computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning, autonomous driving, and intelligent transportation.

[0055] It should be noted that for test requests and the like that are associated with user information, when the embodiments of the present application are applied to specific products or technologies, user permission or consent needs to be obtained, and the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of the relevant countries and regions.

[0056] Figure 2 The flowchart showing a test method according to an embodiment of the present application is as Figure 2 shown. This test method can be executed by an electronic device, which can be a terminal or a server. The method includes:

[0057] S201: Obtain a test request, where the test request includes at least one step description information, and each step description information includes a business function type information and an execution environment type information;

[0058] In the embodiments of the present application, the electronic device obtains a test request. Generally speaking, a test request can be a description of a test task for the software to be tested. The test request includes at least one step description information, and each step description information includes a business function type information and an execution environment type information. It can be understood that the test request internally presents the specific description of the test task in terms of steps. At the same time, the connotation of the step description information involves the business scenario (corresponding to the business function type information) and the execution environment (corresponding to the execution environment type information).

[0059] Exemplarily, the at least one step description information is N step description information, and the step description information i is the i-th step description information among the N step description information, where the value range of i is 1-N. Taking the N step description information indicating N ideal step groups and the step description information i indicating the ideal step group i as an example, the step description information i describes the business scenario and execution environment that the ideal step group i should apply. The business scenario to be applied can be reflected by the business function type information i, and the business function type information i can indicate the test target (such as a certain function of the software to be tested, a certain function of the associated software of the software to be tested, etc.), input data (or the source of the input data), expected results, etc. The execution scenario to be applied can be reflected by the execution environment type information i, and the execution scenario type information i can indicate the specific technology stack information.

[0060] Of course, the step description information can also include execution method type information, and the execution method type information can indicate whether the ideal step group is automatically executed by the device or manually executed by the staff.

[0061] It should be noted that the step dimension is used in the above explanation of the step description information to reflect the relationship between the step description information and the test request, and does not limit the ideal step group indicated by the step description information.

[0062] S202: Determine at least one target test step from the set of test steps based on at least one of the service function class information. The at least one target test step corresponds one-to-one to the at least one service function class information. The test steps in the set of test steps are metadata in text format.

[0063] In the embodiments of the present application, the electronic device determines at least one target test step from the set of test steps based on at least one service function class information. Determine the target test steps that match the service function class information from the set of test steps. Combining the description of the service function class information in the foregoing step S201, whether the test steps in the set of test steps match the service function class information can be determined by whether the benchmark function of the test step matches the test target, whether the sample data in the test step is adapted to the input data, and whether the target result of the test step matches the expected result. Generally, select the test step with the highest matching degree with the service function class information in the set of test steps as the target test step. The matching degree between the test step and the service function class information can be achieved by calculating the similarity between the key elements of the service function class information and the key elements of the test step. The key elements can be text segments determined based on historical feedback and business requirements.

[0064] The at least one target test step corresponds one-to-one to the at least one service function class information. It can be understood that, on the one hand, the electronic device needs to match a target test step for each step description information. On the other hand, the at least one step description information is N step description information. Correspondingly, the N step description information indicates N target test steps. There may be at least two duplicate test steps among the N visual inspection test steps. The reasons may be: there are at least two duplicate step description information among the N step description information; and / or, different step description information matches the same test step in the set of test steps.

[0065] The test steps in the set of test steps are metadata in text format. The set of test steps can be pre-constructed. The set of test steps can be continuously updated. If a test step corresponds to a use case step in a preset test case, then the test step presents the use case step with high information content through the text format it adopts. This metadata in text format can be conveniently converted into other data formats, and the connection between the test step and the step description information, and the test step and the step code can be established thereby, thereby improving the convenience and efficiency of test case execution. It should be noted that the above test steps and use case steps indicate a set of executable process steps.

[0066] In one embodiment, the test steps in the set of test steps are obtained through the following steps:

[0067] 1) Extract the key information in the sample test case, where the dimensions of the key information include at least one of the following: execution element dimension, use case dimension, use case step dimension, and logical branch dimension;

[0068] 2) Extract the keyword corresponding to each piece of the key information from the preset keyword set, and combine the key information with the corresponding keyword to obtain the target metadata corresponding to the sample test case, where the target metadata is the text format data for storing the sample test case;

[0069] 3) Extract at least one metadata fragment from the target metadata, and determine that the metadata fragment is a test step for constructing the test step set, where the metadata fragment indicates the use case step in the sample test case.

[0070] The keywords stored in the preset keyword set are the keywords that may be used when converting a test case into text format metadata. It can also be understood as the keywords in a high-level language set by the embodiments of the present application to achieve the conversion of test cases into metadata. This high-level language is obviously a domain-specific language.

[0071] In the preset keyword set, the key information of the execution element dimension such as the precondition, execution step, and expected result of a test case can be defined by keywords such as Given, When, and Then respectively.

[0072] In the preset keyword set, the key information of the use case dimension and the use case step dimension of a test case can be defined by keywords such as @ and # respectively, such as the label (or note) of the use case dimension, the label (or note) of the use case step dimension. In practical applications, @e2e as the label of the use case dimension can indicate the test type of the use case, @bvt as the label of the use case dimension can identify the test execution time, and @pc as the label of the use case dimension can identify the test execution environment of the use case. For reference, Figure 9 Of course, the label type can also be extended according to historical feedback and business requirements.

[0073] In the preset keyword set, the key information of the logical branch dimension of a test case can be defined by the keyword combination of If, else and <>, {}. The key information of the two defined logical branch dimensions can indicate different business scenarios. Such as Figure 10As shown in the figure, different business scenarios are described by "if{position}=text". In practical applications, the content inside {} can indicate a parameter combination, and this parameter combination can define a business scenario through the parameter value range and the cited use case steps. It can be understood that a business scenario can indicate at least two specific scenarios, and the difference between at least two specific scenarios lies in the selection of different parameters and the values of the selected parameters. Correspondingly, a parameter combination can define a specific scenario under a business scenario. For example Figure 10 As shown in the figure, the combination of different values of {status} and {same category} is described in the figure.

[0074] Metadata refers to a specific text format that can be used to describe and store information related to test cases. It contains key information about the execution element dimension, use case dimension, use case step dimension, and logical branch dimension of test cases, which helps in the writing, management, and execution of test cases. The definition of metadata is based on a set of standard grammars, that is, the grammars of the high-level languages mentioned earlier, to ensure the consistency and readability of test cases. Of course, suitable grammars can also be customized according to different business requirements, such as different keywords and different hierarchical descriptions.

[0075] Based on this, for sample test cases, extract the key information in the sample test cases; extract the keywords corresponding to each key information from the preset keyword set, and combine the key information with the corresponding keywords to obtain the target metadata corresponding to the sample test cases. Here, the target metadata is the text format data used to store sample test cases. The sample test cases can be the benchmark cases written by staff, and the benchmark cases can be relatively general cases. The sample test cases can also be any case extracted from the current case pool, and the current case pool maintains all cases written by staff and / or ordinary users. After converting the sample test cases into target metadata, extract at least one metadata fragment from the target metadata. The metadata fragment is the test step in the test step set. For example Figure 11 As shown in the figure, although both the metadata fragment (test step) and the target metadata are in text format, their meanings and uses are different. The target metadata is an abstract expression of the business scenario involved in the sample test case, while the metadata fragment (test step) is the complete execution of the use case steps describing the specific scenario. Here, a process of obtaining target metadata based on sample test cases and obtaining test steps based on target metadata is provided. The test steps have the same data format as the target metadata, and at the same time, the test steps are finer-grained in terms of complete execution compared to the target metadata, providing support for the test steps to participate in the matching of step description information.

[0076] Exemplarily, the sample test case includes 3 use case steps: Use case steps 1 - 3. Use case step 1 -> Use case step 2 corresponds to logical branch 1, and logical branch 1 indicates business scenario 1. Use case step 1 -> Use case step 3 corresponds to logical branch 2, and logical branch 2 indicates business scenario 2. Business scenario 1 indicates two specific scenarios: Scenario 11, Scenario 12. Business scenario 2 indicates two specific scenarios: Scenario 21, Scenario 22. After obtaining the target metadata based on the sample test case, the metadata fragments extracted from the target metadata may include: Metadata fragment 1 (corresponding to use case step 1 of scenario 11), Metadata fragment 2 (corresponding to use case step 1 of scenario 12), Metadata fragment 3 (corresponding to use case step 1 of scenario 21), Metadata fragment 4 (corresponding to use case step 1 of scenario 22), Metadata fragment 5 (corresponding to use case step 2 of scenario 11), Metadata fragment 6 (corresponding to use case step 2 of scenario 12), Metadata fragment 7 (corresponding to use case step 3 of scenario 21), Metadata fragment 8 (corresponding to use case step 3 of scenario 22). In practical applications, the extracted metadata fragments can all be included in the test step set as test steps; alternatively, the extracted metadata fragments can be screened, and some of the screened metadata fragments can be included in the test step set as test steps.

[0077] As Figure 3 shown, the extracting of at least one metadata fragment from the target metadata includes:

[0078] S301: Generate an abstract syntax tree corresponding to the target metadata;

[0079] S302: Perform logical operation processing on the abstract syntax tree to obtain the at least one metadata fragment, where the logical operation processing indicates substituting the execution parameters carried by the sample test case and performing logical branch calculation.

[0080] The process of extracting metadata fragments from the target metadata can be regarded as the compilation of the sample test case. The target metadata can be parsed to obtain an abstract syntax tree. The abstract syntax tree is an abstract representation of the syntax structure of the target metadata, which presents the syntax structure of programming syntax in a tree - like form, and each node on the tree represents a structure in the target metadata. Then, logical operation processing is performed on the abstract syntax tree to obtain at least one metadata fragment. By substituting the execution parameters (which can also be parameter combinations) into the relevant tree nodes in the abstract syntax tree and calculating the logical branches involved in the relevant tree nodes, metadata fragments describing the complete execution of use case steps in specific scenarios can be obtained, thereby realizing the generation of at least one test step by expanding from the abstract syntax tree. Such a way of obtaining metadata fragments is beneficial to ensuring the executability and accuracy of the metadata fragment as a use case step.

[0081] Further, after performing logical operation processing on the abstract syntax tree to obtain the at least one metadata fragment, the method may further include the following steps: when the sample test case is executable code, determining a code fragment corresponding to the metadata fragment from the executable code, and establishing an association relationship between the metadata fragment and the code fragment; correspondingly, determining the step code corresponding to the target test step based on the step description information may include the following steps: when the target code fragment meets the requirements of the step description information, determining that the target code fragment is the step code corresponding to the target test step, and the target code fragment is a code fragment having an association relationship with the target test step. Considering the case where the sample test case itself is executable code, the association relationship between the metadata fragment (test step) and the code fragment can be established by reusing the executable code, which can improve the efficiency of determining the step code corresponding to the target test step, and thus improve the test efficiency.

[0082] S203: For each of the target test steps, determining the step code corresponding to the target test step based on the step description information to obtain at least one target step code;

[0083] In the embodiment of the present application, for each target test step, the electronic device determines the step code corresponding to the target test step based on the step description information to obtain at least one target step code. As Figure 12 shown, compared with the test step, the step code is executable by the device. Therefore, it is necessary to perform step code conversion on the visual test step to obtain the target step code. The step description information is used as the conversion basis. It can be understood that the test step in text format is a template, while the step code needs to incorporate business scenario information, and at the same time, the step code can be executed in the execution environment indicated by the execution environment information to reflect its personalization and pertinence. In practical applications, the function name can be used to represent the step name of the target step code, and then the relevant target step code can be executed by searching for the function name.

[0084] At least one target step code corresponds to at least one target test step one by one, and at least one target step code also corresponds to at least one step description information one by one. It can be understood that on the one hand, the electronic device needs to determine a target step code for each step description information. On the other hand, the at least one step description information is N step description information, and correspondingly, the N step description information indicates N target step codes. There may be at least two duplicate test step codes among the N visual test steps.

[0085] In one embodiment, as Figure 4As shown, determining the step code corresponding to the target test step based on the step description information includes:

[0086] S401: Determine at least one service parameter based on the service function type information;

[0087] S402: Determine the corresponding stack environment based on the execution environment type information;

[0088] S403: Convert the target test step based on a preset conversion rule to obtain the step code corresponding to the target test step, where the step code corresponding to the target test step carries the at least one service parameter and is adapted to the stack environment.

[0089] The service parameters determined based on the service function type information are often in line with the service scenarios indicated by the service function type information. The service parameters can be written into the target test step through a preset conversion rule or replace the original fields of the target test step. The stack environment determined based on the execution environment type information is often in line with the execution environment indicated by the execution environment type information. The stack environment can involve multiple aspects such as the front end, back end, middleware, database, and tools. The stack environment is what the step code that is the conversion target of the target test step needs to adapt to. In practical applications, the stack environment can indicate a web environment, a mobile environment, or a PC environment. Under the constraints of the service parameters and the stack environment, the accuracy of obtaining the corresponding step code by converting the target test step can be improved, which is beneficial to the effective execution of the step code corresponding to the target test step by the target device in the future, and thus beneficial to the test effect.

[0090] Exemplarily, in combination with the description of the service function type information in the foregoing step S201, the input data can be used as a service parameter, specifically as a precondition or input parameter in the step code. In addition, the stack environment further involves a specific programming language. Correspondingly, the step code corresponding to the target test step uses this specific programming language.

[0091] S204: For each of the target step codes, distribute the target step code to the corresponding target device according to the execution environment type information, so that the target step code is executed in the target device.

[0092] In the embodiment of the present application, for each target step code, the electronic device distributes the target step code to the corresponding target device according to the execution environment class information, so that the target step code is executed in the target device. For example, distribute the target step code i to the corresponding target device, i.e., device i, according to the execution environment class information i. The execution environment configured by device i matches the execution environment class information i. Combining the description of the execution environment class information in the foregoing step S201, the execution scenario class information i may indicate specific technology stack information. If the execution scenario class information i contains the description information for the technology stack i, then the matched device i needs to have the adaptation ability for the technology stack i. If the execution scenario class information i contains the positioning information for the technology stack i, then device i is the device determined based on the positioning information.

[0093] Taking N target step codes as an example, the N target step codes may be distributed to different devices. For example, the N target step codes may be distributed to N devices, with one target step code corresponding to one device; the N target step codes may be distributed to M (M < N) devices, and the corresponding relationship between the device and the target step code may include at least one of the following in addition to 1:1: 1:2, 1:multiple. The N target step codes may also be distributed to the same device.

[0094] If the test request has requirements on the execution order of the target step code corresponding to the step description information, then the distribution and execution guidance of the target step code can be carried out according to the execution order; it is also possible to first distribute at least one target step code, and then notify the corresponding device to execute the target step code in sequence according to the execution order. If the test request has no requirements on the execution order of the target step code corresponding to the step description information, the target step codes corresponding to at least one step description information can be executed simultaneously after being distributed, which can improve the test efficiency.

[0095] In one embodiment, the at least one target step code is distributed to at least one of the target devices. For each of the target step codes, the target step code is distributed to the corresponding target device according to the execution environment class information, so that after the target step code is executed in the target device, the method may further include the following steps: First, receive the code execution results respectively returned by the at least one target device to obtain a code execution result set; then, generate a test report based on the code execution result set. Considering that the at least one target step code may be executed by different devices respectively, processing the code execution results respectively returned by the at least one target device to obtain a test report is more in line with the response to the test request. The test report may include the code execution results corresponding to each of the at least one target step codes, and may also include a summary analysis result based on the at least one code execution result. Through the test report, the staff can conveniently and accurately obtain the test results. The code execution result corresponding to each target step code reflects the local test result, and the summary analysis result reflects the global test result. The test report can help the staff to conduct a systematic evaluation of the software to be tested, and can also help the staff to adjust the step description information involved in the current test request to better achieve an accurate and comprehensive test of the software to be tested. For reference, see Figures 14 - 16 。

[0096] In one embodiment, as Figure 5 shown, the at least one step description information is a plurality of the step description information. The first step description information and the second step description information are any two of the plurality of the step description information. The first step description information includes first service function class information and first execution environment class information, and the second step description information includes second service function class information and second execution environment class information. The method further includes:

[0097] S501: Distribute the target step code corresponding to the first step description information to the corresponding first device according to the first execution environment class information, so that the target step code corresponding to the first step description information is executed in the first device;

[0098] S502: Receive the code execution result returned by the first device, and update the second service function class information based on the returned code execution result to obtain third service function class information;

[0099] S503: Update the second step description information based on the third service function class information to obtain third step description information;

[0100] S504: Based on the description information of the third step, determine the step code corresponding to the candidate test step, where the candidate test step is the target test step corresponding to the description information of the second step;

[0101] S505: Distribute the step code corresponding to the candidate test step to the corresponding second device according to the second execution environment class information, so that the step code corresponding to the candidate test step is executed in the second device.

[0102] In the case where the test request has requirements on the execution order of the target step code corresponding to the step description information, the dependency relationship between the target step codes corresponding to the two step description information is processed here, that is, the code execution result of the previous target step code will affect the latter target step code. At the same time, for the latter target step code, the original step description information is the basis for determining the candidate test step, and the updated step description information is the basis for determining the corresponding step code based on the candidate test step. The process of determining, distributing, and executing the step code provides effective support for the extension of the test.

[0103] It should be noted that in the case where at least one step description information is multiple step description information, the previous target step code and the latter target step code here can be two adjacent target step codes to be executed, or not two adjacent target step codes to be executed.

[0104] Such as Figure 6 shown, when the test solution provided by the embodiment of the present application is executed by an electronic device, it can be implemented based on the support of the following device modules:

[0105]

[0106] In addition, in the test solution provided by the embodiment of the present application, the obtained test request may include the current test case. The current test case can be processed with reference to the relevant records in the foregoing step S202 to obtain the current metadata corresponding to the current test case. The current metadata is text format data for storing the current test case. At least one current metadata segment can be extracted from the current metadata, and it is determined that the current metadata segment is an executable current test step. The current metadata segment indicates the use case steps in the current test case. The current metadata can carry tags identifying the running attributes of the use case steps. In practical applications, such as Figure 13As shown, the execution dispatcher can read the current metadata and parse it to obtain the current test step and the tags carried thereby, so as to know the storage location of the step code corresponding to the current test step and the step code execution environment. The execution dispatcher searches according to the storage location of the step code to obtain the step code corresponding to the current test step. The execution dispatcher distributes the step code corresponding to the current test step according to the step code execution environment, so that the step code corresponding to the current test step is executed, and then the code execution result is obtained. It can be understood that the device modules of the electronic device are not only the code executor. For the process from obtaining the test request to executing the step code, the responsibilities of each device module are different, and together they support the effective response of the electronic device to the test request. For example, the step code corresponding to the current test step can be determined by the use case compiler based on the current test step.

[0107] The current test case carried by the above-mentioned test request can be written by the staff. As Figure 7 shown, the tester can use a mind map editing tool to write test cases. As Figure 8 shown, the developer can use an extended IDE plugin to edit the metadata corresponding to the test case and the visual mind map at the same time. Of course, the developer can also use a plain text editing tool to write use cases. The forms of the use cases written by the staff are diverse, and they can all be converted into corresponding metadata through an editing converter. The editing converter can also be a device module, which is responsible for providing diverse use case editing forms to cope with different use case writing scenarios and finally converting them into corresponding metadata.

[0108] The test solution provided by the embodiments of the present application can be used for automated testing, which can greatly improve the effectiveness and accuracy of automated testing, and at the same time reduce the cost and error probability of automated testing implementation and maintenance. The data formats of the test steps in the test step set are consistent, which is convenient for managing these test steps and is also conducive to the timeliness of updates. The step code automatically executed by the device and the step code manually executed by the staff can indicate the same test step. Through the test step, the actually executed step code can be associated with different execution methods, which can avoid the problem that the use case steps are not synchronized in time and then become invalid due to different execution methods. The step codes executed in different execution environments can also indicate the same test step, and it is not necessary to manage the step code partition by the execution environment dimension, which can reduce the management cost. Through the test solution provided by the embodiments of the present application, it is also possible to respond to the situation where the test request involves multiple execution environments.

[0109] In the test solution provided by the embodiments of the present application, at the data level, by providing a text format with custom advanced syntax, diverse test cases are stored in a unified format in terms of the use case step dimension. The differences in the execution methods and execution environments of test cases can be no longer distinguished. At the execution level, such text-format test steps can determine the corresponding step code when actual execution is required, distribute and execute the step code based on the execution environment, and generate a test report based on the respective code execution results of the relevant step codes. The step code corresponding to the test step can be obtained through real-time conversion; it can also be obtained based on the index of the storage location of the step code. The storage location of the step code records the storage location of the step code corresponding to the test step, and the step code corresponding to the test step can be determined through pre-conversion or extracted from the test case. At the implementation level, from the test step to the corresponding step code, different business scenarios and execution environments can be compatible, realizing the reuse of test steps.

[0110] As can be seen from the technical solutions provided by the embodiments of the present application above, the embodiments of the present application provide a more efficient and more adaptable test solution. In the embodiments of the present application, a test request is obtained, and the test request includes at least one step description information; then, at least one target test step is determined from the test step set based on at least one business function class information; next, for each target test step, the step code corresponding to the target test step is determined based on the step description information to obtain at least one target step code; furthermore, for each target step code, the target step code is distributed to the corresponding target device according to the execution environment class information, so that the target step code is executed in the target device. The test steps in the test step set are metadata in text format, and the maintenance of test steps is realized by using the metadata in text format. On this basis, by virtue of the easy convertibility of test steps and the independence of the test step dimension, it is beneficial to improve the preparation efficiency of the use case code before testing by reusing test steps, thereby improving the test efficiency. At the same time, each step description information includes a business function class information and an execution environment class information, and the connotation of the step description information ensures the adaptability of the step code corresponding to the target test step in terms of business scenarios and execution environments, thus improving the adaptability of the test.

[0111] The embodiments of the present application also provide a test device, as Figure 17 shown. The test device 170 includes:

[0112] An acquisition module 1701: configured to acquire a test request, where the test request includes at least one step description information, and each step description information includes a business function class information and an execution environment class information;

[0113] Test step determination module 1702: configured to determine at least one target test step from a set of test steps based on at least one of the service function class information, where the at least one target test step corresponds one-to-one to the at least one service function class information, and the test steps in the set of test steps are metadata in text format;

[0114] Step code determination module 1703: configured to, for each of the target test steps, determine the step code corresponding to the target test step based on the step description information, so as to obtain at least one target step code;

[0115] Step code execution module 1704: configured to, for each of the target step codes, distribute the target step code to the corresponding target device according to the execution environment class information, so that the target step code is executed in the target device.

[0116] In one embodiment, the at least one target step code is distributed to at least one of the target devices, and the apparatus further includes a report generation module, where the report generation module: is configured to, after distributing the target step code to the corresponding target device according to the execution environment class information for each of the target step codes, so that the target step code is executed in the target device, receive the code execution results respectively returned by the at least one target device to obtain a set of code execution results; generate a test report based on the set of code execution results.

[0117] In one embodiment, the step code determination module: is configured to determine at least one service parameter based on the service function class information; determine the corresponding stack environment based on the execution environment class information; convert the target test step according to a preset conversion rule to obtain the step code corresponding to the target test step, where the step code corresponding to the target test step carries the at least one service parameter and adapts to the stack environment.

[0118] In one embodiment, the at least one step description information is a plurality of the step description information, the first step description information and the second step description information are any two of the plurality of the step description information, the first step description information includes first service function type information and first execution environment type information, the second step description information includes second service function type information and second execution environment type information, and the apparatus further includes a sequential execution module, and the sequential execution module: is configured to distribute the target step code corresponding to the first step description information to a corresponding first device according to the first execution environment type information, so that the target step code corresponding to the first step description information is executed in the first device; receive a code execution result returned by the first device, and update the second service function type information based on the returned code execution result to obtain third service function type information; update the second step description information based on the third service function type information to obtain a third step description information; determine a step code corresponding to a candidate test step based on the third step description information, where the candidate test step is the target test step corresponding to the second step description information; and distribute the step code corresponding to the candidate test step to a corresponding second device according to the second execution environment type information, so that the step code corresponding to the candidate test step is executed in the second device.

[0119] In one embodiment, the test steps in the test step set are obtained through the following steps: extracting key information from a sample test case, where the dimensions of the key information include at least one of the following: execution element dimension, use case dimension, use case step dimension, and logical branch dimension; extracting keywords corresponding to each of the key information in a preset keyword set, and combining the key information with the corresponding keywords to obtain target metadata corresponding to the sample test case, where the target metadata is text format data for storing the sample test case; extracting at least one metadata segment from the target metadata, and determining that the metadata segment is a test step for constructing the test step set, where the metadata segment indicates a use case step text in the sample test case.

[0120] In one embodiment, the extracting at least one metadata segment from the target metadata includes: generating an abstract syntax tree corresponding to the target metadata; performing logical operation processing on the abstract syntax tree to obtain the at least one metadata segment, where the logical operation processing indicates substituting execution parameters carried by the sample test case and performing logical branch calculation.

[0121] In one embodiment, after performing logical operation processing on the abstract syntax tree to obtain the at least one metadata segment, the apparatus is further configured to: when the sample test case is executable code, determine a code segment corresponding to the metadata segment from the executable code, and establish an association relationship between the metadata segment and the code segment;

[0122] The step code determination module: is configured to determine that the target code segment is the step code corresponding to the target test step when the target code segment meets the requirements of the step description information, and the target code segment is a code segment associated with the target test step.

[0123] It should be noted that the apparatus in the apparatus embodiment and the method embodiment are based on the same inventive concept.

[0124] In some embodiments, the functions or modules included in the apparatus provided in the embodiments of the present application can be used to execute the methods described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments. For the sake of brevity, it will not be repeated here.

[0125] The embodiments of the present application further provide a computer-readable storage medium. At least one instruction or at least one program segment is stored in the computer-readable storage medium, and the at least one instruction or at least one program segment is loaded and executed by a processor to implement the above method. The computer-readable storage medium can be a non-volatile computer-readable storage medium.

[0126] The embodiments of the present application further provide an electronic device. The electronic device includes at least one processor and a memory communicatively connected to the at least one processor; wherein, at least one instruction or at least one program segment is stored in the memory, and the at least one instruction or at least one program segment is loaded and executed by the at least one processor to implement the above method.

[0127] The electronic device can be provided as a terminal, a server or other forms of devices.

[0128] Figure 18 A block diagram of an electronic device according to an embodiment of the present application is shown. Referring to Figure 18 , the electronic device 1900 includes a processing component 1922, which further includes one or more processors, and memory resources represented by a memory 1932 for storing instructions executable by the processing component 1922. In addition, the processing component 1922 is configured to execute instructions to perform the above method.

[0129] The electronic device 1900 may further include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output (I / O) interface 1958. The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM or the like.

[0130] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as the memory 1932 including computer program instructions, and the computer program instructions can be executed by the processing component 1922 of the electronic device 1900 to complete the above method.

[0131] This application may be a system, a method, and / or a computer program product. The computer program product may include a computer-readable storage medium having thereon at least one instruction or at least one segment of a program for causing a processor to implement various aspects of this application.

[0132] A computer-readable storage medium may be a tangible device that can retain and store instructions for use by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disc (DVD), a memory stick, a floppy disk, a mechanically encoded device, such as a punch card or raised structures in grooves storing instructions thereon, and any suitable combination of the foregoing. The computer-readable storage medium used herein is not construed as an instantaneous signal itself, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagated through a waveguide or other transmission medium (e.g., an optical pulse through an optical fiber cable), or an electrical signal transmitted through a wire.

[0133] At least one instruction or at least one program described herein can be downloaded from a computer-readable storage medium to various computing / processing devices, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter or network interface in each computing / processing device receives at least one instruction or at least one program from the network and forwards the at least one instruction or at least one program for storage in a computer-readable storage medium in each computing / processing device.

[0134] At least one instruction or at least one program for performing the operations of the present application can be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state-setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. At least one instruction or at least one program can be executed entirely on a user's computer, partially on a user's computer, executed as a stand-alone software package, partially on a user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., by using an Internet service provider to connect through the Internet). In some embodiments, by using the state information of at least one instruction or at least one program to customize an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), the electronic circuit can execute at least one instruction or at least one program to implement various aspects of the present application.

[0135] Aspects of the present application are described herein with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to embodiments of the present application. It should be understood that each block of the flowcharts and / or block diagrams, and the combinations of blocks in the flowcharts and / or block diagrams, can be implemented by at least one instruction or at least one program.

[0136] The at least one instruction or at least one program segment can be provided to a processor of a general purpose computer, a special purpose computer, or other programmable data processing apparatus to produce a machine such that execution of the instructions by the processor of the computer or other programmable data processing apparatus results in an apparatus for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. The at least one instruction or at least one program segment can also be stored in a computer-readable storage medium that directs a computer, a programmable data processing apparatus, and / or other devices to function in a particular manner, such that the computer-readable medium storing the instructions comprises a manufacture, including instructions for implementing various aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.

[0137] The at least one instruction or at least one program segment can also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other devices to produce a computer-implemented process such that the instructions executed on the computer, other programmable data processing apparatus, or other devices implement the functions / actions specified in one or more blocks of the flowchart and / or block diagram.

[0138] The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagram may represent a module, a segment of code, or a portion of an instruction, and the above-mentioned module, segment of code, or portion of an instruction includes one or more executable instructions for implementing the specified logical function. In some alternative implementations, the functions noted in the blocks may occur out of the order noted in the figures. For example, two consecutive blocks may in fact be executed substantially in parallel, or they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented by a dedicated hardware-based system for performing the specified functions or actions, or by a combination of dedicated hardware and computer instructions.

[0139] The embodiments of the present application have been described above. The above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The choice of terms used herein is intended to best explain the principles of the embodiments, the practical application, or improvements made to the technology in the market, or to enable other ordinary skilled persons in the art to understand the embodiments disclosed herein.

Claims

1. A testing method, characterized in that, The method includes: Obtaining a test request, where the test request includes at least one step description information, and each piece of the step description information includes a business function type information and an execution environment type information; Determining at least one target test step from a test step set based on at least one of the business function type information, where the at least one target test step corresponds one-to-one to the at least one business function type information, and the test steps in the test step set are metadata in text format; For each of the target test steps, determining a step code corresponding to the target test step based on the step description information to obtain at least one target step code; For each of the target step codes, distributing the target step code to a corresponding target device according to the execution environment type information, so that the target step code is executed in the target device.

2. The method according to claim 1, wherein After the at least one target step code is distributed to at least one of the target devices, and for each of the target step codes, after distributing the target step code to a corresponding target device according to the execution environment type information so that the target step code is executed in the target device, the method further includes: Receiving code execution results respectively returned by the at least one target device to obtain a code execution result set; Generating a test report based on the code execution result set.

3. The method according to claim 1 or 2, characterized in that, The determining the step code corresponding to the target test step based on the step description information includes: Determining at least one business parameter based on the business function type information; Determining a corresponding stack environment based on the execution environment type information; Converting the target test step based on a preset conversion rule to obtain a step code corresponding to the target test step, where the step code corresponding to the target test step carries the at least one business parameter and is adapted to the stack environment.

4. The method according to claim 1 or 2, characterized in that, The at least one step description information is multiple pieces of the step description information. The first step description information and the second step description information are any two of the multiple pieces of the step description information. The first step description information includes a first business function type information and a first execution environment type information, and the second step description information includes a second business function type information and a second execution environment type information. The method further includes: Distributing the target step code corresponding to the first step description information to a corresponding first device according to the first execution environment type information, so that the target step code corresponding to the first step description information is executed in the first device; Receiving the code execution result returned by the first device, and updating the second business function type information based on the returned code execution result to obtain a third business function type information; Updating the second step description information based on the third business function type information to obtain a third step description information; Determining a step code corresponding to a candidate test step based on the third step description information, where the candidate test step is the target test step corresponding to the second step description information; Distribute the step code corresponding to the candidate test step to the corresponding second device according to the second execution environment class information, so that the step code corresponding to the candidate test step is executed in the second device.

5. The method according to claim 1 or 2, characterized in that, The test steps in the test step set are obtained through the following steps: Extract the key information in the sample test case, and the dimensions of the key information include at least one of the following: execution element dimension, use case dimension, use case step dimension, and logical branch dimension; Extract the keyword corresponding to each piece of key information from the preset keyword set, and combine the key information with the corresponding keyword to obtain the target metadata corresponding to the sample test case. The target metadata is the text format data used to store the sample test case; Extract at least one metadata segment from the target metadata, and determine that the metadata segment is used to construct the test steps in the test step set. The metadata segment indicates the use case step text in the sample test case.

6. The method according to claim 5, wherein The extracting at least one metadata segment from the target metadata includes: Generate an abstract syntax tree corresponding to the target metadata; Perform logical operation processing on the abstract syntax tree to obtain the at least one metadata segment. The logical operation processing indicates substituting the execution parameters carried by the sample test case and performing logical branch calculation.

7. The method according to claim 6, characterized in that, After performing the logical operation processing on the abstract syntax tree to obtain the at least one metadata segment, the method further includes: In the case where the sample test case is executable code, determine the code segment corresponding to the metadata segment from the executable code, and establish an association relationship between the metadata segment and the code segment; The determining the step code corresponding to the target test step based on the step description information includes: In the case where the target code segment meets the requirements of the step description information, determine that the target code segment is the step code corresponding to the target test step. The target code segment is the code segment associated with the target test step.

8. A testing method, characterized in that, The device includes: An acquisition module: used to acquire a test request, where the test request includes at least one step description information, and each piece of step description information includes a service function class information and an execution environment class information; A test step determination module: used to determine at least one target test step from the test step set based on at least one piece of the service function class information. The at least one target test step corresponds one-to-one with the at least one piece of the service function class information. The test steps in the test step set are metadata in text format; A step code determination module: used to, for each target test step, determine the step code corresponding to the target test step based on the step description information to obtain at least one target step code; A step code execution module: used to, for each target step code, distribute the target step code to the corresponding target device according to the execution environment class information, so that the target step code is executed in the target device.

9. An electronic device, characterized in that, The electronic device includes at least one processor and a memory communicatively connected to the at least one processor; wherein, at least one instruction or at least one program segment is stored in the memory, and the at least one instruction or at least one program segment is loaded and executed by the at least one processor to implement the test method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, At least one instruction or at least one program segment is stored in the computer-readable storage medium, and the at least one instruction or at least one program segment is loaded and executed by a processor to implement the test method as described in any one of claims 1-7.

Citation Information

Cited By

  • Test case execution method and device, equipment and medium

    CN121880219A