CN108459951B - Test method and device - Google Patents

Test method and device Download PDF

Info

Publication number
CN108459951B
CN108459951B CN201710093930.XA CN201710093930A CN108459951B CN 108459951 B CN108459951 B CN 108459951B CN 201710093930 A CN201710093930 A CN 201710093930A CN 108459951 B CN108459951 B CN 108459951B
Authority
CN
China
Prior art keywords
test
databases
environment
database
test environment
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.)
Active
Application number
CN201710093930.XA
Other languages
Chinese (zh)
Other versions
CN108459951A (en
Inventor
张丹
马文韬
李跃森
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201710093930.XA priority Critical patent/CN108459951B/en
Publication of CN108459951A publication Critical patent/CN108459951A/en
Application granted granted Critical
Publication of CN108459951B publication Critical patent/CN108459951B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3664Environments for testing or debugging software
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a test method and a test device, wherein the method comprises the following steps: acquiring characteristics and characteristic values of the characteristics of a plurality of original databases in the current network scene; configuring a plurality of test databases in the test environment according to the characteristics and the characteristic values; and executing preset operation through a plurality of test databases of the test environment to obtain a test result. According to the technical scheme of the invention, under the condition of not depending on the current network environment, by extracting the characteristics of the current network environment and configuring the test environment corresponding to the current network environment according to the extracted characteristics, various current network scenes can be simulated by utilizing the test environment, so that the test of the various current network scenes is realized; the technical scheme of the invention can simulate the corresponding scene according to the scene characteristics, simulate and test the current network environment by using the test environment, cover the current network test, avoid interference on the current network cluster and data, configure according to the scene characteristics and the database type, and have strong universality.

Description

Test method and device
Technical Field
The invention relates to the technical field of internet, in particular to a testing method and a testing device.
Background
In recent years, with the rapid increase of data volume, database technology has been rapidly developed, and the application scenarios of databases have become more and more complex. At present, most of database testing methods relate to basic function and performance testing of databases, but the complexity and specificity of application scenarios of existing networks (collection of formally deployed hardware and software in production environment, i.e. production environment) are greatly different from those of testing scenarios, so that the database existing network scenario testing (testing performed on the existing network environment) is very necessary. Due to the difficulty of the simulation of the current network scene, a reasonable scheme is needed to solve the problem.
Through investigation, similar techniques are currently available: and taking the current network environment as a test environment, carrying out authority isolation on the current network, and directly carrying out scene test (software test based on scenes) on the current network. This technique first suffers from certain limitations: 1) only the current scene of the existing network can be tested, and scenes at more moments cannot be flexibly constructed; 2) if the existing network service or data has certain sensitivity, the technology can not be realized; 3) the technology can cause certain pressure on the existing network and consume the resources of the existing network to a certain extent.
Therefore, a new technique is needed to test a plurality of existing network scenarios without departing from the existing network environment.
Disclosure of Invention
In view of the above, the present invention provides a testing method and apparatus for testing multiple existing network scenarios without existing network environment.
The technical scheme adopted by the invention for solving the technical problems is as follows:
according to an aspect of the present invention, there is provided a test method, the method comprising:
acquiring characteristics of a plurality of original databases in an existing network scene and characteristic values of the characteristics;
configuring a plurality of test databases in a test environment according to the characteristics and the characteristic values;
and executing preset operation through a plurality of test databases of the test environment to obtain a test result.
According to another aspect of the present invention, there is provided a test apparatus, the apparatus comprising:
the system comprises a characteristic acquisition module, a characteristic analysis module and a characteristic analysis module, wherein the characteristic acquisition module is used for acquiring characteristics of a plurality of original databases in the current network scene and characteristic values of the characteristics;
the scene restoration module is used for configuring a plurality of test databases in the test environment according to the characteristics and the characteristic values;
and the test module is used for executing preset operation through the plurality of test databases of the test environment to obtain a test result.
According to the technical scheme, the testing method and the testing device disclosed by the invention have the following beneficial effects:
according to the technical scheme of the invention, under the condition of not depending on the current network environment, by extracting the characteristics of the current network environment and configuring the test environment corresponding to the current network environment according to the extracted characteristics, various current network scenes can be simulated by utilizing the test environment, so that the test of the various current network scenes is realized; the technical scheme of the invention can simulate the corresponding scene according to the scene characteristics, simulate and test the current network environment by using the test environment, cover the current network test, avoid interference on the current network cluster and data, configure according to the scene characteristics and the database type, and have strong universality.
Drawings
FIG. 1 is a flow chart of a testing method according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of a testing method according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating an overall testing method according to an embodiment of the present invention;
FIG. 4 is a flowchart of a testing method according to an embodiment of the present invention;
FIG. 5 is a schematic flow chart of a testing method according to an embodiment of the present invention;
FIG. 6 is a schematic flow chart of a testing method according to an embodiment of the present invention;
FIG. 7 is a schematic flow chart of a testing method according to an embodiment of the present invention;
FIG. 8 is a block diagram of an overall testing method according to an embodiment of the present invention;
FIG. 9 is a block diagram of a testing apparatus according to an embodiment of the present invention;
fig. 10 is a block diagram of a testing apparatus according to an embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
In order to make the technical problems, technical solutions and advantageous effects to be solved by the present invention clearer and clearer, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. The technical scheme of the embodiment is applied to simulation test of the database cluster in the current network environment, and the database cluster with a certain scale is also in the test environment.
As shown in FIG. 1, a test method is provided in one embodiment of the invention. The core of the embodiment is to realize an implementation scheme for simulating the current network scene of the database, and because the current network scene of the database is difficult to simulate, but the current network scene test is an important loop in the test, great difficulty is brought to the database test work. The embodiment simulates the current network scene aiming at the current situation, and aims to provide convenience for the current network scene test of the database, so that the test coverage rate and the test quality are improved. The method of the embodiment comprises the following steps:
step S110, acquiring the characteristics and characteristic values of a plurality of original databases in the current network scene. In this embodiment, the scene feature extraction supports two modes, namely, automatic acquisition and manual input: (1) automatic acquisition: for the current network scene insensitive to environment and data, the scene characteristics and characteristic values of the current network can be automatically obtained through the system, and the change of the current network can be immediately obtained and applied to the test environment, so that the test cluster is updated and synchronized in time; (2) manual input: when the environment and the data are sensitive, the scene characteristics and the characteristic values of the current network can be manually input into the test environment. The manual input may also be used for other scenario tests that test non-existing networks.
Specifically, the features of the present web scenario include, but are not limited to: database cluster size, data volume, database configuration, database access characteristics, database statement characteristics, business logic characteristics, database connection characteristics, and/or flow pressure values.
In the embodiment, the main features of the database application scene are extracted, the specified scene is restored through the feature values, and different scenes corresponding to different feature values are different, so that different scenes can be configured for testing based on different feature values in the embodiment. The main characteristics of the database network application scene comprise: database cluster scale (distributed database), data volume, existing network database configuration, database access characteristics, sql characteristics, business logic characteristics, database connection characteristics, and flow pressure values. Generally, in the distributed database testing process, the test cluster scale is much smaller than that of the existing network cluster scale, so in the feature extraction process, the embodiment needs to perform equal-ratio scaling on the processing of the cluster scale, the data volume, the flow pressure value and the like, and in the scene restoration process, the processed features are matched with the test cluster. The scene configuration is more concise and convenient through the feature configuration scene. For the non-sensitive existing network environment, the existing network characteristics can be directly and automatically extracted. A schematic diagram of the feature extraction process is shown in fig. 2, feature values obtained from an existing network scene and recording a plurality of features are input into a preset feature entry, then data received by the feature entry is analyzed and classified, a plurality of features such as cluster scale and number are divided, and corresponding configuration instructions are generated based on the feature values of the features to configure the features into a test environment. The interface in the embodiment is universal and has strong reusability, so that the test scene can be configured, and the method is suitable for testing various database scenes.
And step S120, configuring a plurality of test databases in the test environment according to the characteristics and the characteristic values.
In this embodiment, the configuration manner that can be specifically adopted may be:
and sending the characteristics and the characteristic values to the plurality of test databases of the test environment for configuration according to the configuration modes corresponding to the plurality of test databases of the test environment. In this embodiment, the acquired scene characteristics and characteristic values are analyzed and issued to the test environment in a correct configuration manner, so that the test environment is restored to be consistent with the current network environment.
After the scene features are extracted, the scene restoration needs to be performed through the features and the feature values. In the scene simulation implementation process, the acquired characteristic values of all the characteristics are stored in a variable form, the characteristic values of all the characteristics are transmitted in a mode meeting the requirements of a test environment, the test environment is configured according to all the characteristics, and namely the scene same as the current network is restored through the characteristics.
The technical solution of this embodiment supports multiple database scenario tests, so in the scenario recovery part, corresponding conversion is performed on sql, configuration instructions, delivery paths, and the like according to the database type, for example, if there is a difference between the database of the current network environment and the database of the test environment in the sql syntax, when applying the sql statement applied to the current network environment to the test environment, the sql statement needs to be modified correspondingly according to the syntax difference, so that the scenario can be applied to the target database.
Step S130, a plurality of test databases in the test environment execute preset operations to obtain test results. In this embodiment, the test results may be collected, and the results include operation flow execution results (for example, feedback states after the sql statement is executed on the database), data results (values obtained after the sql statement is executed), and index results (state parameters after the sql statement is executed on the database). In this embodiment, the test result may be output in the form of a mail or the like. This section includes normal test result output, and alarms for abnormal results.
On the basis of the above embodiment, another embodiment of the present invention further includes: recording configuration information of a plurality of original databases of a test environment and recording operation information executed by a plurality of test databases of the test environment, wherein the configuration information comprises configuration parameters and the operation information comprises operation steps; and controlling a plurality of test databases of the test environment to repeatedly configure configuration parameters and repeatedly execute operation steps according to the recorded configuration information and operation information. That is, in the technical solution of this embodiment, actions and configurations in the test process can be collected and stored, so that the same scenario can be repeatedly executed and can be used for fault reproduction, and the overall flow of the technical solution of this embodiment is as shown in fig. 3.
Further, another embodiment of the present invention further comprises: and restoring the plurality of test databases of the test environment to the initial state before configuration. That is, in the technical solution of this embodiment, the test environment is restored to the initial state, so that the technical solution of this embodiment operates in a closed loop, and the degree of automation is improved.
The existing network scenario testing technology related to the database mainly has the defect of low universality, and the technical scheme of the embodiment mainly has the following technical advantages: 1) the universality is strong: the system not only supports the automatic acquisition of the characteristic value of the scene characteristic, but also supports the manual input of the characteristic value of the characteristic, so that the system can be used for the scene test of the current network and the scene test of manual design; the system is designed in a layered mode, the interface is flexible, the system can be applied to various database tests, and the universality is high; 2) the safety is high: the current network scene and the configuration are simulated in the test environment, so that the direct interference to the current network environment is avoided, the coverage rate of the test scene is ensured, and the safety of the current network environment and sensitive data is ensured; 3) reduce test human cost: the technical scheme has high automation degree, and the whole system forms a closed loop from feature extraction, result analysis to environment resetting without excessive testing manpower input.
As shown in fig. 4, an embodiment of the present invention provides a testing method, including:
step S410, acquiring the characteristics and characteristic values of a plurality of original databases in the current network scene.
In this embodiment, the obtained current network scene features (which support manual input features) include current network database configuration, database access features, sql features, business logic features, database connection features, flow pressure values, and the like.
Step S420, configuring a plurality of test databases in the test environment according to the characteristics and the characteristic values.
Step S430, acquiring a dynamic operation flow executed by a plurality of original databases in the current network scenario, where the dynamic operation flow includes a plurality of operations with a predetermined time sequence, and executing the plurality of operations in sequence according to the predetermined time sequence through a plurality of test databases in the test environment.
In this embodiment, the dynamic operation flow is collected or manually configured, and the execution process of the dynamic operation flow is restored, that is, a plurality of actions in the dynamic operation flow are performed in a database of the test environment at a specified time sequence.
In this embodiment, an existing network simulation operation flow is input into a test environment at a specified time sequence for simulation, so as to simulate a dynamic scene of an existing network more truly, a flowchart of scene restoration in this embodiment is shown in fig. 5, and after a feature and an action instruction (including sql and an instruction for modifying configuration) are input, the action instruction is parsed and converted to form an executable instruction of a target database, where: 1) sql treatment: removing illegal redundant content of sql, such as annotations, for example, a symbol indicating the annotation can be searched, and an annotation part corresponding to the symbol is deleted; 2) when the sql grammar difference exists between the database of the current network environment and the database of the test environment, the grammar needs to be modified to be suitable for the database of the test environment. And for the instructions for configuration, if the instructions for configuration need to be restarted and validated, adding a restarting instruction for the instructions to restart to validate the configuration after the configuration is completed. The process of generating a test environment includes: preparing source data, building a user, building a table and the like, executing an sql statement to start a test process under the condition that the source data, the user and the table are built, wherein an instruction issued before environment generation needs to be added into a waiting queue. After the test environment configuration is completed, the instructions in the queue are issued to the database cluster in the environment for execution, and the log is recorded for scene playback.
Therefore, the technical scheme of the embodiment supports scene playback, truly restores the current network scene, and can assist developers in error positioning and debugging.
In this embodiment, the test result includes the following parts: 1) data portion: data correctness, consistency, etc. 2) An index part: database system index, machine index, performance index, etc. After the results are collected, data analysis can be performed, for example, whether the correctness of the analysis data is in problem or not can be analyzed, and finally, the analysis results are output in the forms of mails, short messages, telephones and the like.
Step S440, adjusting concurrency of operations in the dynamic operation flow to change pressure of multiple test database loads in the test environment; and adjusting the number of clients corresponding to the plurality of test databases in the test environment to change the load pressure of the plurality of databases in the test environment. In this embodiment, the test environment pressure may be adjusted, and the database states lower than the threshold and N times higher than the threshold are verified respectively with the flow pressure characteristics obtained from the existing network as the threshold; as shown in fig. 6, a flow of performing the pressure test in this embodiment is that a client1-n is a plurality of clients, and the access amount of the database in the test environment, that is, the pressure borne by the database, may be adjusted by controlling the number of the clients and the command concurrency amount sent by the clients.
In the database test, the pressure test is an important part. In this embodiment, the average pressure value of the existing network is first obtained, and the average pressure value is used as a threshold value to verify the stability of the database system. Besides, it is also necessary to predict the stability of the database system and the changes of the related performance indexes when the pressure is greater than this value, and sometimes to verify the state when the pressure is less than this value. In this embodiment, the pressure adjustment is mainly realized by the following means: 1) adjusting the number of executing clients: the embodiment supports multi-machine deployment and operation, and the cluster pressure can be adjusted according to the number of the adjusted clients. 2) And (3) adjusting service concurrency: during the process of reducing the action flow, the pressure can be adjusted by adjusting the concurrency of the operation.
In the embodiment, the scene can be truly restored according to the characteristics of the scene, the testing environment pressure can be automatically adjusted, and the compression resistance limit and the performance of the database under different pressures can be predicted in advance.
Step S450, calculating expected test results of the plurality of test databases of the test environment according to the operation executed by the plurality of test databases of the test environment, and comparing the test results with the expected test results to obtain comparison results for providing to the user.
In this embodiment, the test result can be evaluated according to the historical working record of the original database or a specific algorithm. In this embodiment, the expected test result and the actual test result output by the test environment are compared to determine whether the database functions normally, which mainly includes the analysis of data and the comparison of each index with a threshold, and the specific flow is shown in fig. 7, which provides three comparison manners: stock data result comparison, incremental data result comparison and main/standby data result comparison, wherein the data volumes related to the three comparison modes are sequentially increased, so that the comparison accuracy is sequentially increased, the required stock, increment or main/standby data are inquired from the database through sql statements, and the number of the inquired data can be controlled through the sql statements to control the data volume of the inquired result; the data used for multi-version comparison comprises connection duration of a connection test environment database, sql execution duration of execution of sql statements in a test environment and the like; the real-time states for comparison include: the index of each node, the index of the machine and the index of the system of the database cluster can be obtained from a database of a test environment, wherein various index data can be obtained from a working log of the database. By using the technical scheme of the embodiment, the current network rehearsal system can be realized, before the database function of the current network environment is on line, the simulation test is carried out by using the test environment, and the possible situation after the new function is on line is predicted.
The overall framework of the technical solution of the present embodiment is as shown in fig. 8, and scene restoration is performed based on the extracted features and action flows to form a test environment on a database cluster for testing; completing a test process in a test environment based on source data for testing to obtain a test result, wherein the test result comprises an execution result reflecting the execution condition of an sql statement, a query result after the execution of the sql statement, and a machine (hardware) index and a system (software) index corresponding to a database cluster in the test environment; after the test results obtained in the test environment are compared and analyzed, the user can be informed of the comparison or analysis results, and the comparison or analysis results can also be stored in a database or formed into a chart to be displayed to the user.
In conclusion, the technical scheme of the embodiment is favorable for improving the test quality of the existing network environment, effectively reduces the missing test rate, can improve the test efficiency and reduce the test labor cost.
As shown in fig. 9, a test apparatus is provided in one embodiment of the present invention. The core of the embodiment is to realize an implementation scheme for simulating the current network scene of the database, and because the current network scene of the database is difficult to simulate, but the current network scene test is an important loop in the test, great difficulty is brought to the database test work. The embodiment simulates the current network scene aiming at the current situation, and aims to provide convenience for the current network scene test of the database, thereby improving the test coverage rate and the test quality. The method of the embodiment comprises the following steps:
the feature obtaining module 910 obtains features and feature values of a plurality of original databases in the current network scenario.
In this embodiment, the scene feature extraction supports two modes, namely, automatic acquisition and manual input: (1) automatic acquisition: for the current network scene insensitive to environment and data, the scene characteristics and characteristic values of the current network can be automatically obtained through the system, and the change of the current network can be immediately obtained and applied to the test environment, so that the test cluster is updated and synchronized in time; (2) manual input: when the environment and the data are sensitive, the scene characteristics and the characteristic values of the current network can be manually input into the test environment. The manual input may also be used for other scenario tests that test non-existing networks.
Specifically, the features of the present web scenario include, but are not limited to: database cluster size, data volume, database configuration, database access characteristics, database statement characteristics, business logic characteristics, database connection characteristics, and/or flow pressure values.
In the embodiment, the main features of the database application scene are extracted, the specified scene is restored through the feature values, and different scenes corresponding to different feature values are different, so that different scenes can be configured for testing based on different feature values in the embodiment. The main characteristics of the database network application scene comprise: database cluster scale (distributed database), data volume, existing network database configuration, database access characteristics, sql characteristics, business logic characteristics, database connection characteristics, and flow pressure values. Generally, in the distributed database testing process, the test cluster scale is much smaller than that of the existing network cluster scale, so in the feature extraction process, the embodiment needs to perform equal-ratio scaling on the processing of the cluster scale, the data volume, the flow pressure value and the like, and in the scene restoration process, the processed features are matched with the test cluster. The scene configuration is more concise and convenient through the feature configuration scene. For the non-sensitive existing network environment, the existing network characteristics can be directly and automatically extracted. A schematic diagram of the feature extraction process is shown in fig. 2, feature values obtained from an existing network scene and recording a plurality of features are input into a preset feature entry, then data received by the feature entry is analyzed and classified, a plurality of features such as cluster scale and number are divided, and corresponding configuration instructions are generated based on the feature values of the features to configure the features into a test environment. The interface in the embodiment is universal and strong in reusability, so that the test scene can be configured, and the method is suitable for testing various database scenes.
The scenario recovery module 920 configures a plurality of test databases in the test environment according to the features and the feature values.
In this embodiment, the configuration manner that can be specifically adopted may be:
and sending the characteristics and the characteristic values to the plurality of test databases of the test environment for configuration according to the configuration modes corresponding to the plurality of test databases of the test environment. In this embodiment, the acquired scene characteristics and characteristic values are analyzed and issued to the test environment in a correct configuration manner, so that the test environment is restored to be consistent with the current network environment.
After extracting the scene features, firstly, the scene restoration needs to be performed through the features and the feature values. In the scene simulation implementation process, the acquired characteristic values of all the characteristics are stored in a variable form, the characteristic values of all the characteristics are transmitted in a mode meeting the requirements of a test environment, the test environment is configured according to all the characteristics, and namely the scene same as the current network is restored through the characteristics.
The technical solution of this embodiment supports multiple database scenario tests, so in the scenario recovery part, corresponding conversion is performed on sql, configuration instructions, delivery paths, and the like according to the database type, for example, if there is a difference between the database of the current network environment and the database of the test environment in the sql syntax, when applying the sql statement applied to the current network environment to the test environment, the sql statement needs to be modified correspondingly according to the syntax difference, so that the scenario can be applied to the target database.
The test module 930 performs a predetermined operation through a plurality of test databases of the test environment to obtain a test result. In this embodiment, the test results may be collected, and the results include operation flow execution results (for example, feedback states after the sql statement is executed on the database), data results (values obtained after the sql statement is executed), and index results (state parameters after the sql statement is executed on the database). In this embodiment, the test result may be output in the form of a mail or the like. This section includes normal test result output, and alarms for abnormal results.
On the basis of the above embodiment, another embodiment of the present invention further includes: a recording module: recording configuration information of a plurality of original databases of a test environment and recording operation information executed by a plurality of test databases of the test environment, wherein the configuration information comprises configuration parameters and the operation information comprises operation steps; and the test module controls a plurality of test databases of the test environment to repeatedly configure configuration parameters and repeatedly execute the operation steps according to the recorded configuration information and the operation information. That is, in the technical solution of this embodiment, actions and configurations in the test process can be collected and stored, so that the same scenario can be repeatedly executed and can be used for fault reproduction, and the overall flow of the technical solution of this embodiment is as shown in fig. 3.
Further, another embodiment of the present invention further comprises: and the recovery module is used for recovering the plurality of test databases of the test environment to an initial state before configuration. That is, in the technical solution of this embodiment, the test environment is restored to the initial state, so that the technical solution of this embodiment operates in a closed loop, and the degree of automation is improved.
The existing network scenario testing technology related to the database mainly has the defect of low universality, and the technical scheme of the embodiment mainly has the following technical advantages: 1) the universality is strong: the system not only supports automatic acquisition of the characteristic value of the scene characteristic, but also supports manual input of the characteristic value of the characteristic, so that the system can be used for scene test of the current network and can also be used for manually designed scene test; the system is designed in a layered mode, the interface is flexible, the system can be applied to various database tests, and the universality is high; 2) the safety is high: the current network scene and the configuration are simulated in the test environment, so that the direct interference to the current network environment is avoided, the coverage rate of the test scene is ensured, and the safety of the current network environment and sensitive data is ensured; 3) reduce test human cost: the technical scheme has high automation degree, and the whole system forms a closed loop from feature extraction, result analysis to environment resetting without excessive testing labor input.
As shown in fig. 10, an embodiment of the present invention provides a test apparatus, including:
the feature obtaining module 1010 obtains features and feature values of a plurality of original databases in the current network scene. In this embodiment, the acquired current network scene features (which support manual input features) include current network database configuration, database access features, sql features, business logic features, database connection features, flow pressure values, and the like.
The scenario restoration module 1020 configures a plurality of test databases in the test environment according to the features and the feature values.
The testing module 1030 acquires a dynamic operation flow executed by a plurality of original databases of an existing network scenario, where the dynamic operation flow includes a plurality of operations with a predetermined time sequence, and the plurality of operations are sequentially executed according to the predetermined time sequence through the plurality of testing databases of the testing environment.
In this embodiment, the dynamic operation flow is collected or manually configured, and the execution process of the dynamic operation flow is restored, that is, a plurality of actions in the dynamic operation flow are performed in a database of the test environment at a specified time sequence.
In this embodiment, an existing network simulation operation flow is input into a test environment at a specified time sequence for simulation, so as to simulate a dynamic scene of an existing network more truly, a flowchart of scene restoration in this embodiment is shown in fig. 5, and after a feature and an action instruction (including sql and an instruction for modifying configuration) are input, the action instruction is parsed and converted to form an executable instruction of a target database, where: 1) sql treatment: removing illegal redundant content of sql, such as annotations, for example, a symbol indicating the annotation can be searched, and an annotation part corresponding to the symbol is deleted; 2) when the sql grammar difference exists between the database of the current network environment and the database of the test environment, the grammar needs to be modified to be suitable for the database of the test environment. And for the instructions for configuration, if the instructions for configuration need to be restarted and validated, adding a restarting instruction for the instructions to restart to validate the configuration after the configuration is completed. The process of generating a test environment includes: preparing source data, building a user, building a table and the like, executing an sql statement to start a test process under the condition that the source data, the user and the table are built, wherein an instruction issued before environment generation needs to be added into a waiting queue. After the test environment configuration is completed, the instructions in the queue are issued to the database cluster in the environment for execution, and the log is recorded for scene playback.
Therefore, the technical scheme of the embodiment supports scene playback, truly restores the current network scene, and can assist developers in error positioning and debugging.
In this embodiment, the test result includes the following parts: 1) data portion: data correctness, consistency, etc. 2) An index part: database system index, machine index, performance index, etc. After the results are collected, data analysis can be performed, for example, whether the correctness of the analysis data is in problem or not can be analyzed, and finally, the analysis results are output in the forms of mails, short messages, telephones and the like.
The test module 1030 adjusts the amount of concurrency of operations in the dynamic operation flow to vary the pressure of the multiple test database loads in the test environment; and adjusting the number of clients corresponding to the plurality of test databases in the test environment to change the load pressure of the plurality of databases in the test environment. In this embodiment, the test environment pressure may be adjusted, and the database states lower than the threshold and N times higher than the threshold are verified respectively with the flow pressure characteristics obtained from the existing network as the threshold; as shown in fig. 6, a flow of performing the pressure test in this embodiment is that a client1-n is a plurality of clients, and the access amount of the database in the test environment, that is, the pressure borne by the database, may be adjusted by controlling the number of the clients and the command concurrency amount sent by the clients.
In the database test, the pressure test is an important part. In this embodiment, the average pressure value of the existing network is first obtained, and the average pressure value is used as a threshold value to verify the stability of the database system. Besides, it is also necessary to predict the stability of the database system and the changes of the related performance indexes when the pressure is greater than this value, and sometimes to verify the state when the pressure is less than this value. In this embodiment, the pressure adjustment is mainly realized by the following means: 1) adjusting the number of the executed clients: the embodiment supports multi-machine deployment and operation, and the cluster pressure can be adjusted according to the number of the adjusted clients. 2) And (3) adjusting service concurrency: during the process of reducing the action flow, the pressure can be adjusted by adjusting the concurrency of the operation.
In the embodiment, the scene can be truly restored according to the characteristics of the scene, the testing environment pressure can be automatically adjusted, and the compression resistance limit and the performance of the database under different pressures can be predicted in advance.
The result analysis module 1040 calculates expected test results of the multiple test databases of the test environment according to operations executed by the multiple test databases of the test environment, and compares the test results with the expected test results to obtain comparison results for providing to the user.
In this embodiment, the test result can be evaluated according to the historical working record of the original database or a specific algorithm. In this embodiment, the expected test result and the actual test result output by the test environment are compared to determine whether the database functions normally, which is mainly an analysis of data and a comparison of various indexes and thresholds, and the specific flow is shown in fig. 7, which provides three comparison manners: stock data result comparison, incremental data result comparison and main/standby data result comparison, wherein the data volumes related to the three comparison modes are sequentially increased, so that the comparison accuracy is sequentially increased, the required stock, increment or main/standby data are inquired from the database through sql statements, and the number of the inquired data can be controlled through the sql statements to control the data volume of the inquired result; the data used for multi-version comparison comprises connection duration of a connection test environment database, sql execution duration of execution of sql statements in a test environment and the like; the real-time states for comparison include: the index of each node, the index of a machine and the index of a system of the database cluster can be obtained from a database of the test environment, wherein various index data can be obtained from a working log of the database. By using the technical scheme of the embodiment, the current network rehearsal system can be realized, before the database function of the current network environment is on line, the simulation test is carried out by using the test environment, and the possible situation after the new function is on line is predicted.
The overall framework of the technical solution of the present embodiment is as shown in fig. 8, and scene restoration is performed based on the extracted features and action flows to form a test environment on a database cluster for testing; completing a test process in a test environment based on source data for testing to obtain a test result, wherein the test result comprises an execution result reflecting the execution condition of an sql statement, a query result after the execution of the sql statement, and a machine (hardware) index and a system (software) index corresponding to a database cluster in the test environment; after the test results obtained in the test environment are compared and analyzed, the user can be informed of the comparison or analysis results, and the comparison or analysis results can also be stored in a database or formed into a chart to be displayed to the user.
In conclusion, the technical scheme of the embodiment is favorable for improving the test quality of the existing network environment, effectively reduces the missing test rate, can improve the test efficiency and reduce the test labor cost.
In addition, it is understood by those skilled in the art that all or part of the steps in the above method embodiments may be implemented by related hardware, and the corresponding program may be stored in a computer readable storage medium, where the above mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk.
The preferred embodiments of the present invention have been described above with reference to the accompanying drawings, and are not to be construed as limiting the scope of the invention. Those skilled in the art can implement the invention in various modifications, such as features from one embodiment can be used in another embodiment to yield yet a further embodiment, without departing from the scope and spirit of the invention. Any modification, equivalent replacement and improvement made within the technical idea of using the present invention should be within the scope of the right of the present invention.

