CN112015657A - Automatic test data management method and system - Google Patents

Automatic test data management method and system Download PDF

Info

Publication number
CN112015657A
CN112015657A CN202010908592.2A CN202010908592A CN112015657A CN 112015657 A CN112015657 A CN 112015657A CN 202010908592 A CN202010908592 A CN 202010908592A CN 112015657 A CN112015657 A CN 112015657A
Authority
CN
China
Prior art keywords
data
test
test case
case data
attribute
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
CN202010908592.2A
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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202010908592.2A priority Critical patent/CN112015657A/en
Publication of CN112015657A publication Critical patent/CN112015657A/en
Pending legal-status Critical Current

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
    • 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/3688Test management for test execution, e.g. scheduling of test suites

Abstract

The invention provides an automatic test data management method and system, wherein the method comprises the following steps: packaging test data in a test environment into test case data according to the attribute of the test data, and caching the test case data into a cache data pool; acquiring a transaction request initiated by a test script, detecting an updating class operation instruction in the transaction request, and acquiring the attribute of test case data related to the transaction request according to the updating class operation instruction; calling corresponding test case data in a cache data pool according to the attributes, and providing the test case data to the test script for test processing after backing up the test case data according to the updating type operation instruction; and after the test processing is finished, restoring the corresponding data in the test environment through the backed-up test case data.

Description

