CN115794630A - Transaction-type database-oriented large-scale test case simplification method with test exception - Google Patents

Transaction-type database-oriented large-scale test case simplification method with test exception Download PDF

Info

Publication number
CN115794630A
CN115794630A CN202211499466.1A CN202211499466A CN115794630A CN 115794630 A CN115794630 A CN 115794630A CN 202211499466 A CN202211499466 A CN 202211499466A CN 115794630 A CN115794630 A CN 115794630A
Authority
CN
China
Prior art keywords
test case
transaction
test
transactions
case
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.)
Pending
Application number
CN202211499466.1A
Other languages
Chinese (zh)
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.)
East China Normal University
Original Assignee
East China Normal University
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 East China Normal University filed Critical East China Normal University
Priority to CN202211499466.1A priority Critical patent/CN115794630A/en
Publication of CN115794630A publication Critical patent/CN115794630A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a large-scale test case simplification method with test exception for a transaction type database, which comprises the following steps: the method comprises the following steps: extracting test case information, and for a given initial test case, coding operation information in the test case by combining a corresponding test base table structure and execution information, and organizing and expressing the operation information as a matrix by taking a transaction as a unit; step two: aggregating relevant transactions according to the data relevance of the transaction access and the session relevance of the transactions, and aggregating the transactions in the initial test case by using the inverted index in combination with the data access characteristics of each transaction and the session of the transaction; step three: and cutting the test case, and gradually reducing the transaction set in the test case through iterative cutting to obtain the simplified test case. The invention also discloses the application of the method in the test case simplification operation in the database test development process.

Description