Claims (9)

1. A method of testing, the method comprising:
acquiring characteristics of a plurality of original databases in an existing network scene and characteristic values of the characteristics;
configuring a plurality of test databases in a test environment according to the characteristics and the characteristic values;
acquiring dynamic operation flows executed by a plurality of original databases of the current network scene, wherein the dynamic operation flows comprise a plurality of operations with preset time sequence; and sequentially executing the plurality of operations according to the preset time sequence through a plurality of test databases of the test environment to obtain a test result.
2. The method of claim 1, wherein the characteristics of the plurality of raw databases in the active network scenario comprise:
database cluster size, data volume, database configuration, database access characteristics, database statement characteristics, business logic characteristics, database connection characteristics, and/or flow pressure values.
3. The method of claim 1, wherein configuring a plurality of test databases in a test environment according to the features and the feature values comprises:
and sending the characteristics and the characteristic values to the plurality of test databases of the test environment for configuration according to the configuration modes corresponding to the plurality of test databases of the test environment.
4. The method of claim 1, wherein performing a predetermined plurality of operations through a plurality of test databases of the test environment to obtain test results, further comprises:
adjusting the amount of concurrency of operations in the dynamic operational flow to change the pressure of the plurality of test database loads in the test environment.
5. The method of claim 1, wherein the obtaining of the test result by executing a plurality of preset operations through a plurality of test databases of the test environment specifically comprises:
and adjusting the number of clients corresponding to the plurality of test databases in the test environment to change the load pressure of the plurality of test databases in the test environment.
6. The method of claim 1, further comprising:
and calculating expected test results of the plurality of test databases of the test environment according to the operation executed by the plurality of test databases of the test environment, and comparing the test results with the expected test results to obtain comparison results for providing to a user.
7. The method of claim 1, further comprising:
recording configuration information of a plurality of original databases of the test environment and recording operation information executed by a plurality of test databases of the test environment, wherein the configuration information comprises configuration parameters, and the operation information comprises operation steps;
and controlling a plurality of test databases of the test environment to repeatedly configure the configuration parameters and repeatedly execute the operation steps according to the recorded configuration information and the operation information.
8. The method of any one of claims 1 to 7, further comprising:
and restoring the plurality of test databases of the test environment to an initial state before configuration.
9. A test device, the device comprising:
the system comprises a characteristic acquisition module, a characteristic analysis module and a characteristic analysis module, wherein the characteristic acquisition module is used for acquiring the characteristics of a plurality of original databases in the current network scene and the characteristic values of the characteristics;
the scene restoration module is used for configuring a plurality of test databases in the test environment according to the characteristics and the characteristic values;
the test module is used for acquiring dynamic operation flows executed by a plurality of original databases of the existing network scene, and the dynamic operation flows comprise a plurality of operations with preset time sequence; and sequentially executing the plurality of operations according to the preset time sequence through a plurality of test databases of the test environment to obtain a test result.
CN201710093930.XA 2017-02-21 2017-02-21 Test method and device Active CN108459951B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710093930.XA CN108459951B (en) 2017-02-21 2017-02-21 Test method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710093930.XA CN108459951B (en) 2017-02-21 2017-02-21 Test method and device