Automatic test data management method and system
Technical Field
The invention relates to the field of software testing, can be applied to the financial field and other fields, and particularly relates to an automatic test data management method and system.
Background
With the development of technology, more and more software becomes an indispensable part of people's life, and the software is bound to be tested before being put on the market so as to ensure the stability of the software and the comfort of users; the software testing link contains various types of testing contents, so that the software testing process is relatively dull and the time occupation is relatively long, and a solution for releasing human resources, namely automatic testing, is provided for the software testing link in the industry;
in these solutions, the validity of the test data directly affects the effect of the automated test and the maintenance cost of the automated test; however, a pain point problem in the current automated testing process is that the used test data may need to be constructed in advance because no data meeting the conditions exists, or the used data may be polluted and not reusable because of the shared environment, thereby resulting in low success rate of automated testing. The data problem needs to be solved by automatic testing personnel, the testing cost is high, and the efficiency of automatic testing is seriously influenced.
Disclosure of Invention
The application aims to provide an automatic test data management method and system, so that the utilization rate and effectiveness of test data are improved, the problem that the test data is difficult to prepare in the automatic test process is solved, and the automatic test efficiency is improved.
To achieve the above object, the method for managing test data provided by the present invention specifically comprises: packaging test data in a test environment into test case data according to the attribute of the test data, and caching the test case data into a cache data pool; acquiring a transaction request initiated by a test script, detecting an updating class operation instruction in the transaction request, and acquiring the attribute of test case data related to the transaction request according to the updating class operation instruction; calling corresponding test case data in a cache data pool according to the attributes, and providing the test case data to the test script for test processing after backing up the test case data according to the updating type operation instruction; and after the test processing is finished, restoring the corresponding data in the test environment through the backed-up test case data.
In the above method for managing automated test data, preferably, invoking corresponding test case data in the cache data pool according to the attribute further includes: when the corresponding test case data are not detected in the cache data pool, constructing the corresponding test case data in the test environment according to the data abstract type through a preset construction rule; and caching the test case data into a cache data pool to provide a call.
In the above method for managing automated test data, preferably, the backing up the test case data according to the update class operation instruction includes: and modifying the state of the test case data in the cache data pool into a use state, and backing up the test case data and the attribute of the test case data.
In the above method for managing automated test data, preferably, constructing corresponding test case data in a test environment according to the data abstraction class by a preset construction rule includes: obtaining one or more data attributes from the data abstraction class; generating a corresponding numerical value through a preset data construction tool according to the data attribute; and generating test case data according to the corresponding relation between the data attribute and the numerical value.
In the above method for managing automated test data, preferably, after the test processing is completed, the restoring processing of the corresponding data in the test environment by the backed-up test case data includes: and restoring the data changed by the test processing in the test environment by the backup test case data by utilizing the AOP section-oriented programming technology.
The invention also provides an automatic test data management system, which comprises a data service device, a test script and a test environment; the data service device packages test data in a test environment into test case data according to the attribute of the test data, and caches the test case data to a cache data pool; acquiring a transaction request initiated by the test script, detecting an updating class operation instruction in the transaction request, and acquiring the attribute of test case data related to the transaction request according to the updating class operation instruction; calling corresponding test case data in a cache data pool according to the attributes, and providing the test case data to the test script for test processing after backing up the test case data according to the updating type operation instruction; and after the test processing is finished, restoring the corresponding data in the test environment through the backed-up test case data.
In the above automatic test data management system, preferably, the system further includes a data packaging device, where the data packaging device is configured to obtain corresponding test case data in the test environment according to the data abstraction class when the corresponding test case data is not detected in the cache data pool; and caching the test case data into a cache data pool to provide a call.
In the above automatic test data management system, preferably, the data encapsulation device includes a data abstraction module and a data instance module; the data abstraction module is used for obtaining one or more data attributes according to the data abstraction category; the data instance module is used for obtaining a corresponding numerical value in a test environment according to the data attribute; and constructing corresponding test case data according to the corresponding relation between the data attribute and the numerical value in the test environment.
In the above automatic test data management system, preferably, the data service device includes a data using module and a data self-enhancing module; the data use module is used for acquiring a transaction request initiated by the test script; providing the test case data to the test script for test processing, and modifying the state of the test case data into a use state; the data self-enhancement module is used for detecting an updating class operation instruction in the transaction request and obtaining the attribute of the test case data related to the transaction request according to the updating class operation instruction; calling corresponding test case data in a cache data pool according to the attributes, and backing up the test case data according to the updating class operation instruction; and after the test processing is finished, restoring the corresponding data in the test environment through the backed-up test case data.
In the above automatic test data management system, preferably, the data self-enhancement module includes a receiving and analyzing unit, a pre-enhancement unit and a post-enhancement unit; the receiving and analyzing unit is used for detecting an updating class operation instruction in the transaction request; the preposed enhancement unit is used for obtaining the attribute of the test case data related to the transaction request according to the updating class operation instruction; calling corresponding test case data in a cache data pool according to the attributes, and backing up the test case data according to the updating class operation instruction; and the post-positioned enhancement unit is used for recovering the corresponding data in the test environment through the backup test case data after the test processing is finished.
In the above automatic test data management system, preferably, the system further includes a data maintenance device, where the data maintenance device is configured to obtain a latest data value of the test case data in the cache data pool in the test environment through a predetermined query instruction according to a preset period, and update the corresponding test case data in the cache data pool according to the latest data value.
The invention also provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method when executing the computer program.
The present invention also provides a computer-readable storage medium storing a computer program for executing the above method.
The invention has the beneficial technical effects that: the usability and effectiveness of the test data are improved. Data are abstracted and instantiated between the script and the data of the called test environment, the data are cached in a data pool for use, and meanwhile, a background automatically performs maintenance such as data creation, verification, updating and the like in the real test environment, so that the availability and the effectiveness of the data are ensured; the test script and the data are completely decoupled and separated, for the automatic test script, the data use is a service calling process, the required data can be obtained only by providing the attribute of the data, a data write-dead mode is not used, and the script operation failure caused by the pollution of the previously used data is avoided, so that the readability of the automatic test script is improved, and the maintenance cost of the automatic test script is reduced; the problems that test data of an automatic test is difficult to prepare and the data are polluted to cause unavailable pain points are solved by using a mode of front backup and back recovery, and the automatic test efficiency is improved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the principles of the invention. In the drawings:
FIG. 1 is a flowchart illustrating an automated test data management method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a test case data generation flow according to an embodiment of the present invention;
FIG. 3 is a block diagram of an automated test data management system according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of an application structure of an automated test data management system according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a data self-enhancement module according to an embodiment of the present invention;
FIG. 6 is a flowchart illustrating an application of the automated test data management system according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The following detailed description of the embodiments of the present invention will be provided with reference to the drawings and examples, so that how to apply the technical means to solve the technical problems and achieve the technical effects can be fully understood and implemented. It should be noted that, unless otherwise specified, the embodiments and features of the embodiments of the present invention may be combined with each other, and the technical solutions formed are within the scope of the present invention.
Additionally, the steps illustrated in the flow charts of the figures may be performed in a computer system such as a set of computer-executable instructions and, although a logical order is illustrated in the flow charts, in some cases, the steps illustrated or described may be performed in an order different than here.
Referring to fig. 1, an automated test data management method provided by the present invention specifically includes:
s101, packaging test data in a test environment into test case data according to the attribute of the test data, and caching the test case data into a cache data pool;
s102, acquiring a transaction request initiated by a test script, detecting an updating operation instruction in the transaction request, and acquiring the attribute of test case data related to the transaction request according to the updating operation instruction;
s103, calling corresponding test case data in a cache data pool according to the attributes, and providing the test case data to the test script for test processing after backing up the test case data according to the update type operation instruction;
and S104, after the test processing is finished, restoring the corresponding data in the test environment through the backed-up test case data.
Therefore, by encapsulating the model type of the test data and providing service calling based on the attribute and the function of the test data, the automatic test script does not write fixed data, but changes the attribute of the test data required by the automatic test script into the attribute of the specified test data to dynamically acquire the test data, the effectiveness of the test data is improved, and the readability of the automatic test script is also enhanced. The method also automatically completes preparation or backup before the actual automatic test data is operated, and performs recovery after the data operation, thereby solving the problem of test data pollution, improving the reusability of the test data and further improving the automatic test efficiency.
In the above embodiment, invoking corresponding test case data in the cache data pool according to the attribute further includes: when the corresponding test case data are not detected in the cache data pool, constructing the corresponding test case data in the test environment according to the data abstract type through a preset construction rule; and caching the test case data into a cache data pool to provide a call. Furthermore, the state of the test case data in the cache data pool can be modified into a use state, and the test case data and the attribute of the test case data are backed up. Specifically, in actual work, if the test case data meeting the attribute requirements are not stored in the cache data pool, the data construction can be completed in the test environment according to the preset data generation rule, and the constructed test data is stored in the data pool; and then, returning the acquired data meeting the attribute value condition to the automated testing script in response, and enabling the automated testing to start to perform service operation on the data. And finally, taking out the backup information of the operated data, restoring the backup information in the test environment, restoring the attribute value of the data to the value before the target function code executes the updating operation, resetting the state of the data in the data pool to be normal after the data is finished, and synchronously finishing the cleaning of the waste backup information.
Referring to fig. 2, in an embodiment of the present invention, constructing corresponding test case data in a test environment according to the data abstraction class by a preset construction rule includes:
s201, acquiring one or more data attributes according to the data abstract categories;
s202, generating a corresponding numerical value through a preset data construction tool according to the data attribute;
s203, generating test case data according to the corresponding relation between the data attribute and the numerical value.
Specifically, different data model categories can be established through data modeling in actual work. For example, the Account data model class may be abstractly established, which has attribute number (Account number) and getter function thereof. Subclasses that inherit the Account Account model class can then be defined, such as the bankcard data model class Card, the bankbook data model class Depositbook, and so on. Taking the data model class of the Card of the bank Card as an example, the Card of the bank Card may have more attributes and functions, as shown below:
Figure BDA0002662421360000061
and then, acquiring real data in an actual environment according to the defined data model category, caching the data object and the attribute value thereof into a cache data pool, and recording the data object and the attribute value thereof as instantiated data object, namely test case data, so that all instantiated objects can be managed and maintained in the data pool, and the operations of data generation, search, modification and the like are supported.
In an embodiment of the present invention, after the test processing is completed, the restoring, by the backed-up test case data, the corresponding data in the test environment includes: and restoring the data changed by the test processing in the test environment by the backup test case data by utilizing the AOP section-oriented programming technology. In actual work, all requests from a data Access layer (dao) (data Access object) can be intercepted by configuring an interceptor of the AOP, whether an instruction for updating operations such as modification and deletion of test data exists is analyzed and judged, and if so, backup and recovery are automatically performed. Assuming that all DAO classes inherit from the ibase DAO parent class, then using Spring AOP can refer to the configuration entry point as follows:
<aop:pointcut expression=”*com.icbc.gz3.IBaseDAO+.*(..)”id=”dataPointCut”>
configuring pre-notification and post-notification:
<aop:before method=”beforeUpdate”pointcut-ref=”dataPointCut”>
<aop:after-returning method=”afterUpdate”pointcut-ref=”dataPointCut”>
the specific service functions of backup and recovery are implemented in the functions of beforeUpdate () and afterUPdate ().
Referring to fig. 3, the present invention further provides an automated test data management system, which includes a data service device, a test script, and a test environment; the data service device packages test data in a test environment into test case data according to the attribute of the test data, and caches the test case data to a cache data pool; acquiring a transaction request initiated by the test script, detecting an updating class operation instruction in the transaction request, and acquiring the attribute of test case data related to the transaction request according to the updating class operation instruction; calling corresponding test case data in a cache data pool according to the attributes, and providing the test case data to the test script for test processing after backing up the test case data according to the updating type operation instruction; and after the test processing is finished, restoring the corresponding data in the test environment through the backed-up test case data.
Thus, the automated test data management system provides services and maintenance of the package provisioning data between the script and the data of the test environment it invokes. When the automated script initiates the test, it uses an attribute-based calling modality, such as the following for obtaining a normal debit card with a balance greater than 100 meta to the data management system:
{Card(bank:icbc,type:debit,status:nomal,balance:100+).getNumber}
the automatic test data management system is responsible for returning data which is recorded in a cache and accords with the attributes to the script for running, the general flow is that the data is directly returned after the actual test environment is checked if the cache data pool has instantiated data which accords with the attribute requirements, otherwise, the data is maintained in the actual test environment, instantiated, cached and then returned.
The automatic test data management system not only passively receives data use requests and feeds back, but also actively initiates the following three operations in the overall function:
the data model is responsible for abstracting and instantiating management of data, and abstracting refers to abstracting various data into different data model categories, such as a data model class which can be summarized into a bankcard Card, and the data model has a plurality of attributes and functions:
Figure BDA0002662421360000071
Figure BDA0002662421360000081
in the process of establishing the abstraction of the data model category, a data construction, a verification script and a data backup and recovery script (generally, an SQL script) corresponding to the data category are established. Instantiation refers to retrieving a data model class, such as actual data of the data model class, in an actual test environment to obtain specific values of various attributes of the card, and then caching the data and the attributes of the card in a data pool in an object form.
And secondly, the data is responsible for creating and maintaining the data. The method has the functions of a data generator, and after abstract data are defined, various data with different attribute values are created in an actual test environment through a data construction tool; the data access method has the functions of data verification and maintenance, and for the cached instantiated data, a data verification tool is called regularly to verify the availability of the data, and the data and the attributes thereof in the data pool are refreshed.
And thirdly, preparing and recovering the data used by the script. By combining the technology of utilizing AOP to program the section, on the premise of not modifying the existing test script, the automatic injection mode is used for intercepting the calling operation of the automatic test script of the stock on the test data, and the code enhancement is carried out, specifically: using pre-emphasis to complete preparation or backup before operating on actual automated test data; using post-enhancement, performing recovery and state update after operating on actual automated test data; for a specific implementation of various functions of the automated test data management system, refer to the following embodiments.
Referring to fig. 4, in an embodiment of the present invention, the system further includes a data packaging device 2, where the data packaging device is configured to obtain corresponding test case data in the test environment according to the data abstraction class when the corresponding test case data is not detected in the cache data pool; and caching the test case data into a cache data pool to provide a call. Wherein, the data encapsulation device comprises a data abstraction module 21 and a data instance module 22; the data abstraction module is used for obtaining one or more data attributes according to the data abstraction category; the data instance module is used for obtaining a corresponding numerical value in a test environment according to the data attribute; and constructing corresponding test case data according to the corresponding relation between the data attribute and the numerical value in the test environment.
In actual work, the data encapsulation device 2 is responsible for encapsulating data into various model types, encapsulating and inheriting the data, giving attributes and functions to data objects, establishing an instantiated data object pool in the background, caching actual data objects and attributes thereof, managing and maintaining all instantiated objects, and supporting operations such as data generation, searching, modification and the like.
The data abstraction module 21 establishes different data model classes through data modeling. For example, the Account data model class may be abstractly established, which has attribute number (Account number) and getter function thereof.
Subclasses that inherit the Account Account model class can then be defined, such as the bankcard data model class Card, the bankbook data model class Depositbook, and so on. Taking the data model class of the Card of the bank Card as an example, the Card of the bank Card can have more attributes and functions:
Figure BDA0002662421360000091
the data instance module 22 obtains real data in an actual environment according to the data model category defined by the data abstraction module 21, caches the data object and its attribute value in a cache data pool of a background, and records the data object as an instantiated data object, so that all instantiated objects can be managed and maintained in the cache data pool, and operations such as generation, search, modification and the like of data are supported.
Referring to fig. 4 again, in an embodiment of the present invention, the data service apparatus 1 includes a data using module 11 and a data self-enhancing module 12; the data using module 11 is used for acquiring a transaction request initiated by a test script; providing the test case data to the test script for test processing, and modifying the state of the test case data into a use state; the data self-enhancement module 12 is configured to detect an update class operation instruction in the transaction request and obtain an attribute of test case data related to the transaction request according to the update class operation instruction; calling corresponding test case data in a cache data pool according to the attributes, and backing up the test case data according to the updating class operation instruction; and after the test processing is finished, restoring the corresponding data in the test environment through the backed-up test case data. Wherein, the data self-enhancement module 12 may include a receiving analysis unit 121, a pre-enhancement unit 122 and a post-enhancement unit 123; the receiving and analyzing unit is used for detecting an updating class operation instruction in the transaction request; the preposed enhancement unit is used for obtaining the attribute of the test case data related to the transaction request according to the updating class operation instruction; calling corresponding test case data in a cache data pool according to the attributes, and backing up the test case data according to the updating class operation instruction; and the post-positioned enhancement unit is used for recovering the corresponding data in the test environment through the backup test case data after the test processing is finished.
In actual operation, the data service device 1 is responsible for providing services for the automated test scripts, and comprises: responding to a request call of the data based on the attribute initiated by the automated test, and returning instantiated data meeting the attribute requirement; meanwhile, the data used by the automatic test is prepared and recovered by utilizing the AOP section-oriented programming technology and an automatic injection mode. The data service device 1 comprises a data using module 11 and a data self-enhancing module 12.
The data usage module 11 is responsible for responding to a request call of the attribute-based data initiated by the automated test, and returning instantiated data meeting the attribute requirements. When the automated script initiates a test, it uses an attribute-based calling modality, such as the following for obtaining a properly functioning bank debit card with a balance greater than 100 meta to the data management system:
{Card(bank:icbc,type:debit,status:nomal,balance:100+).getNumber}
the data using module 11 is responsible for returning the data meeting the above-mentioned attribute recorded in its cache to the script operation, and its flow is: firstly, searching whether instantiated data meeting attribute requirements exist in a cached data pool, if so, calling a data verification module 32 to check in an actual test environment, if the instantiated data meets the attribute requirements, directly returning if the verification is passed, and returning after data maintenance if the verification is failed; if the data pool does not have instantiated data meeting the attribute requirements, the data construction module 31 is called to generate response data in the actual test environment, then the instantiated data is cached in the data pool, and finally the data is returned. Further, when the automatic test script queries and acquires available data from the data usage module 11 according to the attribute, the exclusive flag and the occupied duration thereof may be set, and then the data usage module 11 sets the state of the data as occupied. In the occupied time, the data using module 11 locks the data, and other automated test scripts cannot query and use the data through the data using module 11, so that the test results are prevented from being influenced by each other due to the shared data.
The data self-enhancement module 12 utilizes the AOP section-oriented programming technology to perform code enhancement in an automatic injection mode on the premise of not modifying the existing test script, namely, pre-enhancement is used to complete preparation or backup before the actual automatic test data operation; with post-enhancement, recovery and state updates are made after the actual automated test data is operated.
The AOP technology can adopt a dynamic proxy technology, decorate the message by intercepting the message, and strengthen the execution of the original code behavior. Taking the AOP of Spring framework as an example, the services (notification/enhancement processing) can be divided into 5 types: pre-notification, post-notification, exception notification, final notification, surround notification. The method mainly adopts the prepositive notice (enhancing before the target function code is executed) to prepare or back up the data, and adopts the postpositive notice (enhancing after the target function code is executed) to restore or update the data.
The data self-enhancement module 12, as shown in fig. 5, is a structure diagram of the data self-enhancement module, and includes: a receiving and analyzing unit 121, a pre-emphasis unit 122, and a post-emphasis unit 123.
The receiving analysis unit 121 intercepts all requests from the data Access layer dao (data Access object) by configuring an interceptor of the AOP, analyzes and determines whether there is an instruction for an update operation such as modification and deletion of test data, and automatically performs pre-emphasis and post-emphasis if there is an instruction. Assuming that all DAO classes inherit from the ibase DAO parent class, then using Spring AOP can refer to the configuration entry point as follows:
<aop:pointcut expression=”*com.icbc.gz3.IBaseDAO+.*(..)”id=”dataPointCut”>
configuring pre-notification and post-notification:
<aop:before method=”beforeUpdate”pointcut-ref=”dataPointCut”>
<aop:after-returning method=”afterUpdate”pointcut-ref=”dataPointCut”>
the specific pre-enhancement and post-enhancement service functions are implemented in the functions of beforeUpdate () and afterUPdate ().
Before the target function code is executed, the pre-enhancement unit 122 performs pre-enhancement on the data to be subjected to the update operation, specifically, first determines whether the data of the present secondary operation is available, that is, retrieves the data from the instantiated data pool, and if no available data is found, generates available data in the real test environment through the data construction module 31 and caches the data in the data pool; then the state of the available data to be used by the target function code is set to be in use, and the complete information of the data and the attribute value thereof is backed up.
After the target function code is executed, that is, after the actual code has performed the update operation on the data, the post-enhancement unit 123 implements post-enhancement, specifically: and taking out the backup information of the operated data, restoring the data in the test environment, restoring the attribute value of the data to the value before the target function code executes the updating operation, resetting the state of the data in the data pool to be normal after finishing the data, and synchronously finishing the cleaning of the abandoned backup information.
Referring to fig. 4 again, in an embodiment of the present invention, the system may further include a data maintenance device 3, where the data maintenance device 3 is configured to obtain a latest value of the test case data in the cache data pool in the test environment through a predetermined query instruction according to a preset period, and update the corresponding test case data in the cache data pool according to the latest value of the data. In actual work, the data maintenance device 3 is responsible for docking data of an actual test environment, completing data construction in the test environment by using a data generation rule, and storing constructed test data into a data pool; and calling a data checking tool at regular time to check the availability of the data and refresh the attribute and the state of the data in the data pool. The data maintenance device 3 includes a data construction module 31 and a data verification module 32.
The data constructing module 31 defines a matched data generating rule (such as a matched number making script) according to the data type defined by the data abstraction module, generates data of a corresponding type in an actual testing environment, or retrieves data conforming to the type in the actual testing environment, and caches the test data meeting the condition in a data pool to complete the data instantiation operation.
The data checking module 32 runs a pre-configured check SQL on the data cached in the data pool in the actual environment database to obtain the latest value of the data, and synchronously updates the attribute values (such as the state and balance of the card) of the instantiated data corresponding to the data pool. The data verification module 32 supports real-time scheduling, updating as needed, and meanwhile, periodically refreshing verification in the background, maintaining validity of test data, and ensuring idempotent when a plurality of users request a test data at the same time.
In order to make the practical application process of the automatic test data management system provided by the present invention more clearly understood, the following description will refer to fig. 3 to fig. 6 to describe the test process of the automatic test data management system in detail, and it should be understood by those skilled in the art that this example is only for the purpose of understanding the application mode of the automatic test data management system provided by the present invention, and is not limited in any way.
Step S601, after the automated test script initiates a transaction, the data using module 11 responds to the transaction data operation request according to the data meeting the condition used by the attribute request, and calls the data instance module 22 to obtain instantiated data and finally returns the instantiated data to the automated test script.
Step S602, after the data instance module 22 is called, first obtain a data abstraction type corresponding to the data requested this time, then search whether instantiated data meeting the attribute value requirement exists in the cached data pool, if yes, go to step S607, and directly call the data using module 11 to respond; if not, S605 is started, and the data maintenance device 3 performs data construction and verification.
Step S603, after the automated test script initiates a transaction, the data self-enhancement module 12 is synchronously started, intercepts all requests from the data Access layer dao (data Access object), analyzes and judges whether there is an instruction for update operations such as modification and deletion of test data, and if so, automatically performs pre-enhancement and post-enhancement, that is, step S604 and step S607 are sequentially performed; if not, no interception processing is needed.
Step S604, before the target function code is executed, performing a pre-function enhancement on the data to be subjected to the update operation, specifically, first determining whether the data of the present secondary operation is available, that is, retrieving the data in the instantiated data pool, if no available data is found, generating available data in a real test environment by calling the data construction module 31, and caching the data in the data pool; then the state of the available data to be used by the target function code is set to be in use, and the complete information of the data and the attribute value thereof is backed up.
In step S605, the data maintenance device 3 is responsible for maintaining and verifying the data to be used this time. If the cached data pool does not have instantiation data meeting the attribute value requirement, the data construction module 31 completes data construction in the test environment according to the data generation rule, and stores the constructed test data into the data pool.
Step S606 returns the response of the acquired data meeting the attribute value condition to the automated test script, so that the automated test starts to perform service operation on the data.
Step S607, after the target function code is executed, that is, after the actual code has performed the update operation on the data, implementing the post-function enhancement, specifically: and taking out the backup information of the operated data, restoring the data in the test environment, restoring the attribute value of the data to the value before the target function code executes the updating operation, resetting the state of the data in the data pool to be normal after finishing the data, and synchronously finishing the cleaning of the abandoned backup information.
The invention has the beneficial technical effects that: the usability and effectiveness of the test data are improved. Data are abstracted and instantiated between the script and the data of the called test environment, the data are cached in a data pool for use, and meanwhile, a background automatically performs maintenance such as data creation, verification, updating and the like in the real test environment, so that the availability and the effectiveness of the data are ensured; the test script and the data are completely decoupled and separated, for the automatic test script, the data use is a service calling process, the required data can be obtained only by providing the attribute of the data, a data write-dead mode is not used, and the script operation failure caused by the pollution of the previously used data is avoided, so that the readability of the automatic test script is improved, and the maintenance cost of the automatic test script is reduced; the problems that test data of an automatic test is difficult to prepare and the data are polluted to cause unavailable pain points are solved by using a mode of front backup and back recovery, and the automatic test efficiency is improved.
The invention also provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method when executing the computer program.
The present invention also provides a computer-readable storage medium storing a computer program for executing the above method.
As shown in fig. 7, the electronic device 600 may further include: communication module 110, input unit 120, audio processing unit 130, display 160, power supply 170. It is noted that the electronic device 600 does not necessarily include all of the components shown in fig. 7; furthermore, the electronic device 600 may also comprise components not shown in fig. 7, which may be referred to in the prior art.
As shown in fig. 7, the central processor 100, sometimes referred to as a controller or operational control, may include a microprocessor or other processor device and/or logic device, the central processor 100 receiving input and controlling the operation of the various components of the electronic device 600.
The memory 140 may be, for example, one or more of a buffer, a flash memory, a hard drive, a removable media, a volatile memory, a non-volatile memory, or other suitable device. The information relating to the failure may be stored, and a program for executing the information may be stored. And the central processing unit 100 may execute the program stored in the memory 140 to realize information storage or processing, etc.
The input unit 120 provides input to the cpu 100. The input unit 120 is, for example, a key or a touch input device. The power supply 170 is used to provide power to the electronic device 600. The display 160 is used to display an object to be displayed, such as an image or a character. The display may be, for example, an LCD display, but is not limited thereto.
The memory 140 may be a solid state memory such as Read Only Memory (ROM), Random Access Memory (RAM), a SIM card, or the like. There may also be a memory that holds information even when power is off, can be selectively erased, and is provided with more data, an example of which is sometimes called an EPROM or the like. The memory 140 may also be some other type of device. Memory 140 includes buffer memory 141 (sometimes referred to as a buffer). The memory 140 may include an application/function storage section 142, and the application/function storage section 142 is used to store application programs and function programs or a flow for executing the operation of the electronic device 600 by the central processing unit 100.
The memory 140 may also include a data store 143, the data store 143 for storing data, such as contacts, digital data, pictures, sounds, and/or any other data used by the electronic device. The driver storage portion 144 of the memory 140 may include various drivers of the electronic device for communication functions and/or for performing other functions of the electronic device (e.g., messaging application, address book application, etc.).
The communication module 110 is a transmitter/receiver 110 that transmits and receives signals via an antenna 111. The communication module (transmitter/receiver) 110 is coupled to the central processor 100 to provide an input signal and receive an output signal, which may be the same as in the case of a conventional mobile communication terminal.
Based on different communication technologies, a plurality of communication modules 110, such as a cellular network module, a bluetooth module, and/or a wireless local area network module, may be provided in the same electronic device. The communication module (transmitter/receiver) 110 is also coupled to a speaker 131 and a microphone 132 via an audio processor 130 to provide audio output via the speaker 131 and receive audio input from the microphone 132 to implement general telecommunications functions. Audio processor 130 may include any suitable buffers, decoders, amplifiers and so forth. In addition, an audio processor 130 is also coupled to the central processor 100, so that recording on the local can be enabled through a microphone 132, and so that sound stored on the local can be played through a speaker 131.
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.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are only exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (13)

