CN112783758A - Test case library and feature library generation method, device and storage medium - Google Patents

Test case library and feature library generation method, device and storage medium Download PDF

Info

Publication number
CN112783758A
CN112783758A CN201911096312.6A CN201911096312A CN112783758A CN 112783758 A CN112783758 A CN 112783758A CN 201911096312 A CN201911096312 A CN 201911096312A CN 112783758 A CN112783758 A CN 112783758A
Authority
CN
China
Prior art keywords
case
data table
index
test case
software
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201911096312.6A
Other languages
Chinese (zh)
Other versions
CN112783758B (en
Inventor
于晨昕
乔红麟
梁高中
陈开旺
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba Cloud Computing Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201911096312.6A priority Critical patent/CN112783758B/en
Publication of CN112783758A publication Critical patent/CN112783758A/en
Application granted granted Critical
Publication of CN112783758B publication Critical patent/CN112783758B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases

Abstract

The embodiment of the application provides a test case library and feature library generation method, equipment and a storage medium. In the embodiment of the application, the functional characteristics of the software to be tested are characterized to obtain atomic characteristics, the formal description of the test cases based on the case characteristics is realized through the atomic characteristics, and a formal characteristic library of the test cases is formed and has better completeness; furthermore, the formal descriptions (namely case characteristics) of the test cases in the test case formal characteristic library are taken as a hand grip, and the test cases meeting the formal descriptions are automatically obtained from the online cases, so that the coverage of the test cases can be ensured, the test cases can be quickly generated, and the workload of generating the test cases is reduced.

Description

Test case library and feature library generation method, device and storage medium
Technical Field
The present application relates to the field of test technologies, and in particular, to a test case library and feature library generation method, device, and storage medium.
Background
Software testing is a testing technology for finding software defects and ensuring software quality. The software testing mainly comprises compiling a testing case and testing the software function through the testing case. The generation of test cases is the key and difficult point of software test effectiveness, and the test cases are mainly compiled manually at present.
With the development of software technology, the functions and scale of software are continuously strong, software testing needs more test cases to fully cover the functions of the software, and the workload of writing the test cases is increased sharply. However, how to quickly generate a test case under the condition of ensuring the coverage of the test case is a problem which needs to be solved urgently in the current software test.
Disclosure of Invention
Various aspects of the present application provide a test case library, a feature library generation method, a device and a storage medium, so as to generate test cases quickly under the condition of ensuring the coverage of the test cases.
The embodiment of the application provides a method for generating a formalized feature library of test cases, which comprises the following steps: performing characteristic decomposition on the functional characteristics of the software to be tested to obtain a plurality of atomic characteristics; obtaining a plurality of case characteristics according to the plurality of atomic characteristic combinations, wherein each case characteristic is a formal description of a test case; and generating a test case formalized feature library according to the plurality of case features.
The embodiment of the present application further provides a test case library generating method, including: acquiring an online case to be actually run in and/or already run in software to be tested; matching the characteristics of the online cases in a test case formal characteristic library, wherein the test case formal characteristic library comprises a plurality of case characteristics, and each case characteristic is a formal description of one test case; and if the characteristics of the online case are matched in the test case formalized characteristic library, adding the online case into the test case library as the test case required by testing the software to be tested.
An embodiment of the present application further provides a computer device, including: a memory and a processor; the memory for storing a computer program; the processor, coupled with the memory, to execute the computer program to: performing characteristic decomposition on the functional characteristics of the software to be tested to obtain a plurality of atomic characteristics; obtaining a plurality of case characteristics according to the plurality of atomic characteristic combinations, wherein each case characteristic is a formal description of a test case; and generating a test case formalized feature library according to the plurality of case features.
An embodiment of the present application further provides a computer device, including: a memory and a processor; the memory for storing a computer program; the processor, coupled with the memory, to execute the computer program to: acquiring an online case to be actually run in and/or already run in software to be tested; matching the characteristics of the online cases in a test case formal characteristic library, wherein the test case formal characteristic library comprises a plurality of case characteristics, and each case characteristic is a formal description of one test case; and if the characteristics of the online case are matched in the test case formalized characteristic library, adding the online case into the test case library as the test case required by testing the software to be tested.
Embodiments of the present application further provide a computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to implement the steps in the test case formalized feature library generation method provided by this embodiment.
Embodiments of the present application further provide a computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to implement the steps in the test case library generation method provided in this embodiment.
The embodiment of the present application further provides an index recommendation method, including: obtaining a database statement, wherein the database statement requests to inquire at least one data table; respectively generating at least one alternative index for the at least one data table; calculating the search cost of at least one alternative index corresponding to each data table; and recommending indexes for the at least one data table according to the search cost of the at least one alternative index corresponding to the at least one data table respectively.
An embodiment of the present application further provides an index creating method, including: determining a database statement to be optimized, wherein the database statement to be optimized requests to query at least one data table; invoking an index recommendation service to recommend an index for the at least one data table; acquiring a target data table returned by the index recommendation service and an index recommended for the target data table; adding an index recommended by the index recommendation service for the target data table; wherein the target data table is a part or all of the at least one data table.
An embodiment of the present application further provides a computer device, including: a memory and a processor; the memory for storing a computer program; the processor, coupled with the memory, to execute the computer program to: obtaining a database statement, wherein the database statement requests to inquire at least one data table; respectively generating at least one alternative index for the at least one data table; calculating the search cost of at least one alternative index corresponding to each data table; and recommending indexes for the at least one data table according to the search cost of the at least one alternative index corresponding to the at least one data table respectively.
An embodiment of the present application further provides a computer device, including: a memory and a processor; the memory for storing a computer program; the processor, coupled with the memory, to execute the computer program to: determining a database statement to be optimized, wherein the database statement to be optimized requests to query at least one data table; invoking an index recommendation service to recommend an index for the at least one data table; acquiring a target data table returned by the index recommendation service and an index recommended for the target data table; adding an index recommended by the index recommendation service for the target data table; wherein the target data table is a part or all of the at least one data table.
Embodiments of the present application further provide a computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to implement the steps in the index creating method or the index recommending method provided in this embodiment.
In the embodiment of the application, the functional characteristics of the software to be tested are characterized to obtain atomic characteristics, the formal description of the test cases based on the case characteristics is realized through the atomic characteristics, and a formal characteristic library of the test cases is formed and has better completeness; furthermore, the formal descriptions (namely case characteristics) of the test cases in the test case formal characteristic library are taken as a hand grip, and the test cases meeting the formal descriptions are automatically obtained from the online cases, so that the coverage of the test cases can be ensured, the test cases can be quickly generated, and the workload of generating the test cases is reduced.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a schematic flowchart of a test case formalized feature library generation method according to an exemplary embodiment of the present application;
FIG. 2 is a diagram illustrating atomic features disassembled from an SQL syntax dimension according to an exemplary embodiment of the present application;
fig. 3a is a schematic flowchart of a test case library generation method according to an exemplary embodiment of the present application;
FIG. 3b is a block diagram of a test case formalized feature library and a test case library generation method according to an exemplary embodiment of the present application;
FIG. 3c is a flowchart illustrating an index recommendation method according to an exemplary embodiment of the present application;
FIG. 3d is a flowchart illustrating an index creation method according to an exemplary embodiment of the present application;
FIG. 4 is a schematic structural diagram of a computer device according to an exemplary embodiment of the present application;
fig. 5 is a schematic structural diagram of another computer device according to an exemplary embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be described in detail and completely with reference to the following specific embodiments of the present application and the accompanying drawings. It should be apparent that the described embodiments are only some of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Writing test cases is a process of imaging abstract test concepts, and manually writing test cases requires understanding test requirements and other relatively abstract problems, and is difficult and high in workload. Particularly, with the development of software technology, the functions and scale of software are continuously strong, software testing needs more test cases to fully cover the functions of the software, and the workload of writing the test cases is increased sharply. Therefore, how to quickly generate the test case under the condition of ensuring the coverage of the test case is a technical problem which needs to be solved urgently by the software test at present.
To address this technical problem, in some embodiments of the present application, a formal method (formal methods) is used to describe the test cases, so that the test cases are more operational and scalable, and are no longer abstract concepts being visualized, thereby simplifying the generation process of the test cases. The formalization method is a method for solving a problem in the field of software engineering by means of a mathematical method. In a narrow sense, the formalization method is a method for performing formalized specification description, model inference and verification by using a formalization language (a language with strict semantic definition of syntax), and may be referred to as a formalization description. The formal language used for the formal description includes, but is not limited to: a formal language Z, a formal language B, a formal language VDM, and the like.
In the embodiment of the application, the formal description of the test case is realized through characterization. The method comprises the steps that functional characteristics of software to be tested can be characterized to obtain atomic characteristics, case characteristics for describing test cases are obtained through combination of the atomic characteristics, formal description of the test cases based on the case characteristics is achieved, a test case formal characteristic library is formed, and the test case formal characteristic library has good completeness; furthermore, the formal descriptions (namely case characteristics) of the test cases in the test case formal characteristic library are taken as a hand grip, and the test cases meeting the formal descriptions are automatically obtained from the online cases, so that the coverage of the test cases can be ensured, the test cases can be quickly generated, and the workload of generating the test cases is reduced.
The technical solutions provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings.
Fig. 1 is a flowchart illustrating a method for generating a test case formalized feature library according to an exemplary embodiment of the present application. As shown in fig. 1, the method includes:
101. and performing characteristic decomposition on the functional characteristics of the software to be tested to obtain a plurality of atomic characteristics.
102. And obtaining a plurality of case characteristics according to the plurality of atomic characteristic combinations, wherein each case characteristic is a formal description of one test case.
103. And generating a test case formalized feature library according to the plurality of case features.
In this embodiment, the software to be tested is a series of computer data and sets of instructions organized in a particular order. The software to be tested in this embodiment may be application software, system software, or some middleware between the application software and the system software. Middleware may be any software based interface between application software and system software. The application software or system software comprises a main program and auxiliary programs such as plug-ins, patches, APIs and the like for providing services for the main program.
In practical applications, it is necessary to test the software to be tested in order to find defects of the software to be tested and ensure the quality of the software to be tested. In order to meet the testing requirements of the software to be tested, a sufficient number of test cases need to be generated. In order to generate the test cases quickly, the embodiment does not generate the test cases directly, but generates a test case formalized feature library, wherein formalized descriptions (i.e. case features) of a plurality of test cases are stored in the test case formalized feature library, and the formalized descriptions of the test cases are bases and foundations for generating the test cases, so that preparation conditions are provided for generating the test cases. The formal description of the test case can enable the test case not to be abstract any more, but to have operability and measurability, so that in the subsequent process of generating the test case based on the formal description of the test case, the operation of generating the test case can be simplified, and the generation efficiency of the test case is improved.
The process of generating the test case formalized feature library in the embodiment includes:
firstly, starting from the functional characteristics of the software to be tested, the functional characteristics of the software to be tested are subjected to characteristic decomposition to obtain a plurality of atomic characteristics. The atomic features are the minimum feature unit of the functional characteristics of the software to be tested and the minimum feature unit on which the formal description of the test case depends. Wherein the atomic features may constitute an atomic feature set for the test case.
Optionally, at least one basic dimension having an influence on the functional characteristics of the software to be tested may be determined according to a test requirement corresponding to the software to be tested; and then, performing hierarchical feature decomposition on the functional characteristics of the application software to be tested from at least one basic dimension to obtain a plurality of atomic features. In this alternative embodiment, the decomposed atomic features have dimensional attributes. The basic dimension having an influence on the functional characteristics of the software to be tested mainly refers to some factors having an influence on the functional characteristics of the software to be tested, and each factor serves as a basic dimension.
It should be noted that, according to the software to be tested and the testing requirements, the basic dimensions and the number thereof having an influence on the functional characteristics of the software to be tested are different. For a tester in the field, after the software to be tested and the test requirements are determined, the fundamental dimension having an influence on the functional characteristics of the software to be tested can be easily determined, and the embodiment does not limit the specific implementation of the determination process. The following is illustrated by way of an example:
for example, in the SQL database, an index needs to be created for the data table during the process of creating the data table, so that during the process of querying the data table, an optimizer (or optimization engine) in the database can select an appropriate index from the indexes of the data table and perform a query on the data table based on the selected index, so as to improve the query efficiency. In order to create a more reasonable index for the data table, in a database development project, a developer develops a function code which can recommend the index for a user, and the function code is implemented by using the SQL language.
In order to guarantee the performance and quality of the function code, the function code needs to be tested. In order to facilitate the testing of the function code, the method of the embodiment may be adopted to generate a test case formalized feature library required for testing the function code in advance, and provide conditions for subsequently generating a test case required for testing.
In generating the test case formalized feature library, at least one base dimension having an impact on the functional characteristics of the functional code may be determined according to the test requirements for the functional code. In this example, the function code recommendation index needs to be adapted to the optimizer selection index, so the dimension (or factor) having influence on the functional characteristic of the function code, that is, the dimension (or factor) having influence on the optimizer selection index, mainly includes but is not limited to: SQL grammar dimension, statistical information dimension, optimization option dimension, storage engine dimension, and the like. In each dimension, the functional characteristics of the software to be tested can be continuously subjected to hierarchical feature decomposition until all atomic features are decomposed.
As shown in fig. 2, taking SQL syntax dimension as an example, the function code needs to create an index for both a single table and a multi-table, and based on this, the functional characteristics of the function code can be firstly decomposed into: a Single Table (Single Table) dimension and a Multi Table (Multi Table) dimension.
In the dimension of Single Table (Single Table), further can decompose: SELECT (query), Simple Pred (Simple Predicate), cluster (Aggregate), OB (abbreviation of ORDER BY), LIMIT, and Compound Pred (Compound Predicate). Wherein, the SELECT: for selecting data from the table. Simple Pred, as opposed to Compound Pred, refers to a single query condition, e.g., age >18, indicating an age greater than 18. Aggregate (agg): its operation faces a series of values and returns a single value; OB: the required data is sorted by designated column and order. LIMIT: the limitation is to select only the first few rows of data that meet the condition, not all rows of data. Compound Pred: multiple query singles (Simple Pred) are combined to form a complex combined condition, such as: the company "a" OR "company" means a record of company a OR B. The several dimensions can be further disassembled, and the disassembling condition of each dimension is as follows:
considering the overlay characteristics of the index, the index may be further classified according to whether the index is an overlay index. If an index is an overlay index for a query SQL, it means that all data columns to be accessed in the query are included in the index, so that the performance can be improved when the data is queried, because the cost of returning to the table can be avoided. Based on this, further split in the SELECT dimension: COVER (overlay index) and OTHER (non-overlay index). For SQL, it is manifold whether an index can be the overlay index contributor. For example, for a query of SELECT columns (columns), whether an index can be a coverage index is related to the number of columns, based on which further parsing can be performed by the number of columns. For example, classification by 4 columns limits can be divided into two atomic features <4 and > 4. Wherein, the atomic feature <4 appears under COVER, which means that for the case that the number of the SELECT columns is <4, the coverage index is easy to generate; the atomic feature of >4 appearing under the OTHER means that the overlay index cannot be generated for the case where the number of columns of SELECT > 4. The classification is performed by using 4 columns as boundaries, which is only an example of the classification boundaries, and the classification can be flexibly set according to the maximum length of the index in practical application.
Under the Simple Pred dimension, the role played in the index according to Simple predicates (or query single conditions) can be further decomposed: INDEXABLE and sargas. INDEXABLE: it refers to a predicate that can play a Matching role, i.e. it can quickly match a range of data to be queried, for example, id ═ …', and the predicate can determine the position of data in a constant time by indexing. SARGABLE: generally, the method cannot play a Matching role, namely, the searching range of the data to be queried can be quickly matched and determined through the method, but the method can play a role of filtering the data in the index data scanning process, and generally refers to some complex predicates.
Wherein, according to the specific function of the predicate that can play a Matching role, INDEXABLE can be further disassembled: EQUAL, RANGE, LIKE, and inline. Wherein, EQUAL is an equivalent predicate, such as CID ═ 0012880'; RANGE is a RANGE query predicate, such as age > 18; LIKE refers to matching of character strings according to a specified rule, such as name LIKE' tom%, namely the name of a person beginning with tom; INLIST refers to whether it appears in a specified list, such as company in ('A', 'B'), i.e., whether the company is A or B. Furthermore, each predicate can be further disassembled according to the number, condition or value condition of each predicate which can play a Matching role. For example, for EQUAL, assuming that the number is 1, 2-4 and >4, the atomic features of three value classes may be further divided according to the value of the number, but not limited thereto. For RANGE, assuming that the query RANGE is 1 and >1, the atomic features of two value classes can be further divided according to the query RANGE, but not limited thereto. For LIKE, assuming that the matching rules of LIKE are Prefix matching rule and% func matching rule, two atomic features can be further divided according to the matching rules, but not limited thereto. For INLIST, assuming that the data in the designated list is 1, 2-n and > n, the atomic features of three numerical classes can be divided according to the data in the designated list, but not limited thereto.
It can be further disassembled for SARGABLE: NOT (non), KYWD and OTHER. NOT added before some predicates means negation, such as company NOT in ('a', 'B'). KYWD is shorthand for KEY WORD, denoting the collective term for keywords. Further disassembling: FUNC, AGG, and OTHER KYWD (OTHER KYWDs). FUNC means that the predicate contains general functions, such as len (city) > 8; AGG is meant to include an aggregation function, such as max (age) < 30.
Further split in the Aggregate dimension: GB (GROUP BY), DISTINCT and BOTH. Wherein, GB refers to grouping according to specified columns; DISTINCT means that it is desirable to list only different values; BOTH means that BOTH GB and DISTINCT coexist in SQL statements.
Further split in the OB dimension: OB and MIXED ORDER. Wherein OB means ordering data according to a specified column and sequence; the MIXED ORDER refers to the ordering with different ascending and descending requirements for different columns, such as ORDER BY a asc and b desc, which means that the a columns are arranged in ascending and the b columns are arranged in descending ORDER, wherein the ascending and descending need to be MIXED.
Compound Pred can be further broken down according to the combination between simple predicates (or single conditions): AND OR. AND: satisfying this condition and satisfying another condition; OR: it suffices to satisfy one of them.
In the multi-table dimension, further the following can be decomposed: SUB QUERY, UNION, INNER JOIN, OUTER JOIN, STRT JOIN, NATRL JOIN, HINT, and CTE (8.0) for several dimensions. Wherein SUB QUERY refers to the presence of SUB-queries in the QUERY; UNION refers to the merging of the result set of two or more sub-query statements; INNER JOIN refers to the internal connection between two tables; OUTER JOIN refers to the external connection between two tables; STRT JOIN: the method is in an abbreviation form of STRAIGHT _ JOIN, is in a JOIN form in a MYSQL database, and forcibly formulates a table sequence of related query by using STRAIGHT _ JOIN so as to achieve the aim of optimization; NATRL JOIN: is an abbreviation form of NATURE JOIN, which means natural connection, and automatically connects two tables according to the same name column; HINT: the language can be translated into an 'optimization prompt', which is a mode for a user to intervene in the selection of the database optimizer for the execution plan, and is used for telling the optimizer to generate the execution plan by using a specified access path or connection type, so that the statement can run efficiently; CTE (8.0): is an abbreviation of Common Table Expression, a grammar in SQL language, only needs to write a small amount of code to implement recursive query, and 8.0 in parentheses means that for MYSQL, only 8.0 version later has CTE support.
Further split in the SUB QUERY dimension: TB 2 and TB >2 two atomic features. Wherein, TB 2 refers to the situation that two tables are connected in the multi-table connection; TB >2 refers to the case of a multi-table join, three-table or greater than three-table join. Further comprising the following atomic features under TB 2 and TB > 2: SEL SUB, EQ SUB, IN SUB, EXST SUB, DERV SUB, and OTHR Table. Wherein, SELSUB: is a sub-query that appears in the SELECT class, also commonly called SCALAR SUBQUER. EQ SUB: is shorthand for EQUAL subjquery, subjquer linked with EQUAL sign, such as: col1 (select col1from table 2). IN SUB: is short for IN SUBQUERY, sub-queries connected by IN, using examples such as col1IN (select col1from table 2). EXST SUB: is a shorthand for EXISTS SUQUERY, using an example of EXISTS (select col1from table 2). DERV SUB: is short for the DERIVED SUBQUERY, and the following examples are used: select _ from (select col1from table2) derived _ table.
Further split in UNION dimension: UNION and UNION ALL. UNION refers to a result set used to merge two or more SELECT statements. By default, the UNION operator chooses different values; if duplicate values are allowed, UNION ALL is used.
Further split under INNER JOIN dimension: TB 2 and TB >2 two atomic features. For example, under TB >2, 3 to 5 tables may be inter-connected, which may be denoted INJ TB [3-5 ].
Further split under the OUTER JOIN dimension: LEFT JOIN and RIGHT JOIN. In FIG. 2, for LEFT JOIN, the following atomic features are respectively considered in the LEFT connection condition of the tables 2-5 and can be represented as LEFT JOIN TB [2-5 ]; for RIGHT JOIN, the following atomic features may be considered the RIGHT connection case of 2-5 tables, which may be denoted as RIGHT JOIN TB [2-5 ].
Then, after the atomic features are decomposed, a plurality of case features can be obtained according to the atomic features, each case feature is a formal description of a test case and represents the test case, and the formal description of the test case based on the case features is realized, so that the test case is not abstracted any more and has more operability and scalability. Wherein each case feature comprises at least two atomic features, being a combination of the at least two atomic features. The case characteristics are collected together to form a test case formalized characteristic library. The test case formalized feature library stores a plurality of case features, namely formalized descriptions of a plurality of test cases.
In this embodiment, in the process of combining the atomic features to obtain the case features, the following requirements need to be satisfied:
1) and ensuring that the formal description of each test case is meaningful, namely the case characteristics combined by the atomic characteristics have test verification significance.
2) The coverage requirement on the formalized feature library of the test case is ensured, namely, the combination among the atomic features covers any combination condition with test verification significance as much as possible, and the full coverage of the test case is realized as much as possible.
In this embodiment, the atomic features may be combined according to the above requirements 1) and 2) to obtain case features, and the embodiment is not limited with respect to a specific combination manner, and any combination manner that satisfies the above requirements is applicable to the embodiment of the present application.
In an optional embodiment, the atomic features may be directly fully combined, each fully combined result is fully arranged, and finally, the arrangement results that do not meet the requirement 1) in the fully arranged results are removed, and each of the remaining fully arranged results is a case feature, which is a formal description of a test case and represents a test case. In the embodiments of the present application, the full combination is meant to include all possible combinations; the full arrangement is a special case of arrangement, m (m is less than or equal to n) elements are arbitrarily selected from n different elements and are arranged according to a certain sequence, namely one arrangement of m elements selected from n different elements is selected; when m is n, all permutation cases are called full permutation, and when m is n, one permutation case is a full permutation result in the embodiment of the present application.
In another optional embodiment, the atomic features may be classified, and the completeness of the test case may be considered for different types of atomic features, so that the coverage of the test case may be ensured, and the amount of calculation may be reduced. Optionally, the plurality of atomic features may be divided into core atomic features and non-core atomic features; the core atomic features are atomic features which are relatively more important for the functional characteristics of the software to be tested, and the non-core atomic features are atomic features which are relatively less important for the functional characteristics of the software to be tested. It should be noted that once the software to be tested is determined, the importance of each atomic feature decomposed from the functional characteristics of the software to be tested on the functional characteristics of the software to be tested is also determined. Then, the completeness of the test case can be considered for the core atomic features and the non-core atomic features respectively, that is, on one hand, partial case features are obtained according to the core atomic feature combination, and on the other hand, partial case features are obtained according to the non-core atomic feature combination. In order to ensure the coverage of the core atomic features, in the process of obtaining the partial case features according to the non-core atomic feature combination, the partial case features obtained by the core atomic feature combination can be combined, that is, the other case features can be obtained according to the partial case features obtained by the core atomic feature combination and the non-core atomic feature combination. In this alternative embodiment, the number of elements to be combined in each combining process is reduced, which is beneficial to reducing the amount of calculation.
In the above optional implementation manner, the core atom features may be combined according to the above requirements 1) and 2) to obtain part of case features, and this embodiment is not limited with respect to a specific combination manner, and all combination manners meeting the above requirements are applicable to this embodiment. Two alternative embodiments of combining the core atom features to obtain the partial case features are listed below, but are not limited thereto.
In the optional embodiment a1, the core atom features may be directly fully combined, each fully combined result is fully arranged, and finally the arrangement results that do not meet the requirement 1) are removed from the fully arranged results, and each of the remaining fully arranged results is a case feature, that is, a test case is represented by a formal description of the test case.
In the alternative embodiment a2, the core atomic features can be directly fully combined, and each fully combined result is taken as a case feature, that is, a formal description of a test case, and represents a test case.
In this alternative embodiment a3, the core atomic features are further classified, and the core atomic features are divided into at least two types of core atomic features; respectively carrying out full arrangement on at least two types of core atom characteristics to obtain partial case characteristics; wherein each full-permutation result is a case feature. That is, one core atom feature is taken from each type of core atom features at a time and combined together to form a case feature.
Optionally, the core atomic features may be further classified according to their attributes, or according to their associated roles or attributes.
For example, assuming that the software to be tested is diagnostic software related to the index, the index is a data object associated with the core atomic features and the non-core atomic features, and the core atomic features can be further classified in combination with the function of the index. The function of the index is to filter out unnecessary data as soon as possible, and the index corresponds to predicate grammar such as filtering conditions; another aspect is the desire to avoid ordering, corresponding to the syntax of an ordering class, based on which the core-institution characteristics can be further divided into core-atom characteristics of a predicate class and core-atom characteristics of an ordering class according to the role of the index. Further, the core atom characteristics of the predicate class and the core atom characteristics of the ordering class are respectively arranged in a full mode to obtain partial case characteristics.
Similarly, in the above optional implementation manner, the combination of the partial case features obtained by combining the core atomic features and the non-core atomic features may be performed according to the above requirements 1) and 2) to obtain the remaining case features, which is not limited with respect to the specific combination manner in this embodiment, and all the combination manners meeting the above requirements are applicable to the embodiment of the present application. For example, in an alternative embodiment, some case features and non-core atomic features obtained from the combination of core atomic features may be fully combined to obtain the remaining case features; wherein each full combination result is a case feature.
The following describes an example of the process of obtaining case features according to the combination of the atomic features shown in fig. 2 and the atomic features extracted from the SQL syntax dimension.
In the tree structure shown in FIG. 2, the leaf nodes represent atomic features, which are further divided into core atomic features and non-core atomic features. If the atomic feature is only a numerical value or a numerical range, the feature of the upper level (parent level) can be taken down and expressed in combination with the numerical value or numerical range feature. As shown in fig. 2, the atomic features in the dashed box are core atomic features, such as EQUAL _1, EQUAL _2_4, RANGE _1, GB, OB, DISTINCT, and the like; the atomic features in the remaining boxes are non-core atomic features such as EQUAL _ GT _4 (which is an indication of >4 in EQUAL), INLIST _ GT _ n (which is an indication of > n in INLIST), and so on. In this example, the core atomic features refer to the atomic features that affect the index suggestions, and most of the impact on the index suggestions is covered by the core atomic features; atomic features other than the core atomic feature are all non-core atomic features. These core atomic features are further divided into predicate-class and order-class; the core atomic characteristics of the predicate class include: EQUAL _1, EQUAL _2_4, RANGE _1, OTHR _0, LIKE this, LIKE-LIKE _ PREFIX, LIKE-1, LIKE-n (in the case of LIKE-2-n under LIKE-n); the core atomic features of the sort class include: GB. OB and DISTINCT, etc. Wherein, OTHR _ 0: indicating that none of the other atomic-like features, except the EQUAL and RANGE atomic-like features, are present.
Taking the core atomic features of the predicate classes listed above as an example, the core atomic feature sets of the predicate classes are as follows: { [ EQ _0], [ EQ _1], [ EQ _2_4] }: representing a set of such core atomic features for an equivalent predicate; { [ RG _0], [ RG _1] }: representing a set of core atomic features such as scope predicates; { [ OTHR _0], [ LIKE _ PREFIX ], [ IN _1], [ IN _ LT _100] }: representing a collection of other core atomic features. Wherein 0 in EQ _0, RG _0, OTHR _0 represents: the absence of such an atomic feature is also a case where an atomic feature of a certain type is not present. The elements in the three types of atomic feature sets are combined, one core atomic feature is taken in each set at a time, and 3 × 2 × 4 — 24 combination modes are obtained, wherein each combination mode represents one case feature, namely the formal description of one test case. Similarly, taking the core atomic features of the above listed sorting classes as an example, the core atomic features of the sorting classes are set as follows: { [0] [ GB ] [ DISTINCT ] }: representing a set of core atomic features related to Group; { [0] [ OB ] }: representing a collection of core atomic features that are related to Order. In the above combination, 3 × 2 — 6 combinations can be formed, each of which represents a case characteristic, i.e., a formal description of a test case.
Further, to ensure that the non-core atomic features are covered in the case features, the case features and the non-core atomic features obtained by fully arranging the core atomic features of the predicate class and the ordering class are combined to obtain some other case features. The following is an exemplary illustration of a coarse grain combination:
{ [ EQ _0], [ EQ _ Y ] }: representing two cases of the presence and absence of equivalent predicates; { [ RG _0], [ RG _ Y ] }: whether two conditions exist in the range predicate or not is represented; { [ OTHR _0], [ OTHR _ Y ] }: representing the existence and nonexistence of other atom-like characteristics except for EQUAL and RANGE atom-like characteristics; { [ AGG _0], [ AGG _ Y ] }: whether clustering is performed or not is indicated; { [ SORT _0], [ SORT _ Y ] }: indicating whether to sort the two cases. In these sets, each case is selected to be combined, and each combined case can obtain a case characteristic, namely a formal description of a test case.
The case characteristics obtained by the method provided by the embodiment have higher coverage, and the generated test case can basically cover all performance tests of the functional codes.
In some optional embodiments of the present application, the development process of the software to be tested may include a plurality of different development stages, different functional characteristics of the software to be tested are developed in different development stages, and the functional characteristics responsible for development may become more and more complex as the development stages develop. Corresponding to the development stage, a plurality of different capability levels can be set for the software to be tested, each capability level corresponds to one development stage, the higher the capability level is, the more complex the functional characteristics of the software to be tested, which need to be developed in the corresponding development stage, that is, the more the functional characteristics of the software to be tested are, the more powerful and more complete the functions of the software to be tested are. Based on the method, after the plurality of case characteristics are obtained, a plurality of capability levels corresponding to a plurality of development stages of the software to be tested can be obtained; and classifying the plurality of case characteristics into different capability levels according to the plurality of capability levels. Therefore, the automatic marking of the capability levels of the case characteristics can be realized, the mapping from the case characteristics to the capability levels is realized, and then in the subsequent process of generating the test cases, the test cases required by the corresponding development stages can be generated according to the case characteristics under different capability levels, the staged construction of the test cases is realized, and the test cases are more targeted. In the present embodiment, the function codes of the recommendation index can be divided into three capability levels P3-P5, as shown in fig. 2. The division of the function codes of the recommendation index into three capability levels is merely an example and is not limited to three capability levels. The P3 capability level mainly supports single table simple query, as shown in FIG. 2, AND can support atomic features such as EQUAL, RANGE, OTHER, AGG, SORT, AND, etc. The P4 capability level mainly supports single-table complex queries, and as shown in FIG. 2, can support atomic features such as IMP CONV, NOT, KYWD, OTHER, LIMIT, OR, SUB QY [2T ], UNION ALL [2T ], and INJ [2T ]. The capability level of P5 mainly supports multi-table lookup, as shown in FIG. 2, and mainly supports atomic features such as SUBQY >2T, UNION [ >2T ], INJ >2T, OUTER JOIN, STRT JOIN, NATRL JOIN, and HINT. Wherein 2T is the meaning of two tables, and different meanings can be combined by combining corresponding predicates. For example, SUB QY [2T ] represents a SUB-query that supports the presence of two table connections.
In the embodiment of the application, after the test case formalized feature library is generated, the test cases required for testing the software to be tested can be generated according to the case features in the feature library. In this embodiment, the implementation manner of generating the test cases according to the case characteristics in the test case formalization characteristic library is not limited.
For example, test cases may be manually written by a tester based on case characteristics in a test case formalization characteristics library. For another example, test cases can also be automatically compiled according to case characteristics in a test case formalization characteristic library by means of a computer device in combination with some automatic test case generation methods. The automatic Test case generation method may be an existing method, such as TTF (Test-Template Framework), btt (b Testing tools), or dnf (discrete Normal form); of course, self-created methods are also possible.
In addition to the above-described method of generating test cases, exemplary embodiments of the present application provide another method of generating test cases. In the method, the on-line abundant case resources are combined, the service authenticity of the on-line case in the aspects of logic, data scale and the like is fully utilized, the grip is described in the form of the test case to search the real case meeting the requirement from the on-line case, and therefore the generated test case is in accordance with the actual test scene, and the phenomenon of deviating from the actual scene cannot occur.
As shown in fig. 3a, a schematic flowchart of a test case library generating method provided in an exemplary embodiment of the present application is shown. Referring to fig. 3a, the method comprises:
301. an online case that is about to run and/or has run in the software to be tested is obtained.
302. Matching the characteristics of the online cases in a test case formalized characteristic library; the test case formalized feature library comprises a plurality of case features, and each case feature is a formalized description of one test case.
303. And if the characteristics of the online case are matched in the test case formalized characteristic library, adding the online case into the test case library as a test case required by testing the software to be tested.
In this embodiment, an online case refers to code instructions that can actually run in the software to be tested. The number of cases on the line is plural, but may be one. In a plurality of online cases, code instructions to be actually run in the software to be tested may be included, as well as code instructions that have already been actually run in the software to be tested. For a particular online case, either the code instructions that are to be actually run in the software to be tested or the code instructions that are already being actually run in the software to be tested. In the present embodiment, the code instruction that can be used as an online case mainly refers to some code instructions required for using or accessing the software to be tested, such as a query class code instruction, a service request class code instruction, and the like.
In this embodiment, a pre-generated test case formal feature library is used as an input and a basis in a test case library generation process, a large number of online cases are generated in combination with actual application of software to be tested, a corresponding test case is generated by enumerating features of each case in the test case formal feature library, and the test cases form the test case library.
In the embodiment, the test cases in the test case library are derived from online cases, are adapted to the actual application scene, do not deviate from the actual application scene, and have a better test effect. For example, taking the function code shown in fig. 2 as an example, SQL statements (referred to as normal SQL for short) with normal execution speed and SQL statements (referred to as slow SQL for short) with slow execution speed that run on the database instance corresponding to the function code in the actual application may be collected in advance to form huge data sets of normal SQL and slow SQL, and a corresponding test case is generated from the data set for each case feature in the test case formalized feature library, thereby forming a test case library.
Optionally, in the process of generating the test case library, for each online case, feature extraction may be performed on the online case, for example, feature extraction is performed on normal SQL or slow SQL acquired on the line; matching the extracted features with case features in a test case formalized feature library; if the matching is performed, that is, the case characteristics matched with the extracted characteristics exist in the test case formalized characteristic library, the online case can be further extracted as other auxiliary information required by the test case, such as schema information, statistical information, environmental parameters and the like, and the online case and the auxiliary information are stored in the test case library together.
In an alternative embodiment, the case features in the test case formalized feature library belong to different capability levels, and the different capabilities correspond to different development stages of the software to be tested. Under the condition, the test case can be constructed in stages according to the development stage of the software to be tested, so that the test case is more targeted. Based on this, when it is determined that the online case can be used as a test case, the online case can be further added into the test case library as the test case in the development stage corresponding to the target capability level according to the target capability level to which the case feature matched with the feature of the online case belongs.
It should be noted that the generation process of the test case library may be a dynamic process, that is, the test cases required by the development stage may be respectively constructed in each development stage according to the development stage of the software to be tested. Further, after the test case base is generated, the test case base can be dynamically updated according to the change of the online case. Alternatively, the update process of the test case base may be triggered in case of a specific event, such as when a new online case occurs. Alternatively, the update process of the test case base may be triggered periodically, such as weekly, every 10 days, or daily.
After the test case library is generated, the software to be tested can be tested by using the test cases in the test case library under the condition that the software to be tested needs to be tested. Further, under the condition that the software to be tested has different capability levels and under the condition that the software to be tested needs to be tested, the capability level of the software to be tested at present can be determined; and selecting the test cases under the corresponding capability levels in the test case library to test the software to be tested according to the capability level of the software to be tested at present.
Furthermore, the test result of each test case on the software to be tested can be stored in the test case library for subsequent analysis and improvement of the software to be tested. In addition, the test case which fails to be tested can be deeply analyzed and improved by using a test case analysis tool, so that the construction speed of the test case library is accelerated.
Furthermore, the completeness and coverage of the test case library can be counted by comparing the case characteristics contained in the test case formalized characteristic library with the characteristics of the test cases in the test case library and further combining the test results of each test case in the test case library to the software to be tested. For example, it can be counted which case features are covered by the test cases, which case features are not covered by the test cases, what the completeness of the test case library is, or what the coverage of the test cases is at each capability level. For another example, it is also possible to count information about which functional characteristics of the software to be tested have passed verification, which functional characteristics have not been tested, or test failure.
Further, in the case that the software to be tested fails to test due to some functional characteristic or characteristics, the software to be tested needs to be modified. Alternatively, because of the changing requirements, modifications may be made to the software to be tested. In any case, under the condition that the software to be tested is modified, the modified software to be tested can be subjected to regression testing by reusing the testing case under each capability level in the testing case library, so that the quality of the software to be tested is ensured.
It should be noted that, in the embodiment of the test case formal feature library generation method, the test case formal feature library used in the embodiment may be generated by using the foregoing embodiment, but is not limited thereto. Fig. 3b shows a method framework diagram for generating a test case formalized feature library by using the method provided by the embodiment of the present application. Firstly, collecting atomic features from multiple dimensions to form an atomic feature set; secondly, combining formal descriptions (namely case characteristics) of the test cases according to the atomic characteristics in the atomic characteristic set to form a test case formal characteristic library; thirdly, taking formal description in the formal characteristic library of the test cases as input, and extracting the test cases from the on-line massive SQL cases to form a test case library; fourthly, inputting the test cases in the test case library into a test case operation system for software test and analyzing the test cases by using a test case analysis tool; and fifthly, evaluating the coverage of the test case to generate a test case coverage analysis report.
In the above embodiment, the generation process of the test case formalized feature library is exemplified by recommending the indexed function code to the SQL database. The embodiment of the present application provides an index recommendation method and an index creation method in addition to a test case formalized feature library and a test case library generation method, please refer to the embodiments shown in fig. 3c and fig. 3 d.
Fig. 3c is a flowchart illustrating an index recommendation method according to an exemplary embodiment of the present application. As shown in fig. 3c, the method comprises:
31c, obtaining a database statement, wherein the database statement requests to inquire at least one data table;
32c, respectively generating at least one alternative index for at least one data table;
33c, calculating the search cost of at least one alternative index corresponding to each data table;
34c, recommending indexes for the at least one data table according to the search cost of the at least one alternative index corresponding to each at least one data table.
In most databases, indexes are allowed to be created for the data tables, so that in the process of querying the data tables, an optimizer (or an optimization engine) in the database can select an appropriate index from the indexes of the data tables and perform data table query based on the selected index, and the query efficiency can be improved.
In this embodiment, in order to make the data table have a more reasonable or good index, an index may be recommended for the data table. According to the method and the device, after the data table is created, indexes can be recommended for the data table in the using process of the data table, and therefore more reasonable or high-quality indexes can be added for the data table.
The query conditions and query modes of different database statements for the same data table are different, so that indexes can be recommended to the data table related to the database statements from the perspective of the database statements. Based on this, a database statement may be obtained, the database statement requesting a query of at least one data table; then, respectively generating at least one alternative index for at least one data table; and calculating the search cost of at least one alternative index corresponding to each at least one data table, and recommending indexes for each at least one data table from the alternative indexes corresponding to each at least one data table based on the search cost.
In this embodiment, the type of the database statement is not limited, and may be, for example, an SQL statement, an MySQL statement, or the like.
When generating the alternative indexes for the data tables, the alternative indexes may be generated for each data table in an enumeration manner based on the index rule. For a data table, one candidate index may be generated, or a plurality of candidate indexes may be generated.
In this embodiment, the manner of acquiring the database statement is not limited. For example, the database statement written by the query user may be obtained from the user side, or the database statement may be obtained from the database. Wherein, the database statement in the database is also submitted by the query user. One embodiment of obtaining the database statement from the database includes: and acquiring the database statement from the database under the condition that a preset event occurs. Alternatively, the database statement obtained from the database may be a database statement that has already been executed by the database, or may be a database statement that has not yet been executed.
Wherein the preset event includes but is not limited to at least one of the following: and when the execution speed of the database is lower than a set speed threshold, the database is abnormal, and the set task period is reached.
For example, when the execution speed of the database is lower than the set speed threshold, the executed partial database statements may be obtained from the database, and then indexes are recommended to the data tables related to the database statements by using the method shown in fig. 3c, so that the execution efficiency of the database statements to be subsequently queried may be improved because the indexes of the data tables are more reasonable and superior.
For another example, when an abnormal condition occurs in the database, a part of database statements causing the database to be abnormal may be obtained from the database, and then an index is recommended to the data tables related to the database statements by using the method shown in fig. 3 c.
For another example, it may be set that indexes are periodically recommended to a data table in the database, and the period is referred to as a task period. When the task cycle arrives, part or all of the database statements that have been executed in the current cycle can be acquired, and then indexes are recommended to the data tables related to the database statements by using the method shown in fig. 3 c.
In the above embodiment, the description has been given by taking an example of recommending an index for a data table related to an already executed database statement. In other embodiments, if necessary, before executing a certain database statement, the database may recommend an index to the data table related to the certain database statement by using the method shown in fig. 3c, and then execute the database statement based on the reasonable and high-quality index, which is beneficial to improving the execution efficiency of the database statement. Of course, if the requirement of the database on the execution efficiency of the database statement is high and the efficiency of the recommendation index service is high, the database may also recommend an index to the data table to be queried by the database statement to be executed before executing each database statement, and then execute the database statement based on the more reasonable and advantageous index, thereby improving the execution efficiency of the database statement.
It should be noted that, a database statement needs to query at least one data table, but recommending an index for at least one data table does not necessarily mean that an index can be recommended for each data table, and only a more suitable or better index may be recommended for some of the data tables. For ease of distinction and description, the data table for which the index was successfully recommended is referred to as the target data table. The target data table is part or all of at least one data table that the database statement needs to query.
Based on the above, after recommending indexes for at least one data table, the method further includes: and sending the index recommended for the target data table to the database so that the database can add the recommended index for the target data table.
In the above embodiments of the present application, the implementation of calculating the search cost of the candidate index is not limited. Alternatively, one implementation of step 33c is as follows:
firstly, a plurality of search paths corresponding to database statements are constructed according to at least one alternative index and at least one original index corresponding to at least one data table respectively. Wherein, indexes used by different search paths are not identical; each search path comprises an index corresponding to at least one data table; in each search path, the index corresponding to one data table may be a candidate index or an original index. Alternatively, multiple search paths may form a search space corresponding to a database statement. The original index of the data table is the index that the data table already has before the index recommendation is executed. The original index of the data table may be one or more.
After obtaining the plurality of search paths, the search costs of the plurality of search paths can be calculated; and then, obtaining the search cost of at least one alternative index corresponding to each of at least one data table according to the search costs of the plurality of search paths. The search cost of the search path may be represented by, but not limited to, resources consumed by completing the search of the at least one data table based on the search path, such as IO resources, CPU resources, and the like. The search cost of the search path including the candidate index may be used as the search cost of the candidate index, or the search cost of the search path including the candidate index may be subjected to some numerical processing and then used as the search cost of the candidate index.
In the above embodiments of the present application, there is no limitation to an implementation that recommends an index for at least one data table according to a search cost of at least one candidate index corresponding to each at least one data table. The embodiment of recommending indexes for any data table is basically the same as that of recommending indexes for any data table. In the following alternative embodiments of the present application, the index recommendation process is exemplified by taking the first data table as an example. The first data table is any one of the at least one data table. Optionally, one implementation of step 34c is as follows:
aiming at a first data table, judging whether an alternative index with the search cost smaller than the minimum search cost in at least one original index corresponding to the first data table exists in at least one alternative index corresponding to the first data table;
if yes, recommending indexes for the first data table from the alternative indexes with the searching cost smaller than the minimum searching cost in at least one original index corresponding to the first data table.
Optionally, the alternative index corresponding to the minimum search cost may be selected as the index recommended to the first data table from the alternative indexes whose search cost is less than the minimum search cost in the at least one original index corresponding to the first data table; alternatively, a candidate index may be randomly selected from the first data table as the index recommended to the first data table.
Further optionally, if there is no alternative index with a search cost smaller than the minimum search cost in the at least one original index corresponding to the first data table in the at least one alternative index corresponding to the first data table, it means that the original index of the first data table is already good enough, so that an index may not be recommended for the first data table any more.
Through the above, more reasonable and high-quality indexes can be recommended for part or all of at least one data table requested to be queried by the database statement, so that the query efficiency of the data tables is improved, and the execution efficiency of the corresponding database statement can be improved.
It should be noted that the index recommendation method provided by the above embodiment can be served, and can provide an index recommendation service for a database. Based on this, besides the above index recommendation method, an embodiment of the present application further provides an index creation method, as shown in fig. 3d, the method includes:
31d, determining a database statement to be optimized, wherein the database statement to be optimized requests to inquire at least one data table;
32d, invoking an index recommendation service to recommend indexes for at least one data table;
33d, acquiring a target data table returned by the index recommendation service and an index recommended for the target data table;
34d, adding an index recommendation service for the target data table to recommend the index; the target data table is a part or all of the at least one data table.
The embodiment is suitable for the database statement execution device, for example, a database engine. In this embodiment, in order to improve the query efficiency of the data table and further improve the execution efficiency of the database statement, an index recommendation service may be invoked to recommend an index for at least one data table requested to be queried by the database statement; then, acquiring a target data table returned by the index recommendation service and an index recommended for the target data table; and adding an index recommended service for the target data table to recommend the index, so as to improve the query efficiency of the data table.
In this embodiment, the trigger condition for invoking the index recommendation service to perform index recommendation is not limited. Alternatively, events may be preset, and in the case of these events, the database statement to be optimized is determined from the database statements already received by the database. Wherein the preset event comprises at least one of the following: and when the execution speed of the database is lower than a set speed threshold, the database is abnormal, and the set task period is reached.
The database statements that the database has received include: database statements that have been received and executed also include database statements that have been received and not executed. Based on this, from the received database statements, already executed database statements and/or not yet executed database statements may be determined as the database statements to be optimized. It should be noted that, according to application requirements, the database statements to be optimized may be flexibly selected from the received database statements. For example, 11, 5, 10, or 20 database statements may be selected at a time, or one tenth, ten percent, or all database statements that have not been currently optimized may be selected, and so on.
Further, when the database statement to be optimized is the database statement that is not executed yet, the index recommendation service is called in advance before the database statement is executed, an index is recommended for at least one data table to be queried by the database statement, and after an index recommended for a target data table in the at least one data table according to the index recommendation service is added to the target data table, the database statement to be optimized is executed in combination with the index added to the target data table, so that the execution efficiency of the database statement is improved.
The index recommendation service may recommend an index for at least one data table by using the method shown in fig. 3c, but is not limited thereto.
In this embodiment, the index recommendation service may be invoked as needed or periodically to add indexes to the data tables in the database, which is beneficial to improving the query efficiency of the data tables, and further improving the execution efficiency of the database statements that need to query the data tables.
It should be noted that the execution subjects of the steps of the methods provided in the above embodiments may be the same device, or different devices may be used as the execution subjects of the methods. For example, the execution subjects of steps 101 to 103 may be device a; for another example, the execution subject of step 101 may be device a, and the execution subject of step 102 may be device B; and so on.
In addition, in some of the flows described in the above embodiments and the drawings, a plurality of operations are included in a specific order, but it should be clearly understood that the operations may be executed out of the order presented herein or in parallel, and the sequence numbers of the operations, such as 101, 102, etc., are merely used for distinguishing different operations, and the sequence numbers do not represent any execution order per se. Additionally, the flows may include more or fewer operations, and the operations may be performed sequentially or in parallel. It should be noted that, the descriptions of "first", "second", etc. in this document are used for distinguishing different messages, devices, modules, etc., and do not represent a sequential order, nor limit the types of "first" and "second" to be different.
Fig. 4 is a schematic structural diagram of a computer device according to an exemplary embodiment of the present application. As shown in fig. 4, the computer apparatus includes: a memory 41 and a processor 42.
The memory 41 is used for storing computer programs and may be configured to store other various data to support operations on the computer device. Examples of such data include instructions for any application or method operating on the computer device, contact data, phonebook data, messages, pictures, videos, and the like.
A processor 42, coupled to the memory 41, for executing the computer program in the memory 41 to: performing characteristic decomposition on the functional characteristics of the software to be tested to obtain a plurality of atomic characteristics; obtaining a plurality of case characteristics according to a plurality of atom characteristic combinations, wherein each case characteristic is a formal description of a test case; and generating a test case formalized feature library according to the plurality of case features.
In an alternative embodiment, processor 42, when obtaining the plurality of atomic features, is specifically configured to: determining at least one basic dimension which has influence on the functional characteristics of the software to be tested according to the test requirement corresponding to the software to be tested; and performing hierarchical feature decomposition on the functional characteristics of the application software to be tested from at least one basic dimension to obtain a plurality of atomic features.
In an alternative embodiment, processor 42, in deriving the plurality of case characteristics, is specifically configured to: dividing the plurality of atomic features into core atomic features and non-core atomic features; obtaining part of case characteristics in the plurality of case characteristics according to the core atom characteristic combination; and combining the partial case characteristics with the non-core atom characteristics to obtain the other case characteristics in the plurality of case characteristics.
Further optionally, the processor 42, when obtaining the partial case characteristics, is specifically configured to: dividing the core atomic features into at least two types of core atomic features; respectively carrying out full arrangement on at least two types of core atom characteristics to obtain partial case characteristics; wherein each full-permutation result is a case feature.
Further optionally, in the case that the software to be tested is index-related diagnostic software, the processor 42 is specifically configured to: and according to the action of the index, dividing the core atom characteristics into core atom characteristics of a predicate class and core atom characteristics of an ordering class.
Further optionally, the processor 42, when obtaining the remaining case characteristics, is specifically configured to: fully combining the obtained partial case characteristics and the non-core atom characteristics to obtain other case characteristics; wherein each full combination result is a case feature.
In an alternative embodiment, processor 42 is further configured to: after the test case formalized feature library is generated, the test case required by testing the software to be tested is generated according to the case features in the test case formalized feature library.
Further optionally, the processor 42, when generating the test case, is specifically configured to: acquiring an online case to be actually run in and/or already run in software to be tested; matching the characteristics of the online cases in a test case formalized characteristic library; and if the characteristics of the online cases are matched in the test case formalized characteristic library, adding the online cases serving as the test cases into the test case library.
In an alternative embodiment, processor 42 is further configured to: after obtaining a plurality of case characteristics, acquiring a plurality of capability levels corresponding to a plurality of development stages of the software to be tested; the higher the capability level is, the more complicated the functional characteristics of the software to be tested, which needs to be developed in the corresponding development stage, are; and classifying the plurality of case characteristics into different capability levels according to the plurality of capability levels.
Further, when the online case is added to the test case library as a test case, the processor 42 is specifically configured to: and adding the online case into the test case library as the test case under the development stage corresponding to the target capability level according to the target capability level to which the case characteristics matched with the online case belong.
Further, as shown in fig. 4, the computer apparatus further includes: communication components 43, display 44, power components 45, audio components 46, and the like. Only some of the components are shown schematically in fig. 4, and it is not meant that the computer device includes only the components shown in fig. 4. In addition, the components within the dashed box in fig. 4 are optional components, not necessary components, and may depend on the product form of the computer device. The computer device of this embodiment may be implemented as a terminal device such as a desktop computer, a notebook computer, or a smart phone, or may be a server device such as a conventional server, a cloud server, or a server array. If the computer device of this embodiment is implemented as a terminal device such as a desktop computer, a notebook computer, a smart phone, etc., the computer device may include components within a dashed line frame in fig. 4; if the computer device of this embodiment is implemented as a server device such as a conventional server, a cloud server, or a server array, the components in the dashed box in fig. 4 may not be included.
Accordingly, the present application further provides a computer readable storage medium storing a computer program, and when the computer program is executed by a processor, the computer program causes the processor to implement the steps in the test case formal feature library generation method embodiment.
Fig. 5 is a schematic structural diagram of another computer device according to an exemplary embodiment of the present application. As shown in fig. 5, the computer apparatus includes: a memory 51 and a processor 52.
The memory 51 is used for storing computer programs and may be configured to store other various data to support operations on the computer device. Examples of such data include instructions for any application or method operating on the computer device, contact data, phonebook data, messages, pictures, videos, and the like.
A processor 52 coupled to the memory 51 for executing the computer program in the memory 51 for: acquiring an online case to be actually run in and/or already run in software to be tested; matching the characteristics of the online cases in a test case formal characteristic library, wherein the test case formal characteristic library comprises a plurality of case characteristics, and each case characteristic is the formal description of one test case; and if the characteristics of the online cases are matched in the test case formalized characteristic library, adding the online cases into the test case library as the test cases required by testing the software to be tested.
In an optional embodiment, the plurality of case characteristics belong to different capability levels, and the different capability levels correspond to different development stages of the software to be tested. Wherein, the higher the capability level is, the more complicated the functional characteristics of the software to be tested which needs to be developed in the corresponding development stage are. Based on this, the processor 42 is specifically configured to, when adding the online case as a test case to the test case library: and adding the online case into the test case library as a test case under a development stage corresponding to the target capability level according to the target capability level to which the case features matched with the features of the online case belong.
In an alternative embodiment, processor 42 is further configured to: after a test case library is generated, determining the current capability level of the software to be tested under the condition that the software to be tested needs to be tested; and selecting the test cases under the corresponding capability levels in the test case library to test the software to be tested according to the capability level of the software to be tested at present.
In an alternative embodiment, processor 42 is further configured to: after the test case base is generated, under the condition that the software to be tested is modified, the modified software to be tested is subjected to regression test by reusing the test cases under each capability level in the test case base.
In an alternative embodiment, processor 42 is further configured to: performing characteristic decomposition on the functional characteristics of the software to be tested to obtain a plurality of atomic characteristics; obtaining a plurality of case characteristics according to a plurality of atom characteristic combinations, wherein each case characteristic is a formal description of a test case; and generating a test case formalized feature library according to the plurality of case features. For a detailed description of the processor 42 generating the test case formal feature library, reference may be made to the foregoing embodiments, which are not described in detail in this embodiment.
Further, as shown in fig. 5, the computer apparatus further includes: communication components 53, display 55, power components 55, audio components 56, and the like. Only some of the components are shown schematically in fig. 5, and it is not meant that the computer device includes only the components shown in fig. 5. In addition, the components within the dashed box in fig. 5 are optional components, not necessary components, and may depend on the product form of the computer device. The computer device of this embodiment may be implemented as a terminal device such as a desktop computer, a notebook computer, or a smart phone, or may be a server device such as a conventional server, a cloud server, or a server array. If the computer device of this embodiment is implemented as a terminal device such as a desktop computer, a notebook computer, a smart phone, etc., the computer device may include components within a dashed line frame in fig. 5; if the computer device of this embodiment is implemented as a server device such as a conventional server, a cloud server, or a server array, the components in the dashed box in fig. 5 may not be included.
Accordingly, the present application further provides a computer readable storage medium storing a computer program, and when the computer program is executed by a processor, the computer program causes the processor to implement the steps in the test case library generation method embodiment.
An embodiment of the present application further provides a computer device, where the computer device includes: a memory and a processor; wherein the memory is used for storing the computer program; a processor, coupled with the memory, for executing a computer program stored in the memory for: obtaining a database statement, wherein the database statement requests to inquire at least one data table; respectively generating at least one alternative index for at least one data table; calculating the search cost of at least one alternative index corresponding to each data table; and recommending indexes for the at least one data table according to the search cost of the at least one alternative index corresponding to each at least one data table.
In an optional embodiment, when calculating the search cost of the candidate index, the processor is specifically configured to: constructing a plurality of search paths corresponding to database statements according to at least one alternative index and at least one original index corresponding to at least one data table; calculating the search cost of a plurality of search paths; wherein, indexes used by different search paths are not identical; and obtaining the search cost of at least one alternative index corresponding to each of at least one data table according to the search costs of the plurality of search paths.
In an optional embodiment, when recommending an index for at least one data table, the processor is specifically configured to: aiming at a first data table, judging whether an alternative index with the search cost smaller than the minimum search cost in at least one original index corresponding to the first data table exists in at least one alternative index corresponding to the first data table; if yes, recommending indexes for the first data table from alternative indexes with the searching cost smaller than the minimum searching cost in at least one original index corresponding to the first data table; wherein the first data table is any one of the at least one data table.
In an optional embodiment, the processor, when obtaining the database statement, is specifically configured to: when a preset event occurs, acquiring a database statement from a database; wherein the preset event comprises at least one of the following: and when the execution speed of the database is lower than a set speed threshold, the database is abnormal, and the set task period is reached.
In an optional embodiment, the processor, when obtaining the database statement, is specifically configured to: and acquiring the database statements executed by the database and/or the database statements not executed yet from the database.
In an alternative embodiment, the processor is further configured to: after the index is recommended for at least one data table, the index recommended for the target data table is sent to a database, so that the database can add the recommended index for the target data table; wherein, the target data table is a part of or all the data tables in the at least one data table.
In addition to the memory and the processor, the computer device of the present embodiment may further include: communication components and power components, among other components. The block diagram of the computer device according to this embodiment is similar to the block diagrams of the devices shown in fig. 4 and 5, and therefore, the illustration is not repeated, and reference may be made to the block diagrams of fig. 4 and 5.
In addition to the computer device, the present application provides a computer-readable storage medium storing a computer program, which when executed by a processor causes the processor to implement the steps in the above-mentioned index recommendation method.
An embodiment of the present application further provides a computer device, where the computer device includes: a memory and a processor; wherein the memory is used for storing the computer program; a processor, coupled with the memory, for executing a computer program stored in the memory for: determining a database statement to be optimized, wherein the database statement to be optimized requests to query at least one data table; invoking an index recommendation service to recommend an index for at least one data table; acquiring a target data table returned by the index recommendation service and an index recommended for the target data table; adding an index recommendation service for the target data table to recommend the index; the target data table is a part or all of the at least one data table.
In an optional embodiment, when determining the database statement to be optimized, the processor is specifically configured to: when a preset event occurs, determining a database statement to be optimized from the received database statements; wherein the preset event comprises at least one of the following: and when the execution speed of the database is lower than a set speed threshold, the database is abnormal, and the set task period is reached.
In an optional embodiment, when determining the database statement to be optimized from the received database statements, the processor is specifically configured to: and determining the executed database statements and/or the unexecuted database statements from the received database statements as the database statements to be optimized.
Further optionally, in a case that the database statement to be optimized is an unexecuted database statement, after adding an index recommended by the index recommendation service to the target data table, the processor is further configured to: and executing the database statement to be optimized by combining the newly added index of the target data table.
In addition to the memory and the processor, the computer device of the present embodiment may further include: communication components and power components, among other components. The block diagram of the computer device according to this embodiment is similar to the block diagrams of the devices shown in fig. 4 and 5, and therefore, the illustration is not repeated, and reference may be made to the block diagrams of fig. 4 and 5.
In addition to the computer device, the present application provides a computer-readable storage medium storing a computer program, which when executed by a processor causes the processor to implement the steps in the above-mentioned index creation method embodiment.
The memories of fig. 4 and 5 may be implemented by any type of volatile or non-volatile memory device or combination thereof, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
The communication components of fig. 4 and 5 described above are configured to facilitate wired or wireless communication between the device in which the communication component is located and other devices. The device in which the communication component is located may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component may further include a Near Field Communication (NFC) module, Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and the like.
The displays in fig. 4 and 5 described above include screens, which may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.
The power supply components of fig. 4 and 5 described above provide power to the various components of the device in which the power supply components are located. The power components may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device in which the power component is located.
The audio components of fig. 4 and 5 described above may be configured to output and/or input audio signals. For example, the audio component includes a Microphone (MIC) configured to receive an external audio signal when the device in which the audio component is located is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may further be stored in a memory or transmitted via a communication component. In some embodiments, the audio assembly further comprises a speaker for outputting audio signals.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (35)