Transaction-type database-oriented large-scale test case simplification method with test exception
Technical Field
The invention belongs to the field of database technology and test case simplification, and particularly relates to a large-scale test case simplification method for a transaction-type database with test exception.
Background
Database management systems are important basic software and are widely applied to the fields of finance, IT, communication and the like. With the vigorous development of the internet, new applications emerge endlessly, and the pressure of the services to be borne is also continuously increased. New demand and new application drive database industry to rapidly issueAnd (6) unfolding. In the early century, because the traditional relational database can not meet the requirements of large scale, long-term online and high availability of business data in the internet industry, a NewSQL database which is characterized by distributed and cloud services, such as Aurora, appears [1] 、Socrates [2] 、Spanner [3] And the like. These new databases play an increasingly important role in various industries. In the process, a plurality of domestic database developers adapt to the trend of the era, concentrate on developing core technology and maintaining open source ecology, and develop database products which are suitable for the current demand environment and have advanced technology, such as OceanBase [4] 、GaussDB [5] 、TiDB [6] And so on.
Under the new trend of the rapid development of the database and the new scene of applying a large amount of distributed databases, database manufacturers urgently need to verify the concurrency control mechanism of the database. At present, the verification method of the database concurrency control mechanism mainly generates a large amount of test data, and verifies the execution of the database through black box test, such as Cobra [7] 、Elle [8] And so on. Such tools generally generate test data based on certain constraint conditions, import the generated data into a database for testing, determine whether the execution result of the database meets expectations, and verify the execution correctness by analyzing a transaction dependency graph.
In testing databases, the black box test tool described above has successfully discovered and reported numerous anomalies, a significant portion of which were also confirmed by database developers. However, since such tools are often used for large-scale testing, the generated cases are large in size and difficult to submit to database developers. When the size of the case is too large, the execution of the case is interfered by a large number of factors, so that a database developer is difficult to reproduce the corresponding case and cannot further confirm whether the problem exists. The finder of the anomaly often needs to spend a lot of time and effort to reduce the cases. This undoubtedly slows the progress of the development and testing of the database.
The effective recurrence of the database exception can assist developers to repair errors and promote the rapid iterative development of the database. In the face of a large-scale test case, developers are often unable to quickly locate and repair anomalies for the following reasons. First, for an irreproducible anomaly, it is often difficult for a developer to repair. Because such anomalies tend to occur in a production environment rather than a test environment, the database state and application execution state recorded when the anomaly occurs are small enough to infer the cause of the anomaly. If the abnormity can be stably reproduced in the test environment, a database developer can purposefully acquire the runtime state and execution information to assist in deducing the abnormity. Secondly, under the condition of reproducing the abnormity, if the reproduction process and the case are huge and complex, a large amount of irrelevant operation information is introduced, so that a developer is interfered by the irrelevant information, and the content which is helpful for repairing the abnormity is difficult to find. If the recurring flow and the case can be simplified as much as possible, the method can help developers to eliminate interference of useless information and accelerate the speed of positioning the abnormity.
Based on the problem, it is important to simplify large-scale test cases to obtain small reproducible cases. However, the current test case simplification still has the following key problems:
1. the original test case contains a large number of transactions and the exception involves the interaction of multiple transactions, it is difficult to determine which of which are directly related to the exception.
2. Under the condition of multi-session concurrent execution, the sequence of operation execution cannot be determined, and further the transaction execution sequence when the abnormity occurs is difficult to simulate.
3. The large number of internal states are closely related to the operating system and hardware states and change rapidly, and external programs cannot accurately control and simulate the internal states of the database during execution.
Disclosure of Invention
In order to solve the defects of the prior art, the invention aims to provide a large-scale test case simplification method with test exception for a transaction database, an effective solution for simplifying the size of a test case is provided in a mode of cutting a transaction set in the test case through repeated iteration, the state in the original execution is simulated through controlling the execution sequence, and the simplification efficiency is improved in a mode of pruning an iteration process.
The relevant definitions in the present invention are as follows:
definition 1 test cases: the test case is a test input data for a specific database, specifically a set composed of transactions, and the execution case is a set of corresponding transactions to be run, and analyzes the correctness of the execution result, and it is expected that the correct result should meet the usual isolation level requirement of the database. Wherein the initial test case is referred to as an initial test case.
Define 2 valid test cases: the valid test cases are those that can trigger the same abnormality when executed, and the invalid test cases are those that cannot trigger the same abnormality.
Define 3 minimum effective cases: the least effective case is the case with the least number of transactions in the effective test cases.
The case simplifying method comprises the following steps:
the method comprises the following steps: extracting test case information, combining a corresponding database table structure and execution information for a given initial test case, recoding operation information in the test case, and organizing and representing the operation information as a matrix by taking a transaction as a unit.
In the invention, the test case comprises a plurality of sessions which are executed simultaneously, each session has a plurality of transactions which are executed sequentially, and each transaction consists of a plurality of operations. The operations in each session are not repeated, but there is an interleaving in the execution order. In the same session, the operations in the transactions are not repeated, and the execution sequence is not staggered. The initial test cases record execution information in units of operations and are arranged according to the actual sequence of execution. Based on the input content, organizing the operation into the affairs according to the operation subordinate affairs in the test case, wherein the obtained new affairs correspond to the affairs in the test case one by one, and the operation sequence of the new affairs is ensured to be the same as that of the test case; the order of transactions within a row in the matrix is the same as the order within each session in the test case. The number of rows of the matrix represents the number of sessions in the initial test case, and the number of columns of the matrix is the number of transactions that a session in the initial test case contains at most.
Step two: and aggregating related transactions according to the data relevance of the transaction access and the session relevance of the transactions, and aggregating the transactions in the initial test case by using the inverted index in combination with the data access characteristics of each transaction and the session of the transaction. The inverted index in the invention refers to an index structure constructed by using a data item as an index item and using a transaction accessing the data item as indexed content. All transactions determined by each index entry in the index (i.e., all transactions accessing the index entry) are aggregated, so that a transaction set can be obtained. The transaction set obtained by the aggregation of the inverted indexes at least meets one of the following two conditions: transactions in the same set all read or write the same data item; transactions in the same set are all executed by the same session. All transaction sets obtained by aggregation are collectively called as abnormal association transaction sets. And describing the correlation among the transactions in the test case through the abnormal associated transaction set so as to determine the transactions possibly related to the abnormal starting.
Step three: and cutting the test case, and gradually reducing the transaction set in the test case by iteratively cutting. Cutting a test case refers to pruning one of the abnormal associated transaction sets from the transaction sets of the test case to obtain a new test case. The execution order of the new test cases is the same as the execution order of the test cases that can trigger an exception for the operation of the different sessions.
According to the method, the invention reduces the affairs which are irrelevant to the triggering abnormity, thereby reducing the number of the affairs in the test case and solving the problems that the original test case in the prior art contains more affairs and the abnormity relates to the interaction of a plurality of affairs. The execution sequence of the operation is determined according to the execution sequence of the transaction in the effective test case, the execution sequence is controlled to be as the same as possible as the execution sequence when the abnormal operation occurs, and the problem that the execution sequence of the operation cannot be determined under the condition of concurrent execution of multiple sessions in the prior art is solved; and executing the new test case obtained by cutting so as to simulate the execution sequence when the abnormality occurs, further simulate the internal state of the database when the abnormality occurs, and solve the problem that an external program cannot accurately control and simulate the internal state of the database during execution. And iterating the steps to cut the test case, and optimizing the iteration process based on the cutting result and the abnormal reproduction capability. If the current test case can not trigger the exception or the test case is iterated, pruning the test case, namely stopping the iteration case.
The invention also provides application of the method in test case simplification operation in the process of database test development.
The beneficial effects of the invention include: the invention provides a large-scale test case simplification method with test exception for a transaction database, which provides an effective solution for simplifying the size of a test case by repeatedly iterating and cutting a transaction set in the test case, simulates the state during original execution by controlling an execution sequence, and improves the simplification efficiency by pruning an iteration process. The invention can simplify the scale of the test case, and has no similar simplification work in the known range; for known error cases, the number of transactions can be reduced by 70% on average using the present invention.
Drawings
FIG. 1 is a schematic diagram of input data in the embodiment.
Fig. 2 is a schematic diagram of extracting case information in the embodiment.
FIG. 3 is a diagram of an inverted index according to an embodiment.
FIG. 4 is a diagram illustrating an AND operation performed between mask matrices in an embodiment.
Fig. 5 is a flow chart of a case reduction method of the present invention.
Detailed Description
The invention is further described in detail with reference to the following specific examples and the accompanying drawings. The procedures, conditions, experimental methods and the like for carrying out the present invention are general knowledge and common general knowledge in the art except for the contents specifically mentioned below, and the present invention is not particularly limited.
The invention provides a large-scale test case simplification method with test exception for a transaction type database, which comprises the following steps: extracting case information with abnormality, coding the transaction information in the case by combining a test base table structure aiming at a given test case, and expressing the transaction information as a matrix; aggregating related transactions, aggregating test case transactions with relevance by combining the data access characteristics and the sessions of the transactions, and constructing an abnormal related transaction set according to an aggregation result; and the cutting case is used for iteratively cutting the test case based on the associated transaction set and optimizing based on the abnormal reproduction capability of the cutting result.
Specifically, the method comprises the following steps:
1. and extracting test case information, and organizing the test case information according to the given initial test case. Given a test case describing an exception in units of operations, it needs to be re-merged into a transaction for ease of compaction. When merging, operations belonging to the same transaction need to be merged according to an execution sequence, data itself is not changed before and after merging, and only the organization structure of the operations is changed. Because the operations are arranged in the execution sequence in the same session, the condition that the operations of different transactions appear in a staggered mode does not exist. Therefore, the method combines the operations in each session into the transactions in turn, so that the new transactions correspond to the transactions in the initial test case one by one and contain the same operations, and the sequence of the operations in the new transactions is the same as that in the initial test case. The resulting transactions can be represented as a matrix of n rows and m columns, where n is the number of sessions in the initial test case and m is the number of transactions that a session contains at most in the initial test case. The elements in the matrix represent a transaction, the row of the elements represents the session for executing the transaction, the column of the elements represents the order of the transactions in the session, and the precedence relationship of the transactions is the same as the order of the transactions in each session in the initial test case.
2. And related transactions are aggregated, and because similar transactions have similar influences on exception triggering and can be simultaneously reserved or pruned, the similar transactions in the pruning test case can accelerate the reduction of the size of the set in the test case. In order to obtain the affairs with relevance, the affairs are aggregated according to the information extracted from the test cases. The method mainly focuses on the relevance of the transaction on data access and the session.
When aggregation is performed according to data access, the method is based on the data set accessed by the transaction. For the extracted transaction, each operation therein contains a data set that the operation reads or modifies. And merging the data sets read and written by all operations in the transaction to obtain a data set accessed by the transaction. According to the set, the data items accessed by the transactions are used as index items, an inverted index is constructed, so that the transactions accessing the same data items can be indexed by the same index item, and the relationship between the data items and the transactions accessing the data items is obtained. Transactions that have accessed the same data item are aggregated into a set of transactions, which may exist in multiple different sets of transactions as a transaction may access multiple data items. Accordingly, a transaction set with relevance on data access is obtained. When the aggregation is carried out according to the session, the method is based on the session to which the transaction belongs. Transactions executed by the same session are collected into a transaction collection, and the transactions executed by the same session are regarded as transactions with relevance. From this, a set of all transactions having relevance on the session to which they belong is obtained. And merging the transaction sets with relevance on the data access and the session to which the data access belongs to obtain an abnormal association transaction set, wherein each element in the abnormal association transaction set is the transaction set obtained based on the method.
3. And cutting the test case, executing cutting operation based on the abnormal associated transaction set constructed by aggregation, and pruning corresponding transactions in the test case, thereby reducing the size of the transaction set in the test case and simplifying the test case.
After aggregating to obtain the set of anomalous correlation transactions, the clipping operation may remove one of the set of anomalous correlation transactions from the given test case. Based on the matrix representing the initial test case, the operation of clipping a test case can be represented as a matrix 01 with n rows and m columns, called a mask matrix, which corresponds element by element to the transaction set that needs to be clipped, each element describing whether a specific transaction needs to be clipped, and the position of the specific transaction in the mask matrix is the same as the position of the transaction in the matrix corresponding to the initial test case. Through the corresponding relation, the elements in the mask matrix represent whether the transaction at the corresponding position of the initial test case exists in the transaction set needing to be clipped. If yes, marking as 0, and removing the transaction from the transaction set of the test case by the cutting operation; otherwise, it is noted as 1, and the corresponding transaction will be retained by the clipping operation. A new test case can be obtained by cutting a test case, the new test case can be uniquely determined by an initial test case and a specific cutting operation, the transaction set cut by the cutting operation is the difference set of the transaction set of the initial test case and the transaction set of the new test case, and the new test case can be directly obtained by the initial test case through the cutting operation. Therefore, the new test case can be represented using the mask matrix corresponding to the clipping operation.
The clipping operation is iterated to obtain the least significant cases. The test case obtained by clipping only needs to execute the rest of the transactions, and adopts the form of a mask matrix to represent and participate in the subsequent iteration. In the iteration process, the queue is used for storing the test cases waiting for iteration so as to be convenient for obtaining the test cases needing iteration subsequently. The initial queue only contains the mask matrix corresponding to the initial test case. For each iteration, a test case is obtained from the queue and the set of exception-related transactions is traversed. For each transaction set in the abnormal association transaction set, generating a test case for pruning the corresponding transaction, executing the test case and confirming the validity of the test case; valid test cases are added to the queue. Therefore, the test cases in the queue are all effective test cases. The above steps are repeatedly performed until the queue is empty. Since the process will try all test cases in combination with all transaction sets, all valid test cases can be obtained by iteration. After the affairs in the test case are pruned through the mask matrix corresponding to the affair set, the mask matrix is used for representing a new test case obtained after pruning. Therefore, only the mask matrix needs to be stored in the iterative process, all the transaction information of each test case does not need to be stored in the iterative process, and the space overhead of storing the specific execution information of the transaction in the iterative process is reduced.
And optimizing an iterative process based on the cutting result and the abnormal reproduction capability, wherein the iterative process comprises two optimization strategies. First, when a new test case is obtained by cutting, the test case is matched with a tested valid test case. If the current case completely contains all the transactions of a certain case, namely, the current case is iterated to obtain the subset of the current test case, the case is directly considered to be effective, and the effectiveness of the case does not need to be verified repeatedly. Secondly, invalid test cases are not added into the queue in the iteration process, namely, the invalid test cases are not continuously iterated.
According to the definition of the test case simplification problem, the input of the method comprises a test table structure, test library initial data and an execution log of an initial test case. The implementation process of the method comprises three steps of extracting test case information, aggregating relevant affairs and cutting the test case. The output of the method comprises the reduced minimum effective case.
Examples
Inputting data: the initial test case required by the present invention contains several sessions, each session containing several operations O in execution order. The operation records the transaction, operation type, executed specific SQL statement and accessed data item which are subordinate to the operation. The type of operation may be a read operation or a write operation, denoted R (id), W (id), respectively, where id denotes the data item accessed by the operation, and one operation may access multiple data items, as shown in fig. 1. The error case shown in fig. 1 is derived from a real error case of the database X, and the error thereof is derived from the fourth and fifth operations of the third session, so that the second and third transactions of the third session constitute the least effective case.
Extracting test case information: according to the execution log of the given initial test case, firstly, the operation information in the test case is read and classified by taking a conversation as a unit. Then, the operations in each session are sorted based on the execution time, resulting in an operation sequence O arranged in the execution time order 1 ,O 2 …, as in 2(1), and the operations belonging to the same transaction are merged in that order. Thereby reorganizing the operation as a transaction T 1 ,T 2 … as in 2(2). The representation is then organized in transaction units as a matrix. Assuming a total of n sessions containing at most m transactions, n rows m are constructedA matrix M of columns. The element in i row and j column in the matrix M represents the jth transaction of the ith session, and if the number of transactions contained in the ith session is less than j, the element is set to be null, as shown in 2(3).
Aggregating the related transactions: first, aggregation is performed according to the affiliated session. Based on the matrix M constructed as described above, all transactions of each row are aggregated respectively, so as to obtain a set of all transactions executed by the same session. As in FIG. 2, { T 11 ,T 12 Is the set of transactions performed by the first session. Second, aggregation is performed according to the data access. An access data set, i.e. a set of read and write data items of all operations contained in the merged transaction, is constructed for each transaction. If the data item is denoted d 1 ,…d j …, by pair T of transactions 1 ,…,T i … constructs access data set, and can obtain the corresponding relation between transaction and data set<T i ,{d 1 ,d 2 ,…,d j }>. Based on the corresponding relationship, an inverted index is constructed to obtain the inverse corresponding relationship, the index item is data, and the indexed item is the transaction for accessing the data, namely<d j ,T 1 ,T 2 ,…,T i ,…>. And aggregating the transactions indexed by the same indexing item into a set by utilizing the inverted index aggregation transaction, thereby obtaining all transaction sets accessing the same data. For example, in the test case shown in FIG. 2, transaction T 11 Including a read operation O 1 And write operation O 2 ,O 1 Read data entry 1,2,3, O 2 The data item 3,4,5 is modified, then the access data set for the transaction is the union {1,2,3,4,5} of {1,2,3} {3,4,5 }. Accordingly, the corresponding relation between the affairs and the data set can be obtained<T 11 ,{1,2,3,4,5}>. Constructing an inverted index based on the correspondence, dividing T 11 In addition, data item 1 is only accessed by transaction T 21 、T 32 、T 33 Accessing, then the transaction corresponding to index entry 1 is { T } 11 ,T 21 ,T 32 ,T 33 I.e. T 11 ,T 21 ,T 32 ,T 33 Is a set of transactions accessing the same data item 1. As shown in FIG. 3, the transactions indexed by each data item form a set, i.e., each row in the graphThe transactions constitute a collection of transactions aggregated from the access data items. Merging the two transaction sets obtained based on the affiliated session and the aggregation of the access data items to obtain an abnormal association transaction set, namely 7 transaction sets and { { T) shown in FIG. 3 11 ,T 12 },{T 21 ,T 22 ,T 23 },{T 31 ,T 32 ,T 33 } of the two.
And after the abnormal association transaction set is obtained through aggregation, constructing a corresponding mask matrix to represent the clipping operation on the transaction set. If the matrix M constructed based on the initial test load is a matrix of n rows and M columns, the mask matrix M' is a matrix 01 having the same size as M. Wherein, the value of the mask matrix element indicates whether the element represented by the corresponding position of the matrix M should be pruned in the pruning operation, as shown in formula 1:
Figure BDA0003966580660000071
in other words, if the value of the element in M' is 0, it indicates that the clipping operation will clip the transaction represented by the element at the corresponding position in M from the transaction set. In the test case shown in FIG. 1, if data item 1 is only accessed by transaction T 11 ,T 21 ,T 32 ,T 33 Access, then the set of transactions constructed based on accessing the same data item 1 is { T } 11 ,T 21 ,T 32 ,T 33 And the mask matrix for clipping the transaction set is shown as a matrix B in FIG. 4, which represents the pruning T from the transaction set 11 ,T 21 ,T 32 ,T 33 Four transactions. Meanwhile, the mask matrix also represents a new test case obtained after the test case performs the cutting operation, so that the new test case is used for the next iteration process.
Cutting a test case: to obtain the smallest effective case, the program cuts the test case by iteration. The method comprises the steps of adopting a mask matrix to represent a transaction set corresponding to a test case, and achieving cutting of the test case based on AND calculation of the mask matrix. And the calculation is defined as follows: and for the two mask matrixes with the same size, performing AND operation on the two mask matrixes to obtain a new mask matrix, wherein the size of the new matrix is the same as that of the original matrix. For any element in the new matrix, if and only if the element of the corresponding position of the original two mask matrices is 1, the element is 1; otherwise the element is 0, as shown in fig. 4. The transaction set represented by the new mask matrix is the intersection of the transaction sets represented by the original two mask matrices. And a mask matrix A, B with n rows and m columns, wherein A represents a test case, and B represents a clipping operation corresponding to one transaction set in the abnormal association transaction set. The sum of the two results C = a ^ B satisfies equation 2:
Figure BDA0003966580660000072
the set of transactions denoted by C is the intersection of the set of transactions denoted by A, B. That is, the test case corresponding to the transaction set represented by C can be cut by the test case corresponding to a through the cutting operation corresponding to B. For the test case shown in fig. 1, if the matrix B shown in fig. 4 represents an abnormal associated transaction set for clipping the access data item 1, the transaction set represented by C is obtained by clipping all the transactions for accessing the data item 1 by the test case corresponding to a, that is, on the basis of the transaction set corresponding to a, clipping the transactions { T } 11 ,T 21 ,T 32 ,T 33 }. Subsequently, when the test case corresponding to C is executed, the program only needs to execute the transaction T 12 ,T 23 ,T 31 . Based on the above definitions of the and operation and the clipping operation, an iterative algorithm is designed as follows:
Figure BDA0003966580660000081
in the iteration process, a mask matrix corresponding to the test case waiting for iteration is stored by using a queue. The initial queue contains only the matrix (rows 2-3) for the test case. For each iteration, a test case is taken from the queue (line 5) and the set of all transactions from step two (lines 6-17) is traversed. For each transaction set, a new test case (7 rows) is obtained by cutting based on the AND operation of the mask matrix, and the validity is executed and confirmed. The execution of the test case requires controlling the execution sequence, that is, for all the operations to be executed, if there is a definite precedence relationship between any two operations in the effective test case in the execution time period, the precedence relationship of the execution should be satisfied when any case is executed. Under the condition of controlling the execution sequence, if the test case is valid, the test case is added into the queue, and the corresponding mask matrix is stored in the mask matrix set of the valid test case. The above steps are repeated and the least valid case (rows 13-14) of transaction set is maintained until the queue is empty. The valid case stored at this time is the minimum valid case.
And optimizing the iterative process in the program execution process, wherein the optimization strategy comprises two optimization strategies according to the cutting result and the abnormal reproduction capability. Firstly, for an optimization strategy according to a cutting result, when a new test case C is obtained through cutting, a mask matrix corresponding to C is matched with a mask matrix set of an effective test case. If the mask matrix C 'exists in the set, the transaction set corresponding to C' is a subset of the transaction set corresponding to C, as shown in formula 3:
Figure BDA0003966580660000091
the test case is directly considered valid without repeated validation of its validity (lines 8-10). Secondly, for the optimization strategy according to the abnormal reproduction capability, invalid test cases are not added into the queue (11-12 rows) in the iteration process, so that the iteration process is accelerated.
Through the step of cutting the error case, the initial error case cuts the transaction set { T ] once 11 ,T 12 ,T 21 },{T 11 ,T 31 },{T 12 ,T 22 ,T 23 Get the least effective case { T } 32 ,T 33 }. The number of the minimum effective cases is reduced by 75% compared with the number of the initial error cases, and effective error case simplification is realized.
Reference to the literature
[1]Verbitski A,Gupta A,Saha D et al.Amazon Aurora:Design Considerations for High Throughput Cloud-Native Relational Databases[C].Proceedings of the 2017ACM International Conference on Management of Data.Chicago Illinois USA:ACM,2017:1041-1052.
[2]Antonopoulos P,Budovski A,Diaconu C et al.Socrates:The New SQL Server in the Cloud[C].2019ACM SIGMOD Conference.2019.
[3]Corbett J C,Dean J,Epstein M et al.Spanner:Google’s Globally Distributed Database[J].ACM Transactions on Computer Systems,2013,31(3):1-22.
[4]Zhenkun Yang,Chuanhui Yang,Fusheng Han et al.2022.OceanBase:a 707million tpmC distributed relational database system.Proc.VLDB Endow.15,12(August 2022),3385–3397.
[5]Zhu J,Cheng K,Liu J et al.Full encryption:an end to end encryption mechanism in GaussDB[J].Proceedings of the VLDB Endowment,2021,14(12):2811-2814.
[6]Huang D,Liu Q,Cui Q et al.TiDB:a Raft-based HTAP database[J].Proceedings of the VLDB Endowment,2020,13(12):3072-3084.
[7]Tan C,Zhao C,Mu S et al.Cobra:Making Transactional Key-Value Stores Verifiably Serializable[J].14th USENIX Symposium on Operating Systems Design and Implementation(OSDI 20),2020,60-80.
[8]Kingsbury K,Alvaro P.Elle:Inferring Isolation Anomalies from Experimental Observations[J].arXiv:2003.10554[cs],2020.
The protection of the present invention is not limited to the above embodiments. Variations and advantages that may occur to those skilled in the art may be incorporated into the invention without departing from the spirit and scope of the inventive concept, and the scope of the appended claims is intended to be protected.