Publications (2)

Publication Number Publication Date
CN108459951A CN108459951A (en) 2018-08-28
CN108459951B true CN108459951B (en) 2022-07-29

Family

ID=63222029

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710093930.XA Active CN108459951B (en) 2017-02-21 2017-02-21 Test method and device

Country Status (1)

Country Link
CN (1) CN108459951B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112231324B (en) * 2019-06-26 2023-03-24 金篆信科有限责任公司 System and method for realizing incremental data comparison
CN110659202A (en) * 2019-08-12 2020-01-07 网宿科技股份有限公司 Client automatic testing method and device
CN110995524B (en) * 2019-10-28 2022-06-14 北京三快在线科技有限公司 Flow data monitoring method and device, electronic equipment and computer readable medium
CN110825512B (en) * 2019-11-08 2024-05-24 东南数字经济发展研究院 Universal distributed system design and C++ implementation thereof
CN111190811A (en) * 2019-12-05 2020-05-22 东方微银科技(北京)有限公司 Method, device, equipment and storage medium for testing resource allocation system
CN112100052B (en) * 2020-08-07 2023-08-18 北京奇艺世纪科技有限公司 Playback method and device of interface test scene
CN114546823B (en) * 2021-12-27 2023-09-12 芯华章科技股份有限公司 Method for reproducing debug scenario of logic system design and related equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104866580A (en) * 2015-05-26 2015-08-26 梁猛 Method for quickly detecting impact caused by database modification to current service
CN105095325A (en) * 2014-05-23 2015-11-25 中兴通讯股份有限公司 Method and device for generating test data
CN105488539A (en) * 2015-12-16 2016-04-13 百度在线网络技术(北京)有限公司 Generation method and device of classification method, and estimation method and device of system capacity
CN105824745A (en) * 2015-01-04 2016-08-03 中国移动通信集团湖南有限公司 Grey level launch method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7095423B2 (en) * 2002-07-19 2006-08-22 Evans & Sutherland Computer Corporation System and method for combining independent scene layers to form computer generated environments

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105095325A (en) * 2014-05-23 2015-11-25 中兴通讯股份有限公司 Method and device for generating test data
CN105824745A (en) * 2015-01-04 2016-08-03 中国移动通信集团湖南有限公司 Grey level launch method and device
CN104866580A (en) * 2015-05-26 2015-08-26 梁猛 Method for quickly detecting impact caused by database modification to current service
CN105488539A (en) * 2015-12-16 2016-04-13 百度在线网络技术(北京)有限公司 Generation method and device of classification method, and estimation method and device of system capacity

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
短信系统中的Oracle数据库性能优化研究及实施;李捷;《中国优秀硕士学位论文全文数据库信息科技辑》;20080531;全文 *