1. A method for generating a test case formalized feature library is characterized by comprising the following steps:
performing characteristic decomposition on the functional characteristics of the software to be tested to obtain a plurality of atomic characteristics;
obtaining a plurality of case characteristics according to the plurality of atomic characteristic combinations, wherein each case characteristic is a formal description of a test case;
and generating a test case formalized feature library according to the plurality of case features.
2. The method of claim 1, wherein performing feature decomposition on the functional characteristics of the software under test to obtain a plurality of atomic features comprises:
determining at least one basic dimension which has influence on the functional characteristics of the software to be tested according to the testing requirement corresponding to the software to be tested;
and performing hierarchical feature decomposition on the functional characteristics of the application software to be tested respectively from the at least one basic dimension to obtain the plurality of atomic features.
3. The method of claim 1, wherein obtaining a plurality of case features from the plurality of atomic feature combinations comprises:
dividing the plurality of atomic features into core atomic features and non-core atomic features;
obtaining part of case characteristics in the case characteristics according to the core atom characteristic combination;
and obtaining other case characteristics in the plurality of case characteristics according to the combination of the partial case characteristics and the non-core atom characteristics.
4. The method of claim 3, wherein obtaining the partial case features of the plurality of case features from the core atomic feature combinations comprises:
dividing the core atomic features into at least two types of core atomic features;
respectively carrying out full arrangement on the at least two types of core atom characteristics to obtain the partial case characteristics; wherein each full-permutation result is a case feature.
5. The method of claim 4, wherein if the software under test is an index-related diagnostic class of software, dividing the core atomic features into at least two classes of core atomic features comprises:
and dividing the core atom characteristics into core atom characteristics of a predicate class and core atom characteristics of an ordering class according to the action of the index.
6. The method of claim 3, wherein obtaining remaining case features from the combination of the partial case features and the non-core atomic features comprises:
fully combining the partial case characteristics and the non-core atom characteristics to obtain the other case characteristics; wherein each full combination result is a case feature.
7. The method of any one of claims 1-6, further comprising, after generating the test case formalized feature library:
and generating a test case required for testing the software to be tested according to the case characteristics in the test case formalized characteristic library.
8. The method of claim 7, wherein generating test cases for testing the software to be tested according to case characteristics in the test case formalized characteristic library comprises:
acquiring an online case to be actually run in and/or already run in the software to be tested;
matching the characteristics of the online cases in the test case formalized characteristic library;
and if the characteristics of the online case are matched in the test case formalized characteristic library, adding the online case serving as the test case into the test case library.
9. The method of claim 8, after obtaining the plurality of case features, further comprising:
acquiring a plurality of capability levels corresponding to a plurality of development stages of the software to be tested; the higher the capability level is, the more complicated the functional characteristics of the software to be tested, which needs to be developed in the corresponding development stage, are;
and classifying the plurality of case characteristics into different capability levels according to the plurality of capability levels.
10. The method of claim 9, wherein adding the online cases as test cases to a test case library comprises:
and adding the online case into the test case library as a test case under a development stage corresponding to the target capability level according to the target capability level to which the case characteristics matched with the online case belong.
11. A test case library generation method is characterized by comprising the following steps:
acquiring an online case to be actually run in and/or already run in software to be tested;
matching the characteristics of the online cases in a test case formal characteristic library, wherein the test case formal characteristic library comprises a plurality of case characteristics, and each case characteristic is a formal description of one test case;
and if the characteristics of the online case are matched in the test case formalized characteristic library, adding the online case into the test case library as the test case required by testing the software to be tested.
12. The method of claim 11, wherein the plurality of case characteristics belong to different capability levels, the different capability levels corresponding to different development stages of the software to be tested;
adding the online case into a test case library as a test case required by testing the software to be tested, wherein the step of adding the online case into the test case library comprises the following steps:
and adding the online case into the test case library as a test case in a development stage corresponding to the target capability level according to the target capability level to which the case features matched with the features of the online case belong.
13. The method of claim 12, wherein after generating the test case library, the method further comprises:
determining the current capability level of the software to be tested under the condition that the software to be tested needs to be tested;
and selecting the test cases under the corresponding capability levels in the test case library to test the software to be tested according to the capability level of the software to be tested at present.
14. The method of claim 12 or 13, wherein after generating the test case library, the method further comprises:
and under the condition that the software to be tested is modified, carrying out regression testing on the modified software to be tested by reusing the test cases under each capability level in the test case library.
15. A computer device, comprising: a memory and a processor;
the memory for storing a computer program;
the processor, coupled with the memory, to execute the computer program to:
performing characteristic decomposition on the functional characteristics of the software to be tested to obtain a plurality of atomic characteristics;
obtaining a plurality of case characteristics according to the plurality of atomic characteristic combinations, wherein each case characteristic is a formal description of a test case;
and generating a test case formalized feature library according to the plurality of case features.
16. The computer apparatus of claim 15, wherein the processor, in obtaining the plurality of case features, is specifically configured to:
dividing the plurality of atomic features into core atomic features and non-core atomic features;
obtaining part of case characteristics in the case characteristics according to the core atom characteristic combination;
and obtaining other case characteristics in the plurality of case characteristics according to the combination of the partial case characteristics and the non-core atom characteristics.
17. The computer device of claim 16, wherein the processor, when obtaining the partial case features, is specifically configured to: dividing the core atomic features into at least two types of core atomic features; and respectively carrying out full arrangement on the at least two types of core atom characteristics, wherein each full arrangement result is used as a case characteristic.
18. The computer device of claim 16, wherein the processor, when obtaining the remaining case features, is specifically configured to: and fully combining the partial case features and the non-core atomic features, wherein each fully combined result is a case feature.
19. The computer device of any one of claims 15-18, wherein the processor is further configured to: and generating a test case required for testing the software to be tested according to the case characteristics in the test case formalized characteristic library.
20. A computer device, comprising: a memory and a processor;
the memory for storing a computer program;
the processor, coupled with the memory, to execute the computer program to:
acquiring an online case to be actually run in and/or already run in software to be tested;
matching the characteristics of the online cases in a test case formal characteristic library, wherein the test case formal characteristic library comprises a plurality of case characteristics, and each case characteristic is a formal description of one test case;
and if the characteristics of the online case are matched in the test case formalized characteristic library, adding the online case into the test case library as the test case required by testing the software to be tested.
21. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, causes the processor to carry out the steps of the method according to any one of claims 1 to 10.
22. A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, causes the processor to carry out the steps of the method according to any one of claims 11-14.
23. An index recommendation method, comprising:
obtaining a database statement, wherein the database statement requests to inquire at least one data table;
respectively generating at least one alternative index for the at least one data table;
calculating the search cost of at least one alternative index corresponding to each data table;
and recommending indexes for the at least one data table according to the search cost of the at least one alternative index corresponding to the at least one data table respectively.
24. The method of claim 23, wherein calculating the search cost of the at least one alternative index corresponding to each of the at least one data table comprises:
constructing a plurality of search paths corresponding to the database statements according to at least one alternative index and at least one original index corresponding to the at least one data table;
calculating the search cost of the plurality of search paths; wherein, indexes used by different search paths are not identical;
and obtaining the search cost of at least one alternative index corresponding to each of the at least one data table according to the search costs of the plurality of search paths.
25. The method of claim 23, wherein recommending indexes for the at least one data table according to the search cost of the at least one alternative index corresponding to each of the at least one data table comprises:
aiming at a first data table, judging whether an alternative index with the search cost smaller than the minimum search cost in at least one original index corresponding to the first data table exists in at least one alternative index corresponding to the first data table;
if yes, recommending an index for the first data table from the alternative indexes with the searching cost smaller than the minimum searching cost in at least one original index corresponding to the first data table;
wherein the first data table is any one of the at least one data table.
26. The method of any one of claims 23-25, wherein obtaining a database statement comprises:
when a preset event occurs, acquiring a database statement from a database; wherein the preset event comprises at least one of the following:
and when the execution speed of the database is lower than a set speed threshold, the database is abnormal, and the set task period is reached.
27. The method of claim 26, wherein retrieving database statements from a database comprises:
and acquiring the executed database statements and/or the unexecuted database statements of the database from the database.
28. The method of claim 26, further comprising, after recommending an index for the at least one data table:
sending the index recommended for the target data table to the database so that the database can add the recommended index for the target data table; wherein the target data table is a part or all of the at least one data table.
29. An index creation method, comprising:
determining a database statement to be optimized, wherein the database statement to be optimized requests to query at least one data table;
invoking an index recommendation service to recommend an index for the at least one data table;
acquiring a target data table returned by the index recommendation service and an index recommended for the target data table;
adding an index recommended by the index recommendation service for the target data table; wherein the target data table is a part or all of the at least one data table.
30. The method of claim 29, wherein determining the database statement to be optimized comprises:
when a preset event occurs, determining a database statement to be optimized from the received database statements;
wherein the preset event comprises at least one of the following: and when the execution speed of the database is lower than a set speed threshold, the database is abnormal, and the set task period is reached.
31. The method of claim 30, wherein determining the database statement to be optimized from the received database statements comprises:
and determining the executed database statements and/or the unexecuted database statements from the received database statements as the database statements to be optimized.
32. The method of claim 31, wherein in a case that the database statement to be optimized is an unexecuted database statement, after adding an index recommended by the index recommendation service for the target data table, the method further comprises:
and executing the database statement to be optimized by combining the newly added index of the target data table.
33. A computer device, comprising: a memory and a processor;
the memory for storing a computer program;
the processor, coupled with the memory, to execute the computer program to:
obtaining a database statement, wherein the database statement requests to inquire at least one data table;
respectively generating at least one alternative index for the at least one data table;
calculating the search cost of at least one alternative index corresponding to each data table;
and recommending indexes for the at least one data table according to the search cost of the at least one alternative index corresponding to the at least one data table respectively.
34. A computer device, comprising: a memory and a processor;
the memory for storing a computer program;
the processor, coupled with the memory, to execute the computer program to:
determining a database statement to be optimized, wherein the database statement to be optimized requests to query at least one data table;
invoking an index recommendation service to recommend an index for the at least one data table;
acquiring a target data table returned by the index recommendation service and an index recommended for the target data table;
adding an index recommended by the index recommendation service for the target data table; wherein the target data table is a part or all of the at least one data table.
35. A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, causes the processor to carry out the steps of the method of any one of claims 23-32.
CN201911096312.6A 2019-11-11 2019-11-11 Test case library and feature library generation method, device and storage medium Active CN112783758B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911096312.6A CN112783758B (en) 2019-11-11 2019-11-11 Test case library and feature library generation method, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911096312.6A CN112783758B (en) 2019-11-11 2019-11-11 Test case library and feature library generation method, device and storage medium