Claims (10)

1. A large-scale test case simplification method with test exception for a transactional database is characterized by comprising the following steps:
the method comprises the following steps: extracting test case information, and for a given initial test case, coding operation information in the test case by combining a corresponding test base table structure and execution information, and organizing and expressing the operation information as a matrix by taking a transaction as a unit;
step two: aggregating relevant transactions according to the data relevance of the transaction access and the session relevance of the transactions, and aggregating the transactions in the initial test case by using the inverted index in combination with the data access characteristics of each transaction and the session of the transaction;
step three: and cutting the test case, and gradually reducing the transaction set in the test case through iterative cutting to obtain the simplified test case.
2. The transaction-oriented database large-scale test case reduction method with test exception as claimed in claim 1, wherein in step one, the test case comprises a plurality of sessions executed simultaneously, each session has a plurality of transactions executed sequentially, and each transaction is composed of a plurality of operations; operations in each session are not repeated, but there is an interleaving in the execution order; in the same session, the operations in each transaction are not repeated, and the execution sequence is not staggered; the initial test cases record execution information in units of operations and are arranged according to the actual sequence of execution.
3. The transaction-oriented database large-scale test case simplification method with test exception function as claimed in claim 1, characterized in that in step one, the operation is organized into transactions according to the operation-dependent transactions in the test case, the obtained new transactions correspond to the transactions in the test case one to one, and the operation sequence of the new transactions is ensured to be the same as that of the test case; the order of the transactions within the rows in the matrix is the same as the order within each session in the test case; the number of rows of the matrix represents the number of sessions in the initial test case, and the number of columns of the matrix is the number of transactions that a session in the initial test case contains at most.
4. The transaction-oriented database large-scale test case reduction method with test exception as claimed in claim 1, wherein in step two, the inverted index is an index structure constructed by using data items as index items and using transactions accessing the data items as indexed contents; aggregating all the transactions determined by each index item in the index so as to obtain a transaction set;
the transaction set obtained by the aggregation of the inverted indexes at least meets one of the following two conditions: transactions in the same set all read or write the same data item; transactions in the same set are all executed by the same session.
5. The transaction-oriented database large-scale test case reduction method with test exceptions as claimed in claim 1, wherein in step two, all transaction sets obtained by aggregation are collectively referred to as exception-associated transaction sets, and the exception-associated transaction sets are used to describe the correlation between the transactions in the test case, thereby determining the transactions possibly related to the exception starting.
6. The transaction-oriented database large-scale test case reduction method with test exception as claimed in claim 1, wherein in step three, the test cases are cut according to the transaction set, new test cases are obtained by pruning the sets belonging to the exception-related transaction set in the test cases, and if the new test cases are executed and the exception is still triggered, the iteration is performed until any transaction in the pruned test cases cannot trigger the exception;
the execution sequence for the operations of different sessions is the same as the test case execution sequence that can trigger an exception.
7. The transaction-oriented database large-scale test case reduction method with test exceptions as claimed in claim 1, wherein in step three, the iterative process is optimized according to the test cases and the exception triggering capability, and if the current test case cannot trigger an exception or has been iterated, the test case is pruned, that is, the case of continued pruning iteration is stopped.
8. The transaction-oriented database large-scale test case reduction method with test exception function as claimed in claim 1, wherein in step three, the operation of cutting out the test case is represented by a mask matrix, the mask matrix is a 01 matrix with n rows and m columns, the mask matrix corresponds to the transaction set to be cut out element by element, each element describes whether a specific transaction needs to be cut out, and the position of the specific transaction in the mask matrix is the same as the position of the transaction in the initial test case corresponding matrix;
the elements in the mask matrix are represented as follows:
Figure FDA0003966580650000021
wherein, M' ij Representing a mask matrix, M ij A matrix constructed based on the initial test load that needs to be clipped is represented.
9. The transaction-oriented database large-scale test case reduction method with test exception as claimed in claim 1, wherein in step three, when a new test case is obtained by cutting, the test case is matched with a tested valid test case; if the current case completely contains all the affairs of a certain case, namely, the current case is iterated to obtain a subset of the current test case, the case is directly considered to be effective, and the effectiveness of the case does not need to be verified repeatedly; invalid test cases are not added into the queue in the iteration process, namely, the invalid test cases are not continuously iterated.
10. Use of a method according to any of claims 1-9 in test case reduction operations in database test development.
CN202211499466.1A 2022-11-28 2022-11-28 Transaction-type database-oriented large-scale test case simplification method with test exception Pending CN115794630A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211499466.1A CN115794630A (en) 2022-11-28 2022-11-28 Transaction-type database-oriented large-scale test case simplification method with test exception

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211499466.1A CN115794630A (en) 2022-11-28 2022-11-28 Transaction-type database-oriented large-scale test case simplification method with test exception