1. An automated test data management method, the method comprising:
packaging test data in a test environment into test case data according to the attribute of the test data, and caching the test case data into a cache data pool;
acquiring a transaction request initiated by a test script, detecting an updating class operation instruction in the transaction request, and acquiring the attribute of test case data related to the transaction request according to the updating class operation instruction;
calling corresponding test case data in a cache data pool according to the attributes, and providing the test case data to the test script for test processing after backing up the test case data according to the updating type operation instruction;
and after the test processing is finished, restoring the corresponding data in the test environment through the backed-up test case data.
2. The automated test data management method of claim 1, wherein invoking corresponding test case data in a cache data pool according to the attributes further comprises:
when the corresponding test case data are not detected in the cache data pool, constructing the corresponding test case data in the test environment according to the data abstract type through a preset construction rule;
and caching the test case data into a cache data pool to provide a call.
3. The automated test data management method of claim 2, wherein backing up the test case data according to the update class operational instructions comprises:
and modifying the state of the test case data in the cache data pool into a use state, and backing up the test case data and the attribute of the test case data.
4. The automated test data management method of claim 2, wherein constructing corresponding test case data in the test environment according to the data abstraction class by a preset construction rule comprises:
obtaining one or more data attributes from the data abstraction class;
generating a corresponding numerical value through a preset data construction tool according to the data attribute;
and generating test case data according to the corresponding relation between the data attribute and the numerical value.
5. The automated test data management method of claim 1, wherein, after the test processing is completed, performing recovery processing on corresponding data in the test environment through the backed-up test case data comprises:
and restoring the data changed by the test processing in the test environment by the backup test case data by utilizing the AOP section-oriented programming technology.
6. An automatic test data management system is characterized by comprising a data service device, a test script and a test environment;
the data service device packages test data in a test environment into test case data according to the attribute of the test data, and caches the test case data to a cache data pool; acquiring a transaction request initiated by the test script, detecting an updating class operation instruction in the transaction request, and acquiring the attribute of test case data related to the transaction request according to the updating class operation instruction; calling corresponding test case data in a cache data pool according to the attributes, and providing the test case data to the test script for test processing after backing up the test case data according to the updating type operation instruction; and after the test processing is finished, restoring the corresponding data in the test environment through the backed-up test case data.
7. The automated test data management system of claim 6, further comprising a data encapsulation means for obtaining corresponding test case data in the test environment according to the data abstraction class when corresponding test case data is not detected in the cache data pool; and caching the test case data into a cache data pool to provide a call.
8. The automated test data management system of claim 7, wherein the data encapsulation means comprises a data abstraction module and a data instance module;
the data abstraction module is used for obtaining one or more data attributes according to the data abstraction category;
the data instance module is used for obtaining a corresponding numerical value in a test environment according to the data attribute; and constructing corresponding test case data according to the corresponding relation between the data attribute and the numerical value in the test environment.
9. The automated test data management system of claim 6, wherein the data services device comprises a data usage module and a data self-enhancement module;
the data use module is used for acquiring a transaction request initiated by the test script; providing the test case data to the test script for test processing, and modifying the state of the test case data into a use state;
the data self-enhancement module is used for detecting an updating class operation instruction in the transaction request and obtaining the attribute of the test case data related to the transaction request according to the updating class operation instruction; calling corresponding test case data in a cache data pool according to the attributes, and backing up the test case data according to the updating class operation instruction; and after the test processing is finished, restoring the corresponding data in the test environment through the backed-up test case data.
10. The automated test data management system of claim 6, wherein the data self-enhancement module comprises a receive analysis unit, a pre-enhancement unit, and a post-enhancement unit;
the receiving and analyzing unit is used for detecting an updating class operation instruction in the transaction request;
the preposed enhancement unit is used for obtaining the attribute of the test case data related to the transaction request according to the updating class operation instruction; calling corresponding test case data in a cache data pool according to the attributes, and backing up the test case data according to the updating class operation instruction;
and the post-positioned enhancement unit is used for recovering the corresponding data in the test environment through the backup test case data after the test processing is finished.
11. The automated test data management system according to claim 8, further comprising a data maintenance device, wherein the data maintenance device is configured to obtain a latest data value of the test case data in the cache data pool in the test environment through a predetermined query instruction according to a preset period, and update the corresponding test case data in the cache data pool according to the latest data value.
12. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any of claims 1 to 5 when executing the computer program.
13. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program for executing the method of any one of claims 1 to 5.
CN202010908592.2A 2020-09-02 2020-09-02 Automatic test data management method and system Pending CN112015657A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010908592.2A CN112015657A (en) 2020-09-02 2020-09-02 Automatic test data management method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010908592.2A CN112015657A (en) 2020-09-02 2020-09-02 Automatic test data management method and system

