Method for generating and testing concurrent test case set for database, device and storage medium
By automatically combining the concurrent use cases to generate concurrent test case groups after tagging functional labels and operation labels, the time-consuming and labor-intensive design of traditional concurrent test case cases is solved, and efficient and comprehensive concurrent test case set generation and testing methods are achieved.
Patent Information
- Application Number
- CN202411748830.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2044-12-02
AI Technical Summary
Traditional concurrent test case design requires a lot of manpower and time, and it is difficult to fully cover the inter-functional concurrency problems in complex systems, affecting test coverage and product quality.
After marking the concurrent use cases with the function tag and the operation tag, it automatically combines and generates a concurrent test case group, and combines it according to the preset concurrency number to form a concurrent test case set for testing.
It realizes concurrent use case testing with multi-functional and multi-operation coverage, saves labor development costs, improves work efficiency, improves the quality and coverage of concurrent test cases, and makes full use of system resources to improve the execution efficiency of concurrent tests.
Smart Images

Figure CN119248656B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and device for generating and testing a concurrent test case set, an electronic device, a storage medium and a program product. Background Art
[0002] With the development of software systems, the functions are constantly enriched and improved, and the functional regression cases based on the system are also accumulating, making the resources of the regression case library more and more abundant. At present, the use of the regression case library basically stays in the regression iteration test of the version, and these effective and comprehensive test cases are not fully utilized. In addition, due to the increase in the scale and complexity of the software system, the concurrency problem between functions has gradually become prominent, and software concurrency testing is becoming more and more important.
[0003] Traditional concurrent test case design requires testers to analyze and evaluate based on their understanding of the different functions of the system, so as to predict possible concurrency problems, and then manually write concurrent test scripts to perform concurrent testing. This method obviously requires a lot of manpower and time for complex systems covering many functions, and if the understanding of the system function implementation is not in-depth or comprehensive, it will seriously affect the test coverage and cannot effectively guarantee the quality of the product. Summary of the invention
[0004] In view of the above problems, the present invention provides a method, device, electronic device, storage medium and program product for generating and testing a concurrent test case set.
[0005] According to the first aspect of the present invention, there is provided a method for generating and testing a concurrent test case set, comprising the following operations. Determine a first test function label and a second test function label to be used for executing the test; retrieve multiple concurrent test cases marked with the first test function label and the second test function label from a concurrent case library, wherein each concurrent case in the concurrent case library is marked with a function label and an operation label; combine multiple concurrent test cases according to the function label and the operation label to obtain m concurrent test case groups, wherein the concurrent test case group is a combination of a concurrent case with the first test function label and a concurrent case with the second test function label, and m is a positive integer greater than 0; select n concurrent test case groups from the m concurrent test case groups according to a preset concurrency number and combine them to obtain a concurrent test case set, and n is a positive integer greater than 0; perform concurrent case testing on the concurrent test case set.
[0006] According to an embodiment of the present invention, functional keywords and operation types of regression use cases in a regression use case library are parsed to generate functional labels and operation labels for the regression use cases; the functional labels of concurrent use cases are stored in the concurrent use case library as a call directory; and the regression use cases marked with functional labels and operation labels are used as concurrent use cases.
[0007] According to an embodiment of the present invention, parsing the functional keywords and operation types of regression use cases in a regression use case library and generating regression functional labels and regression operation labels for the regression use cases includes: determining functional keywords based on identification information of the regression use case, wherein the identification information includes the name of the regression use case or words and phrases related to the function in the content of the regression use case statement; generating the regression functional label for the regression use case based on the functional keywords; matching the statements containing the operation type in the regression use case using regular expressions; and generating the regression operation label for the regression use case based on the matched operation statements.
[0008] According to an embodiment of the present invention, determining the first test function label and the second test function label to be used in executing the test includes: determining the function labels of two concurrent use cases in the concurrent use case library whose code coupling degree is higher than a preset value as a function label group to be tested through a cluster analysis method; and determining the first test function label and the second test function label to be used in executing the test based on the function label group to be tested.
[0009] According to an embodiment of the present invention, combining multiple concurrent use cases according to function labels and operation labels to obtain m concurrent test case groups includes: when the first test function label and the second test function label are the same function label, orthogonally combining multiple concurrent use cases according to operation labels to obtain a concurrent test case group; when the first test function label and the second test function label are different function labels, orthogonally combining multiple concurrent use cases to obtain a concurrent test case group.
[0010] According to an embodiment of the present invention, the preset concurrency number is determined according to the number of central processing unit cores of the system where the database to be tested is located.
[0011] The second aspect of the present invention provides a device for generating and testing a concurrent test case set, comprising: a setting module, used to determine a first test function label and a second test function label to be used for executing the test; a calling module, used to call multiple concurrent test cases marked with the first test function label and the second test function label from a concurrent case library, wherein each concurrent case in the concurrent case library is marked with a function label and an operation label; a first combining module, used to combine multiple concurrent test cases according to the function labels and operation labels to obtain m concurrent test case groups, wherein the concurrent test case group is a combination of a concurrent case with the first test function label and a concurrent case with the second test function label, and m is a positive integer greater than 0; a second combining module, used to select n concurrent test case groups from the m concurrent test case groups according to a preset concurrency number and combine them to obtain a concurrent test case set, and n is a positive integer greater than 0; a testing module, used to perform concurrent case testing on the concurrent test case set.
[0012] The third aspect of the present invention provides an electronic device, comprising: one or more processors; a memory for storing one or more computer programs, which, when the one or more processors execute the one or more computer programs, implements the steps of the method for generating and testing a concurrent test case set as described above.
[0013] The fourth aspect of the present invention also provides a computer-readable storage medium on which a computer program or instruction is stored. When the computer program or instruction is executed by a processor, the steps of the method for generating and testing the above-mentioned concurrent test case set are implemented.
[0014] The fifth aspect of the present invention also provides a computer program product, including a computer program or instructions, characterized in that when the computer program or instructions are executed by a processor, the steps of generating and testing the above-mentioned concurrent test case set are implemented.
[0015] According to the embodiments of the present invention, after marking the concurrent use cases with function labels and operation labels, the present invention automatically combines them according to the labels to generate a concurrent use case test group, and then concurrently tests the concurrent use case test group, thereby realizing a comprehensive concurrent use case test with multi-function and multi-operation coverage, saving manpower development costs, improving work efficiency, and greatly improving the quality and coverage of concurrent test cases. The use of concurrent numbers to simultaneously execute multiple groups of concurrent use cases fully utilizes system resources, effectively improves the execution efficiency of concurrent testing, and provides a more comprehensive and efficient concurrent test case set generation and testing method. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The above contents and other objects, features and advantages of the present invention will become more apparent through the following description of the embodiments of the present invention with reference to the accompanying drawings, in which:
[0017] Figure 1 The application scenario of the method for generating and testing a concurrent test case set according to an embodiment of the present invention is shown.
[0018] Figure 2 A flow chart of a method for generating and testing a concurrent test case set according to an embodiment of the present invention is shown.
[0019] Figure 3 A flowchart of concurrent use case library generation according to an embodiment of the present invention is shown.
[0020] Figure 4 A flowchart of generating a concurrent use case library by parsing regression use cases according to an embodiment of the present invention is shown.
[0021] Figure 5 A flowchart of generating and testing a concurrent test case set by determining a first test function tag and a second test function tag through a clustering algorithm according to an embodiment of the present invention is shown.
[0022] Figure 6 A structural block diagram of a concurrent test case set generation and testing device according to an embodiment of the present invention is shown.
[0023] Figure 7 A block diagram of an electronic device showing a method for generating and testing a concurrent test case set according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0024] Below, embodiments of the present invention will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present invention. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of embodiments of the present invention. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of concepts of the present invention.
[0025] The terms used herein are only for describing specific embodiments and are not intended to limit the present invention. The terms "comprise", "include", etc. used herein indicate the existence of features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0026] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0027] When using expressions such as "at least one of A, B, and C, etc.", they should generally be interpreted according to the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0028] In the technical solution of the present invention, the user information (including but not limited to user personal information, user image information, user device information, such as location information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with relevant laws, regulations and standards, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0029] It should be noted that the generation and testing method and device of the concurrent test case set, the electronic device and the storage medium of the embodiments of the present invention can be applied to the fields of big data technology, database technology, and database testing technology, and can also be used in any field other than the fields of big data technology, database technology, and database testing technology. The embodiments of the present invention do not limit the application fields of the generation and testing method and device of the concurrent test case set, the electronic device and the storage medium.
[0030] Regression use cases are a summary of use cases after functional testing is completed. They include all test items of the function and are edited and classified according to certain rules, such as function keywords or operation characteristics.
[0031] An embodiment of the present invention provides a method for generating and testing a concurrent test case set, comprising the following operations: determining a first test function label and a second test function label to be used for executing the test; retrieving multiple concurrent test cases marked with the first test function label and the second test function label from a concurrent case library, wherein each concurrent case in the concurrent case library is marked with a function label and an operation label; combining multiple concurrent test cases according to the function labels and operation labels to obtain a concurrent test case group, wherein the concurrent test case group is a combination of a concurrent case with the first test function label and a concurrent case with the second test function label; combining n concurrent test case groups according to a preset concurrency number to obtain a concurrent test case set; and performing concurrent case testing on the concurrent test case set.
[0032] Figure 1 The application scenario of the method for generating and testing a concurrent test case set according to an embodiment of the present invention is shown.
[0033] like Figure 1 As shown, the application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0034] The user may use at least one of the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications may be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).
[0035] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0036] The server 105 may be a server that provides various services, such as a background management server (only as an example) that provides support for websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.
[0037] It should be noted that the generation and testing method of the concurrent test case set provided in the embodiment of the present invention can generally be executed by the server 105. Accordingly, the generation and testing device of the concurrent test case set provided in the embodiment of the present invention can generally be set in the server 105. The generation and testing method of the concurrent test case set provided in the embodiment of the present invention can also be executed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Correspondingly, the generation and testing device of the concurrent test case set provided in the embodiment of the present invention can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105.
[0038] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0039] The following will be based on Figure 1 The scene described by Figure 2~Figure 5 The database automated functional testing method according to the embodiment of the present invention is described in detail.
[0040] Figure 2A flow chart of a method for generating and testing a concurrent test case set according to an embodiment of the present invention is shown.
[0041] like Figure 2 As shown, the method includes operations S201 to S205.
[0042] In operation S201 , a first test function label and a second test function label to be used in executing a test are determined.
[0043] In operation S202, a plurality of concurrent use cases marked with a first test function label and a second test function label are retrieved from a concurrent use case library, wherein each concurrent use case in the concurrent use case library is marked with a function label and an operation label.
[0044] In operation S203, multiple concurrent test cases are combined according to their function labels and operation labels to obtain m concurrent test case groups, wherein a concurrent test case group is a combination of a concurrent case with a first test function label and a concurrent case with a second test function label, and m is a positive integer greater than 0.
[0045] In operation S204, n concurrent test case groups are selected from the m concurrent test case groups according to the preset concurrency number and combined to obtain a concurrent test case set, where n is a positive integer greater than 0.
[0046] In operation S205, a concurrent test case set is subjected to a concurrent test case test.
[0047] Operations S201 to S205 will be described in detail below.
[0048] In operation S201 , a first test function label and a second test function label to be used in executing a test are determined.
[0049] According to an embodiment of the present invention, in operation S201, the function label is a predefined label that can describe the function of a concurrent use case or a regression use case, and can be a custom phrase or a general phrase. For example, the identification content in the regression use case library indicates that the distribution table function is "distributed", the replicated table is identified as "replicated", the stored procedure is identified as "procedure", the function is identified as "function", the partition table is identified as "partition", the index is identified as "index", etc., which can be used as function labels, that is, the function labels are "distributed", "replicated", "procedure", "function", "partition", "index", etc.
[0050] According to an embodiment of the present invention, in operation S201, the first test function label and the second test function label can be determined according to the needs of actual testing, such as manually obtaining from historical data or based on actual business experience; an algorithm can also be used to find two functions that are similar in function or often concurrent as two function labels for concurrent testing. For example, based on actual business scenarios, if the database to be tested often has concurrent replication table and storage table functions, then the replication table and the storage table can be set as the first function test label and the second function test label, respectively.
[0051] In operation S202, a plurality of concurrent use cases marked with a first test function label and a second test function label are retrieved from a concurrent use case library, wherein each concurrent use case in the concurrent use case library is marked with a function label and an operation label.
[0052] According to an embodiment of the present invention, in operation S202, the concurrent use case library contains a plurality of concurrent use cases with preset function labels and operation labels, wherein the operation label is a specific operation of each concurrent use case, for example, add, delete, modify, and check are all database operations, and the operation can be refined into an operation label and marked on the concurrent use case, such as setting the operation label to "create", "drop", "alter", "insert", "update", "delete", "load", etc. Each concurrent use case has a function label and an operation label, for example, a concurrent use case representing a creation operation of a distributed table function is "distributed_create.sql", and a concurrent use case representing a deletion operation of a replicated table function is "replicated_delete.sql".
[0053] According to an embodiment of the present invention, in operation S202, the corresponding concurrent use case is searched in the concurrent use case library according to the preset first test function tag and the second test function tag. In this process, the concurrent use case is retrieved only through the function tag of the concurrent use case in the concurrent use case library. The specific operation tag is not considered at this time. All concurrent use cases that meet the preset first test function tag and the second test function tag are retrieved in this step.
[0054] According to an embodiment of the present invention, in operation S203, multiple concurrent test cases are combined according to their function labels and operation labels to obtain m concurrent test case groups, wherein a concurrent test case group is a combination of a concurrent case with a first test function label and a concurrent case with a second test function label, and m is a positive integer greater than 0.
[0055] According to an embodiment of the present invention, in operation S203, multiple concurrent test cases are combined according to function labels and operation labels. They can be combined in pairs or in multiple combinations. For example, according to the first test function label and the second test function label, every two concurrent test cases are orthogonally combined to form a concurrent test case group. For example, "distributed_create.sql and replicated_delete.sql" are concurrent, as a concurrent test case group, indicating the creation of a concurrent distributed table and the deletion of a replicated table. M concurrent test case groups can be formed, and m can be 10, 20, 30, 40 groups, etc., but it is not limited to the listed values, and other values not listed within the numerical range are also applicable.
[0056] In some embodiments of the present invention, concurrent test cases may be run repeatedly or formed into different concurrent test case groups multiple times to increase concurrent test coverage.
[0057] In operation S204, n concurrent test case groups are selected from the m concurrent test case groups according to the preset concurrency number and combined to obtain a concurrent test case set, where n is a positive integer greater than 0.
[0058] According to an embodiment of the present invention, in operation S204, a concurrent test case set can be obtained by combining concurrent test case groups, wherein n is a positive integer, which can be preset before generating the concurrent test case set, and n can be 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, etc., but is not limited to the listed values, and other unlisted values within the numerical range are also applicable. Table 1 shows the case where the first test function label is "distributed" and the second test function label is "replicated" and the number of concurrency is 4, that is, there are 4 concurrent test case groups in each concurrent test case set. The table only schematically lists the combination method of the concurrent test case groups, and does not list all the operation labels, and also includes concurrent test case sets 5, 6, 7... etc.
[0059] Table 1 Concurrency test case set with concurrency number of 4.
[0060]
[0061] In operation S205, a concurrent test case set is tested concurrently.
[0062] According to an embodiment of the present invention, in operation S205, when a concurrent test case set performs a concurrent test case test, the lock conflict problem between different concurrent test cases can be solved by actually dividing or modifying different names. When the concurrency number is n, n libraries need to be created before testing. For example, when the concurrency number n is 4, when concurrent test case sets 1 to 4 are running at the same time, concurrent test case set 1 uses library 1, concurrent test case set 2 uses library 2, concurrent test case set 3 uses library 3, and concurrent test case set 4 uses library 4, so that each concurrent test case set has no influence on each other. When running concurrent test case sets 5 to 8, continue to use libraries 1 to 4 respectively, and so on. After all concurrent test case sets are executed, the created n libraries are deleted, thereby improving the efficiency of concurrent testing.
[0063] According to the embodiments of the present invention, after marking the concurrent use cases with function labels and operation labels, the present invention automatically combines them according to the labels to generate a concurrent use case test group, and then concurrently tests the concurrent use case test group, thereby realizing a comprehensive concurrent use case test with multi-function and multi-operation coverage, saving manpower development costs, improving work efficiency, and greatly improving the quality and coverage of concurrent test cases. The use of concurrent numbers to simultaneously execute multiple groups of concurrent use cases fully utilizes system resources, effectively improves the execution efficiency of concurrent testing, and provides a more comprehensive and efficient concurrent test case set generation and testing method.
[0064] Figure 3 A flowchart of concurrent use case library generation according to an embodiment of the present invention is shown.
[0065] like Figure 3 As shown, this embodiment includes the following operations S301 to S303.
[0066] In operation S301, the function keywords and operation types of the regression use cases in the regression use case library are parsed and a regression function label and a regression operation label of the regression use case are generated.
[0067] In operation S302 , the regression use cases marked with the regression function label and the regression operation label are used as concurrent use cases.
[0068] In operation S303, the regression function label and the regression operation label are used as the function label and the operation label of the concurrent use case respectively.
[0069] In operation S304, the function tag of the concurrent use case is stored in the concurrent use case library as a call directory.
[0070] According to an embodiment of the present invention, in operation S301, a regression test case repository is a collection of regression test cases that are stored and managed. These test cases are used to verify the functionality and performance of the software after modification, upgrade or maintenance. The regression test case repository is an important resource that helps ensure software quality and reduce defects introduced by new codes. By parsing the functional keywords and operation types in each regression test case in the regression test case repository, the regression function label and regression operation label of the regression test case can be obtained.
[0071] According to an embodiment of the present invention, in operation S302, the regression use cases marked with the regression function label and the regression operation label are defined as concurrent use cases, so as to implement the parsing and reuse of the regression use case library.
[0072] According to an embodiment of the present invention, in operation S303, after the regression use case is defined as a concurrent use case, the regression function label and the regression operation label of the regression use case are the function label and the operation label of the newly generated concurrent use case.
[0073] According to an embodiment of the present invention, in operation S304, after obtaining multiple concurrent use cases, a concurrent use case library is generated, wherein the concurrent use case library uses the function label of each concurrent use case as a directory for retrieval. For example, after determining the first test function label and the second test function label, the corresponding function label is searched in the concurrent use case library to retrieve the corresponding concurrent use case.
[0074] According to the embodiments of the present invention, the present invention makes full use of the regression case library resources, saves manpower development costs, improves work efficiency, and automatically orthogonally generates a concurrent case set based on functions and operations of the regression case, thereby greatly improving the quality and coverage of concurrent test cases.
[0075] Figure 4 A flowchart of generating a concurrent use case library by parsing regression use cases according to an embodiment of the present invention is shown.
[0076] like Figure 4 As shown, this embodiment includes the following operations S401 to S406.
[0077] In operation S401, a function keyword is determined according to identification information of a regression use case, wherein the identification information includes a regression use case name or a function-related phrase in a regression use case statement.
[0078] In operation S402 , a regression function label of the regression use case is generated according to the function keyword.
[0079] In operation S403, a regular expression is used to match statements containing operation types in the regression use case.
[0080] In operation S404, a regression operation label of the regression use case is generated according to the matched operation statement.
[0081] In operation S405 , the regression use cases marked with the regression function label and the regression operation label are used as concurrent use cases.
[0082] In operation S406, the function tag of the concurrent use case is stored in the concurrent use case library as a call directory.
[0083] According to an embodiment of the present invention, in operation S401, if the regression use case is identified by the use case name, it is necessary to obtain it by matching the use case name with keywords; if the functional information of the regression use case is defined in the use case text, it is necessary to open the use case file and retrieve the use case by keyword. A multi-threaded concurrent method is used during the retrieval process. If the regression use case has been divided by directory, threads are started for different directories to perform concurrent retrieval; if the regression use case is not divided into directories, the use case is segmented by the number of central processing unit (CPU) cores, and then the number of threads equal to the number of CPU cores is started for parallel retrieval to improve retrieval efficiency.
[0084] In some embodiments of the present invention, function keywords refer to identification information in function regression use cases, such as use case names or use case contents that can be distinguished as keywords of functions; configured function keywords can be edited in multiple lines of text, and each line of keywords can be one or more, where multiple keywords are separated by delimiters, one represents the concurrency of different operations of the function itself, and multiple represents the concurrency between functions.
[0085] In some specific embodiments of the present invention, the regression case library is searched according to the keywords "distributed" and "replicated" respectively, and the regression case files containing the keywords are obtained, and the corresponding "distributed" and "replicated" regression function labels are generated and marked on the corresponding regression cases, and copied to the directory of the concurrent case library for storage and defined as concurrent cases, wherein the concurrent case library needs to create a new directory, which is separated from the regression case library directory and cannot affect the execution of the regression case system, such as the directory name "bfcase". For example, the files in the regression case library are obtained: distributed_ddl.sql (ddl statement of distribution table function), distributed_dml.sql (dml statement of distribution table function), replicated_ddl.sql (ddl statement of replication table function), replicated_ddl.sql (dml statement of replication table function), wherein the "distributed" function related cases are stored in the "bfcase / distributed" directory, and the "replicated" function cases are stored in the "bfcase / replicated" directory.
[0086] According to an embodiment of the present invention, in operation S402, after obtaining the function keyword through parsing, the function keyword is used as a regression function label. For example, if the keyword of the distribution table function is "distributed", the function label is set to "distributed".
[0087] According to an embodiment of the present invention, in operations S403~S404, when using regular expressions to match statements containing operation types in regression use cases, since the regression use case definition rules of different systems are different, it is necessary to manually specify whether this step needs to be performed. If the rules are inconsistent, it is necessary to specify the parsing step to perform use case parsing. First, it is necessary to configure the operation types included in the functions. For example, the operation types included in "distribute" and "replicated" are "create", "drop", "alter", "insert", "update", "delete", and "load". The two functions are parsed in parallel, and each operation type is used for regular matching respectively. The statements containing the operation are extracted, and new use case files are regenerated and stored according to the directories of different functions. For example, the use case of generating a regression function label + regression operation label after the parsing is completed in the distributed function directory is.
[0088] "distributed_create.sql".
[0089] "distributed_alter.sql".
[0090] "distributed_drop.sql".
[0091] "distributed_insert.sql".
[0092] "distributed_update.sql".
[0093] "distributed_delete.sql".
[0094] "distributed_load.sql".
[0095] According to the embodiment of the present invention, operation S405 and operation S406 are the same as the above-mentioned operation S302 and operation S303, and are not described in detail here.
[0096] According to an embodiment of the present invention, by finding and extracting keywords related to the function in the regression use case library, the regression function label can be quickly determined without the need for additional operations. If the function or operation labels are inconsistent due to software, system or component reasons, the data can be normalized and then extracted to quickly obtain the regression function label and regression operation label.
[0097] Figure 5 A flowchart of generating and testing a concurrent test case set by determining a first test function tag and a second test function tag through a clustering algorithm according to an embodiment of the present invention is shown.
[0098] like Figure 5 As shown, this embodiment includes the following operations S501 to S506.
[0099] In operation S501, two concurrent use case function labels with code coupling degrees higher than a preset value in a concurrent use case library are determined as a function label group to be tested by cluster analysis.
[0100] In operation S502, a first test function label and a second test function label to be used for executing a test are determined according to the function label group to be tested.
[0101] In operation S503, a plurality of concurrent use cases marked with a first test function label and a second test function label are retrieved from a concurrent use case library, wherein each concurrent use case in the concurrent use case library is marked with a function label and an operation label.
[0102] In operation S504, multiple concurrent test cases are combined according to the function labels and operation labels to obtain a concurrent test case group, where the concurrent test case group is a combination of concurrent test cases with a first test function label and concurrent test cases with a second test function label.
[0103] In operation S505, n concurrent test case groups are combined according to a preset concurrency number to obtain a concurrent test case set.
[0104] In operation S506, a concurrent test case set is tested concurrently.
[0105] According to an embodiment of the present invention, in operation S501, functions with high coupling or correlation of code modules can be put into a group according to the cluster analysis method, and the preset value of coupling can be set to 10, 11, 12, 15, etc. The preset value is set according to the complexity of the actual scenario and concurrent use cases, that is, the relevant impact of such functions will be significant, and it is recommended to perform concurrent testing between functions. For example, each regression use case in the regression use case library has a log code of execution time or execution operation. If the coupling degree of such code of two regression use cases is high, it can be said that the two regression use cases have been concurrent together, or the correlation can be calculated for the execution time of the regression use cases, and the frequently concurrent function labels are set as the function label group to be tested, and the function label group to be tested can be multiple function labels.
[0106] According to an embodiment of the present invention, in operation S502, two of the function label groups may be selected as the first test function label and the second test function label, so that functions with high concurrency frequency may be flexibly grouped together for concurrent testing.
[0107] According to the embodiment of the present invention, operations S503 to S506 are the same as the above-mentioned operations S202 to S205, and are not described in detail herein.
[0108] According to an embodiment of the present invention, the cluster analysis method can be used to more quickly and objectively find two concurrent use cases with high functional correlation, that is, functions or operations that are often performed concurrently can be found. The use of a cluster analysis algorithm can avoid artificially setting concurrent use case patterns. Not only can frequently concurrent functions be found quickly, but it can also be closer to actual usage situations, so that the generation of concurrent use case sets and concurrent testing are closer to usage scenarios, and better and more stable concurrent testing results are obtained.
[0109] According to an embodiment of the present invention, combining multiple concurrent use cases according to function labels and operation labels to obtain a concurrent test case group includes: when the first test function label and the second test function label are the same function label, multiple concurrent use cases are orthogonally combined according to the operation label to obtain a concurrent test case group; when the first test function label and the second test function label are different function labels, multiple concurrent use cases are orthogonally combined to obtain a concurrent test case group.
[0110] In some embodiments of the present invention, when the first test function tag and the second test function tag are the same function tag, concurrent test case groups will be obtained by performing orthogonal combinations of the operation tags in pairs. For example, the generated concurrent test case groups are the creation operation "distributed_create.sql" of the distributed table function and the upgrade operation "distributed_update.sql" of the distributed table function.
[0111] In some embodiments of the present invention, when the first test function label and the second test function label are different function labels, the orthogonal combination between different function labels will be realized through the orthogonal combination between each concurrent use case, that is, the concurrent use cases are divided into two groups according to the function labels, and the two groups of concurrent use cases are orthogonally combined, which may include two different function labels but with the same operation label, such as the generated concurrent test case group is the creation operation "distributed_create.sql" of the distributed table function and the creation operation "replicated_create.sql" of the replicated table function.
[0112] According to an embodiment of the present invention, the above method can include two situations where the first function label and the second function label are the same or different. Not only the concurrent testing of two functions is considered, but also the concurrency of two operations of one function is considered, so that the coverage of the concurrent use case test set is wider.
[0113] According to an embodiment of the present invention, the preset concurrency number is determined according to the number of CPU cores of the system where the database to be tested is located. The concurrency number can be specified according to the system environment configuration used in the actual test. For example, for a 4-core 8G machine, it is recommended to use a concurrency number of 4, which can fully utilize resources without causing resource congestion, and can improve the efficiency of concurrent testing.
[0114] According to an embodiment of the present invention, matching the number of concurrency and the number of CPU cores can ensure that all CPU cores are fully utilized, thereby improving the overall performance of the system. By reasonably allocating concurrent tasks to each CPU core, it is possible to avoid the situation where some cores are overloaded while other cores are idle, thereby achieving a more balanced load distribution. In performance testing, setting the number of concurrency to match the number of CPU cores can more accurately evaluate the performance of the database in the actual operating environment, because it simulates the concurrency that may be encountered in actual usage scenarios; and appropriate concurrency settings help avoid system overload or crashes caused by too many concurrent requests, thereby improving the stability of the system. At the same time, by optimizing the number of concurrency, task queuing and waiting time can be reduced, thereby improving the response speed of database operations.
[0115] Figure 6 A structural block diagram of a concurrent test case set generation and testing device according to an embodiment of the present invention is shown.
[0116] like Figure 6 As shown, the concurrent test case set generation and testing device 600 of this embodiment includes a setting module 610 , a calling module 620 , a first combination module 630 , a second combination module 640 and a testing module 650 .
[0117] The setting module 610 is used to determine the first test function label and the second test function label to be used for executing the test. In one embodiment, the setting module 610 can be used to execute the operation S201 described above, which will not be described in detail here.
[0118] The calling module 620 is used to call multiple concurrent use cases marked with a first test function label and a second test function label from a concurrent use case library, wherein each concurrent use case in the concurrent use case library is marked with a function label and an operation label. In one embodiment, the calling module 620 can be used to perform the operation S202 described above, which will not be repeated here.
[0119] The first combination module 630 is used to combine multiple concurrent test cases according to the function labels and operation labels to obtain m concurrent test case groups, wherein the concurrent test case group is a combination of concurrent test cases with the first test function label and concurrent test cases with the second test function label. In one embodiment, the first combination module 630 can be used to perform the operation S203 described above, which will not be repeated here.
[0120] The second combination module 640 is used to select n concurrent test case groups from the m concurrent test case groups according to the preset concurrency number and combine them to obtain a concurrent test case set. In one embodiment, the second combination module 640 can be used to perform the operation S204 described above, which will not be repeated here.
[0121] The test module 650 is used to perform concurrent test case tests on the concurrent test case set. In one embodiment, the test module 650 can be used to perform the operation S205 described above, which will not be described in detail here.
[0122] According to an embodiment of the present invention, at least one of the setting module 610, the calling module 620, the first combination module 630, the second combination module 640 and the test module 650 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application-specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware and firmware or in an appropriate combination of any of them. Alternatively, at least one of the setting module 610, the calling module 620, the first combination module 630, the second combination module 640 and the test module 650 can be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding function can be executed.
[0123] According to the embodiments of the present invention, after marking the concurrent use cases with function labels and operation labels, the present invention automatically combines them according to the labels to generate a concurrent use case test group, and then concurrently tests the concurrent use case test group, thereby realizing a comprehensive concurrent use case test with multi-function and multi-operation coverage, saving manpower development costs, improving work efficiency, and greatly improving the quality and coverage of concurrent test cases. The use of concurrent numbers to simultaneously execute multiple groups of concurrent use cases fully utilizes system resources, effectively improves the execution efficiency of concurrent testing, and provides a more comprehensive and efficient concurrent test case set generation and testing method.
[0124] Figure 7 A block diagram of an electronic device showing a method for generating and testing a concurrent test case set according to an embodiment of the present invention is shown.
[0125] like Figure 7 As shown, the electronic device 700 according to an embodiment of the present invention includes a processor 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 to a random access memory (RAM) 703. The processor 701 may include, for example, a general-purpose microprocessor (such as a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (for example, an application-specific integrated circuit (ASIC)), etc. The processor 701 may also include an onboard memory for caching purposes. The processor 701 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present invention.
[0126] In RAM 703, various programs and data required for the operation of electronic device 700 are stored. Processor 701, ROM 702 and RAM 703 are connected to each other via bus 704. Processor 701 performs various operations of the method flow according to the embodiment of the present invention by executing the programs in ROM 702 and / or RAM 703. It should be noted that the program can also be stored in one or more memories other than ROM 702 and RAM 703. Processor 701 can also perform various operations of the method flow according to the embodiment of the present invention by executing the programs stored in one or more memories.
[0127] According to an embodiment of the present invention, the electronic device 700 may further include an input / output (I / O) interface 705, which is also connected to the bus 704. The electronic device 700 may further include one or more of the following components connected to the input / output (I / O) interface 705: an input portion 706 including a keyboard, a mouse, etc.; an output portion 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 708 including a hard disk, etc.; and a communication portion 709 including a network interface card such as a network (LAN) card, a modem, etc. The communication portion 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the input / output (I / O) interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage portion 708 as needed.
[0128] The present invention also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiment; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present invention is implemented.
[0129] According to an embodiment of the present invention, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: 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 portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device. For example, according to an embodiment of the present invention, the computer-readable storage medium may include the ROM 702 and / or RAM 703 described above and / or one or more memories other than ROM 702 and RAM 703.
[0130] The embodiment of the present invention also includes a computer program product, which includes a computer program, and the computer program contains program code for executing the method shown in the flowchart. When the computer program product is run in a computer system, the program code is used to enable the computer system to implement the above method provided by the embodiment of the present invention.
[0131] The computer program executes the above functions defined in the system / device of the embodiment of the present invention when it is executed by the processor 701. According to the embodiment of the present invention, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0132] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 709, and / or installed from the removable medium 711. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0133] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the processor 701, the above functions defined in the system of the embodiment of the present invention are performed. According to the embodiment of the present invention, the system, device, means, module, unit, etc. described above can be implemented by a computer program module.
[0134] According to an embodiment of the present invention, the program code for executing the computer program provided by the embodiment of the present invention can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (e.g., using an Internet service provider to connect through the Internet).
[0135] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0136] It will be appreciated by those skilled in the art that the features described in the various embodiments of the present invention may be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in the present invention. In particular, without departing from the spirit and teachings of the present invention, the features described in the various embodiments of the present invention may be combined and / or combined in various ways. All of these combinations and / or combinations fall within the scope of the present invention.
[0137] The above specific embodiments further illustrate the purpose, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for generating and testing a database concurrent test case set, characterized in that: The method comprises the following operations: Determining a first test function label and a second test function label to be used in performing the test; Retrieving multiple concurrent use cases marked with the first test function label and the second test function label from a concurrent use case library, wherein each of the concurrent use cases in the concurrent use case library is marked with a function label and an operation label, the function label is a predefined label that describes the function of the concurrent use case, and the operation label is a label for a specific operation of each concurrent use case; Combine multiple concurrent test cases according to the function labels and the operation labels to obtain m concurrent test case groups. When the first test function label and the second test function label are the same function label, perform orthogonal combination of multiple concurrent test cases according to the operation labels to obtain the concurrent test case group; when the first test function label and the second test function label are different function labels, perform orthogonal combination of multiple concurrent test cases to obtain the concurrent test case group, wherein the concurrent test case group is a combination of concurrent cases with the first test function label and concurrent cases with the second test function label, and m is a positive integer greater than 0; According to the preset concurrency number, n concurrent test case groups are selected from the m concurrent test case groups and combined to obtain a concurrent test case set, where n is a positive integer greater than 0; Perform concurrent test case testing on the concurrent test case set.
2. The method according to claim 1, characterized in that The method further comprises: Parsing the functional keywords and operation types of regression cases in the regression case library and generating regression function labels and regression operation labels for the regression cases; The regression use case marked with the regression function label and the regression operation label is used as a concurrent use case; Respectively using the regression function label and the regression operation label as the function label and the operation label of the concurrent use case; The function tag of the concurrent use case is stored in a concurrent use case library as a calling directory.
3. The method according to claim 2, characterized in that The step of parsing the functional keywords and operation types of the regression use cases in the regression use case library and generating the regression function labels and regression operation labels of the regression use cases includes: Determining the function keyword according to the identification information of the regression use case, wherein the identification information includes the name of the regression use case or the words and phrases related to the function in the content of the regression use case statement; Generate the regression function label of the regression use case according to the function keyword; Use a regular expression to match statements containing operation types in the regression use case; The regression operation label of the regression use case is generated according to the matched operation statement.
4. The method according to claim 1, characterized in that: The determining of the first test function label and the second test function label to be used for executing the test comprises: Determine the function labels of two concurrent use cases in the concurrent use case library whose code coupling degree is higher than a preset value as a function label group to be tested by a cluster analysis method; The first test function label and the second test function label to be used for executing the test are determined according to the function label group to be tested.
5. The method according to claim 1, characterized in that The preset number of concurrent connections is determined according to the number of CPU cores of the system where the database to be tested is located.
6. A device for generating and testing a database concurrent test case set, characterized in that: The device comprises: A setting module, used to determine a first test function label and a second test function label to be used for executing the test; A calling module, used for calling a plurality of concurrent use cases marked with the first test function label and the second test function label from a concurrent use case library, wherein each concurrent use case in the concurrent use case library is marked with a function label and an operation label, the function label is a predefined label describing the function of the concurrent use case, and the operation label is a label for a specific operation of each concurrent use case; A first combination module is used to combine the multiple concurrent test cases according to the function labels and the operation labels to obtain m concurrent test case groups, and in the case where the first test function label and the second test function label are the same function label, the multiple concurrent test cases are orthogonally combined according to the operation labels to obtain the concurrent test case group; In the case where the first test function label and the second test function label are different function labels, a plurality of the concurrent test cases are orthogonally combined to obtain the concurrent test case group, wherein the concurrent test case group is a combination of a concurrent case with the first test function label and a concurrent case with the second test function label, and m is a positive integer greater than 0; A second combination module is used to select n concurrent test case groups from the m concurrent test case groups according to a preset concurrency number and combine them to obtain a concurrent test case set, where n is a positive integer greater than 0; The test module is used to perform concurrent test case tests on the concurrent test case set.
7. An electronic device comprising: one or more processors; a memory for storing one or more computer programs, It is characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program or instruction stored thereon, characterized in that: When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
9. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Test case management method and device, electronic equipment and storage medium
CN112231230A
Test case generation method and device and test case display method and device
CN114328276A