Publications (2)

Publication Number Publication Date
CN112783758A true CN112783758A (en) 2021-05-11
CN112783758B CN112783758B (en) 2024-02-27

Family

ID=75749220

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911096312.6A Active CN112783758B (en) 2019-11-11 2019-11-11 Test case library and feature library generation method, device and storage medium

Country Status (1)

Country Link
CN (1) CN112783758B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114398378A (en) * 2022-03-25 2022-04-26 北京奥星贝斯科技有限公司 Method and device for determining index cost

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030018945A1 (en) * 2001-07-20 2003-01-23 Foster Harry D. System and method for evaluating functional coverage linked to a verification test plan
CN102135938A (en) * 2011-03-21 2011-07-27 中国工商银行股份有限公司 Software product testing method and system
CN102982286A (en) * 2011-09-06 2013-03-20 海尔集团公司 Generation method and system of privacy policy of constants bit rate (CBR) under pervasive computing environment
CN105320679A (en) * 2014-07-11 2016-02-10 中国移动通信集团重庆有限公司 Data table index set generation method and device
CN106326122A (en) * 2016-08-23 2017-01-11 北京精密机电控制设备研究所 Software unit test case management system
CN107656872A (en) * 2017-10-09 2018-02-02 平安普惠企业管理有限公司 Method for testing software, device, equipment and computer-readable storage medium
CN108089980A (en) * 2017-12-03 2018-05-29 中国直升机设计研究所 A kind of method for testing software of the demand search library based on Formal Languages Event-B
CN109815147A (en) * 2019-01-21 2019-05-28 深圳乐信软件技术有限公司 Test cases generation method, device, server and medium
CN109871309A (en) * 2017-12-04 2019-06-11 中国移动通信集团公司 A kind of charge system test cases generation method and system
CN110321291A (en) * 2019-07-12 2019-10-11 中国工商银行股份有限公司 Test cases intelligent extraction system and method

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030018945A1 (en) * 2001-07-20 2003-01-23 Foster Harry D. System and method for evaluating functional coverage linked to a verification test plan
CN102135938A (en) * 2011-03-21 2011-07-27 中国工商银行股份有限公司 Software product testing method and system
CN102982286A (en) * 2011-09-06 2013-03-20 海尔集团公司 Generation method and system of privacy policy of constants bit rate (CBR) under pervasive computing environment
CN105320679A (en) * 2014-07-11 2016-02-10 中国移动通信集团重庆有限公司 Data table index set generation method and device
CN106326122A (en) * 2016-08-23 2017-01-11 北京精密机电控制设备研究所 Software unit test case management system
CN107656872A (en) * 2017-10-09 2018-02-02 平安普惠企业管理有限公司 Method for testing software, device, equipment and computer-readable storage medium
CN108089980A (en) * 2017-12-03 2018-05-29 中国直升机设计研究所 A kind of method for testing software of the demand search library based on Formal Languages Event-B
CN109871309A (en) * 2017-12-04 2019-06-11 中国移动通信集团公司 A kind of charge system test cases generation method and system
CN109815147A (en) * 2019-01-21 2019-05-28 深圳乐信软件技术有限公司 Test cases generation method, device, server and medium
CN110321291A (en) * 2019-07-12 2019-10-11 中国工商银行股份有限公司 Test cases intelligent extraction system and method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
丁洪达;王伟光;曾庆凯;: "一种基于形式化描述的测试案例生成方法", 解放军理工大学学报(自然科学版), no. 04, pages 16 - 21 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114398378A (en) * 2022-03-25 2022-04-26 北京奥星贝斯科技有限公司 Method and device for determining index cost