Publications (1)

Publication Number Publication Date
CN115794630A true CN115794630A (en) 2023-03-14

Family

ID=85442090

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211499466.1A Pending CN115794630A (en) 2022-11-28 2022-11-28 Transaction-type database-oriented large-scale test case simplification method with test exception

Country Status (1)

Country Link
CN (1) CN115794630A (en)

Similar Documents

Publication Publication Date Title
CN110309071B (en) Test code generation method and module, and test method and system
US9507697B2 (en) Completing functional testing
JP6533746B2 (en) Data record selection
CN102323945B (en) SQL (Structured Query Language)-based database management method and device
US8010949B2 (en) Database breakpoint apparatus and method
US20140115012A1 (en) Data model optimization using multi-level entity dependencies
Zhang et al. Bigfuzz: Efficient fuzz testing for data analytics using framework abstraction
CN107153609B (en) Automatic testing method and device
Jiang et al. Assuring the model evolution of protocol software specifications by regression testing process improvement
US8850407B2 (en) Test script generation
Hong et al. Evaluation of model checkers by verifying message passing programs
CN108763489B (en) Method for optimizing Spark SQL execution workflow
CN114356454B (en) Reconciliation data processing method, device, storage medium and program product
CN115794630A (en) Transaction-type database-oriented large-scale test case simplification method with test exception
Gao et al. Formal verification of consensus in the taurus distributed database
US11720482B1 (en) Retrying failed test cases in software testing using parallel threads
CN114461643A (en) Data writing method, device, storage medium and system
Ba et al. CERT: Finding Performance Issues in Database Systems Through the Lens of Cardinality Estimation
Suver A Database Tuning Framework For Improving Stored Procedure Performance
Mühleisen et al. Ensuring the Reliability and Robustness of Database Management Systems (Dagstuhl Seminar 23441)
CN113641572B (en) Debugging method for massive big data computing development based on SQL
EP4386562A1 (en) Automated testing of database commands
Interlandi et al. Supporting Data Provenance in Data-Intensive Scalable Computing Systems.
US20240232165A9 (en) Fine-grained decision on propagation of revalidation
CN117785652A (en) Variation-based concurrent software test case generation method, test method and system

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