A method and apparatus for use case execution processing
By implementing synchronous processing methods and devices for interfaces and message classes, the time-consuming problem in existing automated testing frameworks is solved, enabling efficient management and rapid migration of test cases, and improving the automation level and efficiency of testing.
Patent Information
- Application Number
- CN202210997197.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-19
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2042-08-19
AI Technical Summary
Existing automated testing frameworks cannot effectively handle the synchronization process of interfaces and message classes, resulting in time-consuming tests and difficulties in rapid migration and sharing.
A method and apparatus for test case execution processing are provided. By querying the step identifier corresponding to the test case identifier, step data is obtained, and each step is executed by calling the interface or message method in the order of operation number. It supports the addition, modification, deletion, copying and group management of test cases, and uses the encapsulated interface to handle asynchronous message classes.
It enables synchronous processing of interfaces and message classes, reducing test case maintenance costs and writing difficulty, and improving the automation and efficiency of testing.
Smart Images

Figure CN115373986B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a use case execution processing method and apparatus. Background Technology
[0002] The core of the system is data. Besides interface classes, most calls between different systems require asynchronous message classes to trigger. Consider a test process that involves both interfaces and messages, with most messages triggered by interfaces. Therefore, for this type of system, both interface classes and message classes need to be treated as a test step.
[0003] Existing automated testing frameworks largely adopt the design principles of the open-source TestNG framework. However, TestNG's automated testing process mostly only supports API calls. When there are many test cases to maintain, execution requires starting a service, which is time-consuming and slow. Furthermore, TestNG assembles the data retrieval interfaces sequentially according to the data retrieval process. Asynchronous system message classes and specific business interface operations still require secondary development or manual intervention, making it difficult to quickly migrate and share with third parties. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a test case execution processing method and apparatus, which can at least solve the problem that there is no fully automated test design framework for interface and message synchronization processing in the prior art.
[0005] To achieve the above objectives, according to one aspect of the present invention, a use case execution processing method is provided, comprising:
[0006] In response to the execution operation of the use case, query one or more step identifiers corresponding to the identifier of the use case;
[0007] Obtain the step data corresponding to each step identifier; wherein, the step data includes operation sequence number, operation type and basic information, and the operation type is interface type or message type;
[0008] In ascending order of operation number, the execution interface method corresponding to the interface type or the message sending method corresponding to the message type is called sequentially to execute the basic information of each step and obtain the test case execution result.
[0009] Optionally, before querying one or more step identifiers corresponding to the identifier of the use case, the method further includes:
[0010] In response to the addition of a new use case operation, a use case identifier is created for the new use case, and basic information configured for the new use case is received to obtain use case data;
[0011] In response to the operation on the newly added use case creation step, an operation sequence number and step identifier are created for the step, and the operation type and basic information configured for the step are received to obtain step data;
[0012] Establish a correspondence between use case identifiers and step identifiers, and store the correspondence, use case data, and step data in a database.
[0013] Optional, also includes:
[0014] In response to the selection operation of the first use case, query the step identifier of one or more steps corresponding to the identifier of the first use case, obtain the step data of each step, and display it;
[0015] Receive a selection operation for a target step in one or more steps; in response to a modification operation for the target step, display the operation type and basic information configured for the target step to receive modification information; or
[0016] In response to the deletion operation on the target step, the identifier of the target step is deleted from the correspondence, the step data of the target step is deleted from the database, and the operation sequence numbers of other steps in the one or more steps are adjusted; or
[0017] In response to the replication of the target step to a use case operation, a second use case is determined, a correspondence is established between the identifier of the target step and the identifier of the second use case, and the target step is set as the latest step of the second use case; or
[0018] In response to the up or down operation of the target step, after the up or down operation of the target step is completed, the operation sequence number of the target step and other steps in the one or more steps is adjusted.
[0019] Optionally, the response to adding a new use case operation includes: in response to a selection operation of a target group in the grouping list, receiving an operation to add a new use case in the target group;
[0020] The method further includes: establishing a correspondence between the identifier of the target group and the identifier of the use case, and storing the correspondence in a database.
[0021] Optionally, the basic information of the use case includes the use case name, and the method further includes:
[0022] In response to the selection operation of the target use case under the first group, query the step identifier of one or more steps corresponding to the identifier of the target use case;
[0023] In response to the deletion operation on the target use case, the correspondence associated with the identifier of the target use case is deleted, and the use case data of the target use case is deleted from the database; or
[0024] In response to the copy operation of the target use case to a group, a second group is determined, a correspondence is established between the identifier of the second group and the identifier of the target use case, and a preset field is added after the use case name of the target use case copied to the second group.
[0025] Optional, also includes:
[0026] Determine the business scenario to which each step belongs under the use case, and encapsulate the step data of one or more steps under the use case according to the parent-child relationship between business scenarios to obtain the encapsulated interface;
[0027] One or more of the steps are combined into one step, and the operation sequence numbers of the combined step and other steps under the use case are adjusted.
[0028] During the execution of the test case, in response to the step to be executed being a merged step, the encapsulated interface is called to obtain the step data of the one or more steps and execute the basic information of each step.
[0029] To achieve the above objectives, according to another aspect of the present invention, a use case execution processing apparatus is provided, comprising:
[0030] The query module is used to query one or more step identifiers corresponding to the identifier of the use case in response to the execution operation of the use case;
[0031] The acquisition module is used to acquire the step data corresponding to each step identifier; the step data includes the operation sequence number, operation type and basic information, and the operation type is either interface type or message type.
[0032] The execution module is used to sequentially call the execution interface method corresponding to the interface type or the message sending method corresponding to the message type in ascending order of operation number, in order to execute the basic information of each step and obtain the test case execution result.
[0033] Optionally, a configuration module is also included for:
[0034] In response to the addition of a new use case operation, a use case identifier is created for the new use case, and basic information configured for the new use case is received to obtain use case data;
[0035] In response to the operation on the newly added use case creation step, an operation sequence number and step identifier are created for the step, and the operation type and basic information configured for the step are received to obtain step data;
[0036] Establish a correspondence between use case identifiers and step identifiers, and store the correspondence, use case data, and step data in a database.
[0037] Optionally, the configuration module is further configured to:
[0038] In response to the selection operation of the first use case, query the step identifier of one or more steps corresponding to the identifier of the first use case, obtain the step data of each step, and display it;
[0039] Receive a selection operation for a target step in one or more steps; in response to a modification operation for the target step, display the operation type and basic information configured for the target step to receive modification information; or
[0040] In response to the deletion operation on the target step, the identifier of the target step is deleted from the correspondence, the step data of the target step is deleted from the database, and the operation sequence numbers of other steps in the one or more steps are adjusted; or
[0041] In response to the replication of the target step to a use case operation, a second use case is determined, a correspondence is established between the identifier of the target step and the identifier of the second use case, and the target step is set as the latest step of the second use case; or
[0042] In response to the up or down operation of the target step, after the up or down operation of the target step is completed, the operation sequence number of the target step and other steps in the one or more steps is adjusted.
[0043] Optionally, the configuration module is further configured to:
[0044] In response to a selection operation on a target group in the grouping list, an operation to add a use case to the target group is received; and
[0045] Establish a correspondence between the identifiers of the target groups and the identifiers of the use cases, and store the correspondence in the database.
[0046] Optionally, the basic use case information includes the use case name. The configuration module is also used for:
[0047] In response to the selection operation of the target use case under the first group, query the step identifier of one or more steps corresponding to the identifier of the target use case;
[0048] In response to the deletion operation on the target use case, the correspondence associated with the identifier of the target use case is deleted, and the use case data of the target use case is deleted from the database; or
[0049] In response to the copy operation of the target use case to a group, a second group is determined, a correspondence is established between the identifier of the second group and the identifier of the target use case, and a preset field is added after the use case name of the target use case copied to the second group.
[0050] Optionally, a packaging module may also be included for:
[0051] Determine the business scenario to which each step belongs under the use case, and encapsulate the step data of one or more steps under the use case according to the parent-child relationship between business scenarios to obtain the encapsulated interface;
[0052] One or more of the steps are combined into one step, and the operation sequence numbers of the combined step and other steps under the use case are adjusted.
[0053] During the execution of the test case, in response to the step to be executed being a merged step, the encapsulated interface is called to obtain the step data of the one or more steps and execute the basic information of each step.
[0054] To achieve the above objectives, according to another aspect of the present invention, a use case execution processing electronic device is provided.
[0055] The electronic device of this invention includes: one or more processors; and a storage device for storing one or more programs, which, when executed by the one or more processors, cause the one or more processors to implement any of the above-described use case execution processing methods.
[0056] To achieve the above objectives, according to another aspect of the present invention, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements any of the use case execution processing methods described above.
[0057] According to the solution provided by the present invention, one embodiment of the above invention has the following advantages or beneficial effects: the step data of one or more steps is encapsulated, and the step data of the corresponding steps can be obtained at one time when the test case is executed. Furthermore, different methods are called to execute the step data of different operation types, namely interface class and message class, which solves the problem that test cases cannot be automatically tested, and at the same time reduces the maintenance cost and writing difficulty of test cases.
[0058] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description
[0059] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein:
[0060] Figure 1(a) is a diagram of grouping-use cases-steps;
[0061] Figure 1(b) is a schematic diagram of the basic information for the configuration steps;
[0062] Figure 1(c) is a schematic diagram of the options for the operation use case;
[0063] Figure 2 This is a diagram illustrating the underlying data hierarchy.
[0064] Figure 3 This is a schematic diagram of the main flow of a use case execution processing method according to an embodiment of the present invention;
[0065] Figure 4 This is a schematic diagram of the system framework of an embodiment of the present invention;
[0066] Figure 5 This is a schematic diagram of the main modules of a use case execution processing device according to an embodiment of the present invention;
[0067] Figure 6 This is an exemplary system architecture diagram in which embodiments of the present invention can be applied;
[0068] Figure 7 This is a schematic diagram of the structure of a computer system suitable for implementing the embodiments of the present invention, such as a mobile device or server. Detailed Implementation
[0069] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0070] It should be noted that, unless otherwise specified, the embodiments and features described in the present invention can be combined with each other. The acquisition, storage, use, and processing of data (such as user personal information) in the technical solutions of this application comply with relevant national laws and regulations and do not violate public order and good morals.
[0071] Interface classes provide rules for retrieving data, allowing users to obtain the corresponding data based on these rules. Message classes broadcast data, allowing users to retrieve data according to their needs. Messages are asynchronous. For example, when a user places an order and makes payment, the transaction needs to be recorded only after receiving a payment completion message. Asynchronous message classes, however, can record the transaction immediately after sending the payment message without waiting for a reply.
[0072] Test cases are implemented in code to verify that the functions provided by the system are available. For example, in the order placement function, a user successfully purchasing a mobile phone is one such test case. As the system's business functions become more complex and the number of test cases increases, all of these test cases need to be launched during automated system testing, which can lead to time-consuming and slow startup issues.
[0073] This solution prioritizes customizing test cases on the page, including their group ID, test case ID, and step IDs within the test case. It then calls the backend management service interface to store these data in a MongoDB database. Later, users can enter the test case ID on the page to retrieve the corresponding test case data from the database for display.
[0074] Referring to Figure 1(a), users first create groups on the page, such as the "Add Group" option in the upper left corner. Different groups are used to manage use cases of different types of CaseType. For example, order placement, payment, and accounting is a complete process, so it is grouped into one group, while text description is a process, so it is grouped into another group.
[0075] After creating a group, the user can select one of the groups from the group list; let's say the user selects group 1. On the right side of the page, users can choose to add a test case using various methods such as "+" or "right-click and select 'Add Test Case'". This adds a test case to the page, and the system automatically assigns an ID to uniquely identify it. Users can configure basic information for the test case, such as the test case name, description, status, creator, and time, to form the test case data.
[0076] Assuming the user creates a new use case called Demo1, one or more steps are created for use case Demo1 based on the actual scenario, with operation numbers increasing sequentially, such as 1, 2, 3, 4. The system automatically assigns an ID to each step; this ID can be monotonically increasing or randomly generated, as long as it is unique. For each step, the user adds an operation type and configures basic information as needed, such as interface type (interface) and message type (jmq). The basic information is shown in Figure 1(b), including the step name "XXX" and the use case name "Step 4 - Send Message mq2" (this use case name is a process step in Demo1 and can be considered a small use case). The application, username, password, message body, and return value can be defined as needed to form the step data for Step 4.
[0077] After creation, the mapping between group ID and use case ID, along with group information, is stored in the group table. Similarly, the mapping between use case ID and step ID, along with use case data, is stored in the use case table. The mapping between use case ID and step ID, along with step data, is stored in the step table. While it's possible to create the mapping between group ID, use case ID, and step ID and store group data, use case data, and step data together, this could lead to data clutter and difficulty in management. Therefore, this solution preferentially adopts the aforementioned storage method.
[0078] This solution also supports basic operations such as modifying, deleting, copying, and querying test cases (supporting test case name and ID queries). See Figure 1(c). Clicking the Action option "…" in the row containing test case Demo1 will bring up options for executing the test case, execution results, modifying the test case, copying the test case, copying to a group, adding an interface, adding a message queue, and deleting the test case. 1) Selecting "Modify Test Case" displays the basic information of test case Demo1 and steps 1-4 for the user to modify, such as changing the test case name, adding steps, deleting steps, or modifying steps. 2) Selecting "Delete Test Case" deletes the mapping associated with the identifier of test case Demo1 and removes its test case data from the test case table. 3) Selecting "Copy to Group" copies the data of test case Demo1 to the target group, which can be Group 2 or its own Group 1. If copied to Group 1, the word "Copy" will be added after the test case name "Test Case Demo1," as shown in the figure "Test Case Demo1_Copy." If copied to Group 2, a mapping relationship will be established between the identifier of test case Demo1 and Group 2. This method facilitates test case sharing.
[0079] This solution also supports more granular use case maintenance. Each step under a use case supports basic operations such as modification, deletion, and querying, as well as copying to other use cases. Assuming the user selects use case Demo1, each step under use case Demo1 will be retrieved from the database and displayed, as shown in Figure 1(a). Clicking the Action option "…" in the row containing step 4 will bring up options for modifying the step, copying the step, copying to the use case, deleting the step, moving the step up, and moving the step down. 1) If the "Modify Step" option is selected, the Step 1(b) interface will pop up for the user to modify. 2) If the "Delete Step" option is selected, the data for step 4 will be deleted from the step table, the correspondence between step 4 and use case Demo1 will be deleted, and the sequence numbers of other steps following step 4 will be adjusted. Since these steps do not exist here, no adjustment is needed. 3) If the "Copy to Use Case" option is selected, assuming it's copied to use case Demo2, a mapping between step 4 and use case Demo1 will be established and stored in the step table. If use case Demo2 originally had two steps, the copied step 4 will become step 3 of use case Demo2. 4) If the user chooses to move a step up, step 4 will be moved to the original position of step 3, and the original step 3 will be moved to the position of step 4. Therefore, after one move, the sequence numbers of the original steps 3 and 4 will change to steps 4 and 3, respectively. If the user chooses to continue moving up, the position of the current step 3 will continue to be adjusted. After the first move, the sequence numbers of steps 2, 3, and 4 will change to 3, 2, and 4. The same logic applies to moving steps down; this solution will not be described here. Step orchestration management is achieved through moving steps up and down.
[0080] The above all pertain to underlying data management, which is supported by interfaces provided by the backend management service. For a detailed explanation of the underlying data hierarchy, please refer to [link to relevant documentation]. Figure 2 As shown, the objects include Group objects, Case objects, CaseResult objects, Step objects, Interface objects, and Mq message objects. The Group object includes a Group ID, the Case ID for each Group ID, and a GroupDto (DTO, Data Transfer Object). The Case object includes a Case ID, the Step ID for each Case ID, and a CaseDto. The Step object includes a Step ID, a Case ID, and a StepDto. The Interface object includes an Interface ID, a Step ID, and an InterfaceDto; the Mq message object includes a Message ID, a Step ID, and an MqDto. The CaseResult object includes a Result ID, a Case ID, and a ResultDto.
[0081] See Figure 3 The diagram shows the main flowchart of a use case execution processing method provided by an embodiment of the present invention, which includes the following steps:
[0082] S301: In response to the execution operation of the use case, query one or more step identifiers corresponding to the identifier of the use case;
[0083] S302: Obtain the step data corresponding to each step identifier; wherein, the step data includes the operation sequence number, operation type and basic information, and the operation type is either interface type or message type;
[0084] S303: In ascending order of operation number, call the execution interface method corresponding to the interface type or the message sending method corresponding to the message type in sequence to execute the basic information of each step and obtain the test case execution result.
[0085] In the above implementation, for steps S301 to S303, to manage use cases by category, this solution creates groups, and different types of use cases are stored under different groups. Each group and each use case is also assigned a unique ID. Taking Figure 1(c) as an example, the user clicks the "Execute Use Case" option in the Action option of the row where use case Demo1 is located to trigger the execution operation of use case Demo1.
[0086] As described above, a use case will have one or more steps, and each step will also be configured with corresponding basic information and operation type. The correspondence between step ID and use case ID can be queried from the step table to query the step data of each step based on the correspondence. The step data includes step ID, step sequence number, operation type and basic information.
[0087] For each step, the execution engine determines whether the operation type is an interface (e.g., the HTTP / JSF interface in Figure 1(a)) or a message queue (e.g., the JMQ in Figure 1(a)) to distinguish between triggers that call an interface or a message class. If it is an interface type, the execution interface method is called; if it is a message type, the message sending method is called. The triggers for interfaces or messages are encapsulated request initiation services that encapsulate the incoming test case data body into the corresponding interface request (e.g., an HTTP request) or message body (e.g., an MQ message body) for asynchronous invocation.
[0088] Based on the ascending order of the step numbers, the execution engine calls the interface or message for each step in sequence. Taking Figure 1(a) as an example, executing test case Demo1 involves executing step 1 first, then step 2, then step 3, and finally step 4. Each step calls a different method, and the test case execution requires specific interface or message data bodies (containing all input parameters for interface execution or message sending). After all steps are completed, the test case execution result is obtained, indicating success or failure, and is displayed to the user.
[0089] This solution pre-defines a tree-like classification tree for business scenarios, where scenarios can be related as parent and child or be independent. Users can categorize business scenarios and customize criteria according to their needs. Some test cases may require multiple steps, necessitating multiple retrievals of step data from the database. This solution merges one or more steps into a single step based on the defined business scenario relationships. Therefore, the interfaces called during test case execution are not services directly provided by the tested business system. Instead, after categorizing business scenarios, core or common business blocks are extracted and encapsulated into atomic interfaces for test case execution, enabling the integration of automated test case orchestration.
[0090] For example, a use case might include order placement, payment, and accounting steps. Based on the business scenario classification tree, order placement and payment can be combined into one step. Therefore, an atomic service interface is provided. Use case execution steps can be directly orchestrated through this interface, and subsequent calls to this interface will retrieve both order placement and payment step data in one go. This avoids multiple database connections for value retrieval during use case execution, reducing the complexity of use case orchestration.
[0091] The method provided in the above embodiments manages test cases for interface and message classes through a page platform, supports copying test cases to groups and steps to test cases, making test case management more efficient and convenient, and avoiding mutual interference between test cases at the code script level; it calls different backend services for test cases of different operation types to perform synchronous or asynchronous execution, solving the problem that asynchronous message test cases cannot be automated, making the test scope more comprehensive and the test operation more convenient.
[0092] See Figure 4 The diagram illustrates a system design framework flowchart according to an embodiment of the present invention, which is divided into three parts: a use case management platform, a use case management backend, and an inter-operation service.
[0093] 1. The test case management platform is preferably set up as a web page. Users can write test case data (the steps required for the test case and the step data) on this page, classify the test cases, implement test case groups, copy the test cases to this group or other groups, and execute the test cases to obtain the test case results.
[0094] 2. The test case management platform stores the written test cases, groups, step data, and their corresponding relationships in the MongoDB database. When a user selects a test case execution option in the test case management platform, it retrieves step data for one or more associated steps from MongoDB based on the test case identifier. Then, it analyzes the operation type in each step data to determine whether it is an interface or a message queue (MQ), and calls the corresponding interface service or MQ service to execute the step data, obtaining the test case execution result.
[0095] 3. Inter-operation service: This is a custom service that can take various forms depending on the business scenario. It includes atomic business scenario encapsulation interfaces, use case data, and use case environments. The atomic business scenario encapsulation interface categorizes one or more steps and encapsulates their step data into a single interface, allowing subsequent access to all step data at once. The use case environment includes the business context for each step. For example, in order placement, payment, and accounting, order placement and payment belong to the same business scenario.
[0096] This solution designs a full-process automated test design framework for synchronous processing of interface and message classes. Users can define and edit the test sequence and steps through the front end and display the editing results. The back end handles specific business logic, such as executing steps, enabling automated testing of test cases on the same device. It also provides the ability to maintain and quickly execute test cases. Based on atomic business scenarios (i.e., small scenarios), it provides interstitial services, encapsulating the step data of one or more steps into separate interfaces for invocation. This avoids a large amount of repetitive business processing in test case writing, making test case writing simpler and clearer, thereby reducing the cost of test case writing and maintenance.
[0097] See Figure 5 The diagram shows a schematic representation of the main modules of a use case execution processing device 500 provided in an embodiment of the present invention, including:
[0098] The query module 501 is used to query one or more step identifiers corresponding to the identifier of the use case in response to the execution operation of the use case;
[0099] The acquisition module 502 is used to acquire step data corresponding to each step identifier; wherein, the step data includes operation sequence number, operation type and basic information, and the operation type is interface type or message type;
[0100] The execution module 503 is used to sequentially call the execution interface method corresponding to the interface type or the message sending method corresponding to the message type in ascending order of operation number, in order to execute the basic information of each step and obtain the test case execution result.
[0101] The apparatus for implementing the present invention further includes a configuration module, used for:
[0102] In response to the addition of a new use case operation, a use case identifier is created for the new use case, and basic information configured for the new use case is received to obtain use case data;
[0103] In response to the operation on the newly added use case creation step, an operation sequence number and step identifier are created for the step, and the operation type and basic information configured for the step are received to obtain step data;
[0104] Establish a correspondence between use case identifiers and step identifiers, and store the correspondence, use case data, and step data in a database.
[0105] In the apparatus of this invention, the configuration module is further configured to:
[0106] In response to the selection operation of the first use case, query the step identifier of one or more steps corresponding to the identifier of the first use case, obtain the step data of each step, and display it;
[0107] Receive a selection operation for a target step in one or more steps; in response to a modification operation for the target step, display the operation type and basic information configured for the target step to receive modification information; or
[0108] In response to the deletion operation on the target step, the identifier of the target step is deleted from the correspondence, the step data of the target step is deleted from the database, and the operation sequence numbers of other steps in the one or more steps are adjusted; or
[0109] In response to the replication of the target step to a use case operation, a second use case is determined, a correspondence is established between the identifier of the target step and the identifier of the second use case, and the target step is set as the latest step of the second use case; or
[0110] In response to the up or down operation of the target step, after the up or down operation of the target step is completed, the operation sequence number of the target step and other steps in the one or more steps is adjusted.
[0111] In the apparatus of this invention, the configuration module is further configured to:
[0112] In response to a selection operation on a target group in the grouping list, an operation to add a use case to the target group is received; and
[0113] Establish a correspondence between the identifiers of the target groups and the identifiers of the use cases, and store the correspondence in the database.
[0114] as well as
[0115] In response to the selection operation of the target use case under the first group, query the step identifier of one or more steps corresponding to the identifier of the target use case;
[0116] In response to the deletion operation on the target use case, the correspondence associated with the identifier of the target use case is deleted, and the use case data of the target use case is deleted from the database; or
[0117] In response to the copy operation of the target use case to a group, a second group is determined, a correspondence is established between the identifier of the second group and the identifier of the target use case, and a preset field is added after the use case name of the target use case copied to the second group.
[0118] The apparatus for implementing the present invention further includes a packaging module, used for:
[0119] Determine the business scenario to which each step belongs under the use case, and encapsulate the step data of one or more steps under the use case according to the parent-child relationship between business scenarios to obtain the encapsulated interface;
[0120] One or more of the steps are combined into one step, and the operation sequence numbers of the combined step and other steps under the use case are adjusted.
[0121] During the execution of the test case, in response to the step to be executed being a merged step, the encapsulated interface is called to obtain the step data of the one or more steps and execute the basic information of each step.
[0122] Furthermore, the specific implementation details of the device described in the embodiments of the present invention have been described in detail in the above-described method, so the details will not be repeated here.
[0123] Figure 6 An exemplary system architecture 600 to which embodiments of the present invention can be applied is shown, including terminal devices 601, 602, 603, network 604, and server 605 (only an example).
[0124] Terminal devices 601, 602, and 603 can be various electronic devices with displays and support for web browsing, and have various communication client applications installed. Users can use terminal devices 601, 602, and 603 to interact with server 605 through network 604 to receive or send messages, etc.
[0125] Network 604 is a medium used to provide a communication link between terminal devices 601, 602, 603 and server 605. Network 604 may include various connection types, such as wired or wireless communication links or fiber optic cables, etc.
[0126] Server 605 can be a server that provides various services. It should be noted that the methods provided in the embodiments of the present invention are generally executed by server 605, and correspondingly, the devices are generally set in server 605.
[0127] It should be understood that Figure 6 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0128] The following is for reference. Figure 7 It shows a schematic diagram of the structure of a computer system 700 suitable for implementing a terminal device of the present invention. Figure 7 The terminal device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0129] like Figure 7 As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 702 or programs loaded from storage section 708 into random access memory (RAM) 703. The RAM 703 also stores various programs and data required for the operation of the system 700. The CPU 701, ROM 702, and RAM 703 are interconnected via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0130] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, mouse, etc.; an output section 707 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 710 as needed so that computer programs read from it can be installed into the storage section 708 as needed.
[0131] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 709, and / or installed from removable medium 711. When the computer program is executed by central processing unit (CPU) 701, it performs the functions defined above in the system of this invention.
[0132] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0133] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0134] The modules described in the embodiments of the present invention can be implemented in software or hardware. The described modules can also be housed in a processor; for example, a processor can be described as including a query module, an acquisition module, and an execution module. The names of these modules do not necessarily limit the module itself; for example, the execution module can also be described as a "step data execution module".
[0135] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs that, when executed by the device, cause the device to perform any of the use case execution processing methods described above.
[0136] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A use case execution processing method characterized by comprising: include: In response to the execution operation of a use case, one or more step identifiers corresponding to the identifier of the use case are queried; wherein, the use cases are customized in advance on the page to establish a correspondence between use case identifiers and step identifiers, and the correspondence and use case data are stored in a use case table, and the correspondence and step data are stored in a step table; and the correspondence between group identifiers and user identifiers, and group data are stored in a group table; Obtain the step data corresponding to each step identifier; wherein, the step data includes operation sequence number, operation type and basic information, and the operation type is interface type or message type; In ascending order of operation number, the execution interface method corresponding to the interface type or the message sending method corresponding to the message type is called sequentially to execute the basic information of each step and obtain the test case execution result; This involves determining the business scenario to which each step belongs under the use case, and encapsulating the step data of one or more steps under the use case according to the parent-child relationship between business scenarios to obtain the encapsulated interface. One or more of the steps are combined into one step, and the operation sequence numbers of the combined step and other steps under the use case are adjusted. During the execution of the test case, in response to the step to be executed being a merged step, the encapsulated interface is called to obtain the step data of the one or more steps and execute the basic information of each step.
2. The method of claim 1, wherein, Before the query corresponds to one or more step identifiers of the use case identifier, the method further includes: In response to the addition of a new use case operation, a use case identifier is created for the new use case, and basic information configured for the new use case is received to obtain use case data; In response to the operation on the newly added use case creation step, an operation sequence number and step identifier are created for the step, and the operation type and basic information configured for the step are received to obtain step data; Establish a correspondence between use case identifiers and step identifiers, and store the correspondence, use case data, and step data in a database.
3. The method of claim 2, wherein, Also includes: In response to the selection operation of the first use case, query the step identifiers of one or more steps corresponding to the identifier of the first use case, obtain the step data of each step and display it; wherein, the first use case is a use case in the use case table; Receive a selection operation for a target step in one or more steps; in response to a modification operation for the target step, display the operation type and basic information configured for the target step to receive modification information; or In response to the deletion operation on the target step, the identifier of the target step is deleted from the correspondence, the step data of the target step is deleted from the database, and the operation sequence numbers of other steps in the one or more steps are adjusted; or In response to the replication of the target step to a use case operation, a second use case is determined, a correspondence is established between the identifier of the target step and the identifier of the second use case, and the target step is set as the latest step of the second use case; or In response to the up or down operation of the target step, after the up or down operation of the target step is completed, the operation sequence number of the target step and other steps in the one or more steps is adjusted.
4. The method according to claim 2 or 3, characterized in that, The response to the new use case operation includes: in response to the selection operation of a target group in the group list, receiving the operation of adding a new use case in the target group; The method further includes: establishing a correspondence between the identifier of the target group and the identifier of the use case, and storing the correspondence in a database.
5. The method of claim 4, wherein, Basic use case information includes the use case name, and the method also includes: In response to the selection operation of a target use case under the first group, query the step identifier of one or more steps corresponding to the identifier of the target use case; wherein, the first group is a group in a grouping table; In response to the deletion operation on the target use case, the correspondence associated with the identifier of the target use case is deleted, and the use case data of the target use case is deleted from the database; or In response to the copy operation of the target use case to a group, a second group is determined, a correspondence is established between the identifier of the second group and the identifier of the target use case, and a preset field is added after the use case name of the target use case copied to the second group.
6. A use case execution processing apparatus characterized by comprising: include: The query module is used to query one or more step identifiers corresponding to the identifier of the use case in response to the execution operation of the use case; wherein, the use cases are customized in advance on the page to establish the correspondence between use case identifiers and step identifiers, and the correspondence and use case data are stored in the use case table, and the correspondence and step data are stored in the step table; and the correspondence between group identifiers and user identifiers, and group data are stored in the group table; The acquisition module is used to acquire the step data corresponding to each step identifier; the step data includes the operation sequence number, operation type and basic information, and the operation type is either interface type or message type. The execution module is used to sequentially call the execution interface method corresponding to the interface type or the message sending method corresponding to the message type in ascending order of operation number, in order to execute the basic information of each step and obtain the test case execution result; This involves determining the business scenario to which each step belongs under the use case, and encapsulating the step data of one or more steps under the use case according to the parent-child relationship between business scenarios to obtain the encapsulated interface. One or more of the steps are combined into one step, and the operation sequence numbers of the combined step and other steps under the use case are adjusted. During the execution of the test case, in response to the step to be executed being a merged step, the encapsulated interface is called to obtain the step data of the one or more steps and execute the basic information of each step.
7. The apparatus of claim 6, wherein, It also includes a configuration module for: In response to the addition of a new use case operation, a use case identifier is created for the new use case, and basic information configured for the new use case is received to obtain use case data; In response to the operation on the newly added use case creation step, an operation sequence number and step identifier are created for the step, and the operation type and basic information configured for the step are received to obtain step data; Establish a correspondence between use case identifiers and step identifiers, and store the correspondence, use case data, and step data in a database.
8. An electronic device, comprising: include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-5.
9. A computer readable medium having stored thereon a computer program, characterized in that When the program is executed by the processor, it implements the method as described in any one of claims 1-5.
Citation Information
Patent Citations
Testing method and testing device of Android application programs
CN103049371A
Interface test method and device based on scene, computer device and medium
CN112181816A