Also Published As

Publication number Publication date
CN112783758B (en) 2024-02-27

Similar Documents

Publication Publication Date Title
US9916368B2 (en) Non-exclusionary search within in-memory databases
US6801903B2 (en) Collecting statistics in a database system
CN111971666A (en) Dimension context propagation technology for optimizing SQL query plan
US9747349B2 (en) System and method for distributing queries to a group of databases and expediting data access
US8543535B2 (en) Generation of star schemas from snowflake schemas containing a large number of dimensions
US20140006339A1 (en) Detecting reference data tables in extract-transform-load processes
CN110795455A (en) Dependency relationship analysis method, electronic device, computer device and readable storage medium
US20170337232A1 (en) Methods of storing and querying data, and systems thereof
US9411803B2 (en) Responding to natural language queries
CN112988782B (en) Hive-supported interactive query method and device and storage medium
US20180129708A1 (en) Query processing management in a database management system
US10915535B2 (en) Optimizations for a behavior analysis engine
US11449477B2 (en) Systems and methods for context-independent database search paths
CN114625732A (en) Query method and system based on Structured Query Language (SQL)
JP5927886B2 (en) Query system and computer program
CN110928903A (en) Data extraction method and device, equipment and storage medium
CN111382182A (en) Data processing method and device, electronic equipment and storage medium
Nevarez Inside the SQL Server Query Optimizer
CN114661721A (en) Method and system for processing database table
CN112783758B (en) Test case library and feature library generation method, device and storage medium
Radeschütz et al. Business impact analysis—a framework for a comprehensive analysis and optimization of business processes
US11354313B2 (en) Transforming a user-defined table function to a derived table in a database management system
CN114490724B (en) Method and device for processing database query statement
CN113868141A (en) Data testing method and device, electronic equipment and storage medium
CN114547083A (en) Data processing method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20210910

Address after: Room 508, floor 5, building 4, No. 699, Wangshang Road, Changhe street, Binjiang District, Hangzhou City, Zhejiang Province

Applicant after: Alibaba (China) Co.,Ltd.

Address before: A four-storey 847 mailbox in Grand Cayman Capital Building, British Cayman Islands

Applicant before: ALIBABA GROUP HOLDING Ltd.

TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20211124

Address after: No.12, Zhuantang science and technology economic block, Xihu District, Hangzhou City, Zhejiang Province, 310012

Applicant after: Aliyun Computing Co.,Ltd.

Address before: 310052 room 508, 5th floor, building 4, No. 699 Wangshang Road, Changhe street, Binjiang District, Hangzhou City, Zhejiang Province

Applicant before: Alibaba (China) Co.,Ltd.

GR01 Patent grant
GR01 Patent grant