Also Published As

Publication number Publication date
CN108459951A (en) 2018-08-28

Similar Documents

Publication Publication Date Title
CN108459951B (en) Test method and device
EP3798846B1 (en) Operation and maintenance system and method
CN106446412B (en) Model-based test method for avionics system
CN110750458A (en) Big data platform testing method and device, readable storage medium and electronic equipment
CN112241360A (en) Test case generation method, device, equipment and storage medium
CN109977012B (en) Joint debugging test method, device, equipment and computer readable storage medium of system
CN111651365B (en) Automatic interface testing method and device
CN106713011A (en) Method and system for obtaining test data
CN111651342A (en) HTTP interface automation testing framework based on Charles recording session
CN112181784A (en) Code fault analysis method and system based on bytecode injection
CN109508204B (en) Front-end code quality detection method and device
CN116467188A (en) Universal local reproduction system and method under multi-environment scene
CN107632899B (en) Snapshot service method and device of application server
CN114650211A (en) Fault repairing method, device, electronic equipment and computer readable storage medium
CN115878448A (en) Database test method, distributed database and storage medium
CN107608886A (en) A kind of method and system of automatic report recording software defect
CN113127036A (en) Software development system, method, apparatus and medium for continuous integration of code
CN105407112B (en) Equipment capability learning method, device and system
CN110674036A (en) Cross-platform cooperative function interface test system based on CSG II system
CN113535560B (en) Test execution method, device, storage medium and computing equipment
CN114531335B (en) Method, equipment and device for detecting management information base data
CN117472641B (en) Data quality detection method and device, electronic equipment and storage medium
CN111522737B (en) Automatic test verification method and device for front-end interface and storage medium
CN111240920B (en) Performance test method, device, server and storage medium
CN117749675A (en) CMS communication protocol testing 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
GR01 Patent grant
GR01 Patent grant