Publications (1)

Publication Number Publication Date
CN112015657A true CN112015657A (en) 2020-12-01

Family

ID=73516310

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010908592.2A Pending CN112015657A (en) 2020-09-02 2020-09-02 Automatic test data management method and system

Country Status (1)

Country Link
CN (1) CN112015657A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112506802A (en) * 2021-01-09 2021-03-16 杭银消费金融股份有限公司 Test data management method and system
CN112765039A (en) * 2021-02-03 2021-05-07 上海复深蓝软件股份有限公司 Test data consumption dyeing method and device, computer equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103186561A (en) * 2011-12-28 2013-07-03 深圳市金蝶友商电子商务服务有限公司 Data test method, test library generating method and related device
CN110609785A (en) * 2018-06-15 2019-12-24 中移(杭州)信息技术有限公司 Software interface testing method and device
CN110990280A (en) * 2019-12-03 2020-04-10 中国工商银行股份有限公司 Automatic test data generation system and method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103186561A (en) * 2011-12-28 2013-07-03 深圳市金蝶友商电子商务服务有限公司 Data test method, test library generating method and related device
CN110609785A (en) * 2018-06-15 2019-12-24 中移(杭州)信息技术有限公司 Software interface testing method and device
CN110990280A (en) * 2019-12-03 2020-04-10 中国工商银行股份有限公司 Automatic test data generation system and method

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112506802A (en) * 2021-01-09 2021-03-16 杭银消费金融股份有限公司 Test data management method and system
CN112506802B (en) * 2021-01-09 2023-06-27 杭银消费金融股份有限公司 Test data management method and system
CN112765039A (en) * 2021-02-03 2021-05-07 上海复深蓝软件股份有限公司 Test data consumption dyeing method and device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
CN106980625B (en) Data synchronization method, device and system
US8516037B2 (en) Methods for dynamic partitioning of applications in client-server environments
US20220156133A1 (en) Cross-Process Communication Method, Apparatus, and Device
US8156137B2 (en) Data processing systems and methods
US20210173665A1 (en) Bootstrapping Profile-Guided Compilation and Verification
US20120047484A1 (en) Decorated model architecture for efficient model-driven application development
CN107016016B (en) Data processing method and device
CN112015657A (en) Automatic test data management method and system
CN114925084B (en) Distributed transaction processing method, system, equipment and readable storage medium
CN113391823A (en) Gray scale publishing method, device and system
CN111930617A (en) Automatic testing method and device based on data objectification
CN113315750B (en) Kafka message issuing method, device and storage medium
CN109614271A (en) Control method, device, equipment and the storage medium of multiple company-data consistency
CN112734349A (en) Interface generation method, data calling method, device and electronic equipment
CN111159033A (en) Software testing method and device
CN111930843B (en) Database-based data system and processing method
WO2022241945A1 (en) Data processing method and device, and computer-readable storage medium
CN113034291A (en) Method and device for exporting fund transaction processing result
CN114170007A (en) Orthogonal easy return message assembly method, program product, medium, and electronic device
CN113485927A (en) Test data generation method, device, equipment and storage medium
CN111930624A (en) Test link message data processing method and device
CN110851287A (en) Data processing method, device and computer readable storage medium
CN105574020B (en) Database operation method and device
US11726776B2 (en) Super-app extension discovery and configuration via source code management platform comments
CN112583770B (en) Data transmission method, device, storage medium and 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