Grayscale testing method, device, electronic device and storage medium
By using base classes and self-added primary key identifiers for data association in the data access layer of the business system, the cost and maintenance complexity of the isolation method of grayscale test environment and production environment are solved, and the isolation of data access operations is achieved and Synchronization reduces operation and maintenance costs and workload.
Patent Information
- Application Number
- CN202110813719.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-19
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2041-07-19
AI Technical Summary
In the prior art, the isolation method of grayscale testing environment and production environment has problems of high cost and maintenance complexity, especially the end-to-end complete isolation and partial functional isolation methods have defects, which cannot effectively reduce the development and maintenance workload.
By using base classes in the data access layer of the business system for database operations, determine whether to use a sandbox database or a formal database based on data access requests and configuration information, and data association and synchronization are performed through self-addition primary key identifiers. , realizes isolation and synchronization of data access operations.
It reduces the development and maintenance workload, improves data accuracy and security, simplifies the data synchronization process between grayscale testing and production environment, and reduces operation and maintenance costs.
Smart Images

Figure CN113468064B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of software testing, and in particular to a grayscale testing method, device, electronic device and storage medium. Background Art
[0002] Grayscale testing is a step before a software product is officially used by users. During the grayscale testing process, the user group of the software product will be gradually expanded. Grayscale testing can ensure the stability of the overall system, obtain user feedback early, discover and solve problems in a timely manner, and reduce the range of users affected by software product defects.
[0003] The grayscale test environment is the environment corresponding to the grayscale test, and the production environment is the user's usage environment. The software product can only be released to the formal production environment after passing the grayscale test environment.
[0004] Since there may be problems with the results of the grayscale test, in order not to affect the normal service provided by the production environment to users, it is generally required to isolate the grayscale test environment from the production environment. The isolation of the grayscale test environment from the production environment is fundamentally that the database access operations performed in the grayscale test environment will not affect the content of the database in the production environment.
[0005] In the prior art, there are mainly two methods to achieve the isolation of the grayscale test environment and the production environment.
[0006] The first type is end-to-end complete isolation, which completely isolates the grayscale test environment from the production environment. Although this method has a good isolation effect, it requires maintaining both the grayscale test environment and the production environment at the same time, which increases the use of underlying computing resources and operation and maintenance costs exponentially.
[0007] The second type is to isolate some functions, that is, to provide both a grayscale test environment and a production environment for some functions of the software product. This method requires setting up duplicate codes for the software product to adapt to different environments. The setting of duplicate codes increases the complexity of future software product maintenance.
[0008] In summary, the methods in the prior art have their own shortcomings. Summary of the invention
[0009] In view of the problems existing in the prior art, the present disclosure provides a grayscale testing method, device, electronic device and storage medium.
[0010] The present disclosure provides a grayscale testing method, comprising:
[0011] In the grayscale test, the first component in the data access layer of the business system determines whether the database to be accessed is a sandbox database or a formal database according to the received data access request and configuration information; wherein the first component is obtained according to a base class, and the base class is used to perform operations including adding, deleting, modifying and viewing operations on the database; the sandbox database is a database in the grayscale test environment, and the formal database is a database in the production environment;
[0012] In the case that the database to be accessed is a sandbox database, the first component performs a data access operation on the sandbox database according to the data access request.
[0013] According to a grayscale testing method provided by the present invention, when the database to be accessed is a sandbox database, the first component performs a data access operation on the sandbox database according to the data access request, including:
[0014] When the data access operation is a modification operation or a deletion operation, the first component performs a modification operation or a deletion operation on the sandbox database according to the data access request, and records the modification operation or the deletion operation.
[0015] According to a grayscale testing method provided by the present invention, data in a database are associated with each other through an auto-incrementing primary key identifier;
[0016] Accordingly, when the database to be accessed is a sandbox database, the first component performs a data access operation on the sandbox database according to the data access request, including:
[0017] When the data access operation is an add operation, the first component adds first data in the sandbox database and adds second data in the formal database according to the data access request, and the first data and the second data have the same size and the same auto-increment primary key identifier.
[0018] According to a grayscale testing method provided by the present invention, when the database to be accessed is a sandbox database, the first component performs a data access operation on the sandbox database according to the data access request, and further includes:
[0019] The first data is set to a valid state, and the second data is set to an invalid state.
[0020] According to a grayscale testing method provided by the present invention, the data in the database are not associated with each other through an auto-incrementing primary key identifier;
[0021] Accordingly, when the database to be accessed is a sandbox database, the first component performs a data access operation on the sandbox database according to the data access request, including:
[0022] When the data access operation is an addition operation, the first component adds first data to the sandbox database and records the addition operation.
[0023] According to a grayscale testing method provided by the present invention, the method further includes:
[0024] In the case that the database to be accessed is a formal database, the first component performs a data access operation on the formal database according to the data access request.
[0025] The present invention also provides a grayscale testing device, comprising:
[0026] A database determination module is used for determining, during the grayscale test, that the first component in the data access layer of the business system is a sandbox database or a formal database according to the received data access request and configuration information; wherein the first component is obtained according to a base class, and the base class is used to perform operations including adding, deleting, modifying and viewing operations on the database; the sandbox database is a database in the grayscale test environment, and the formal database is a database in the production environment;
[0027] The sandbox database access module is used for, when the database to be accessed is a sandbox database, the first component performs a data access operation on the sandbox database according to the data access request.
[0028] According to a grayscale testing device provided by the present invention, data in a database are associated with each other through a self-incrementing primary key identifier;
[0029] Correspondingly, the sandbox database access module is also used to, when the data access operation is an add operation, the first component adds first data to the sandbox database and adds second data to the formal database according to the data access request, and the first data and the second data are of the same size and have the same auto-increment primary key identifier.
[0030] The present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any of the grayscale testing methods described above when executing the program.
[0031] The present disclosure also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of any of the grayscale testing methods described above are implemented.
[0032] The grayscale testing method, device, electronic device and storage medium provided by the present invention can determine the database (sandbox database or formal database) to be accessed by the data access operation in the data access layer of the business system by making a small amount of modification to the base class inherited by the class of each table in the database, thereby realizing the data access operation. Compared with the prior art, there is no need to make a large number of modifications to the basic business operations in the business logic layer and the data access layer, which significantly reduces the development workload and subsequent maintenance workload. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions in the present disclosure or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0034] Figure 1 It is a logical architecture diagram of a business system in the prior art;
[0035] Figure 2 This is a schematic diagram of completely isolating the grayscale test environment from the production environment in the prior art;
[0036] Figure 3 It is a schematic diagram of isolating some functions of a business system in the prior art;
[0037] Figure 4 is a flow chart of the grayscale testing method provided by the present disclosure;
[0038] Figure 5 is a schematic diagram of a grayscale testing device provided by the present disclosure;
[0039] Figure 6 It is a schematic diagram of the structure of an electronic device provided by the present disclosure. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solutions and advantages of the present disclosure clearer, the technical solutions in the present disclosure will be clearly and completely described below in conjunction with the drawings in the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0041] Before explaining the present disclosure in detail, the logical architecture of the business system is first explained.
[0042] Figure 1It is a logical architecture diagram of the business system in the prior art, such as Figure 1 As shown, a business system includes a WEB layer, a business logic layer, a data access layer, and a database. The WEB layer is used for front-end display and user request processing; the business logic layer is used to implement core business logic; the data access layer (i.e., DAO layer) is used to implement database access; and the database (or information resource layer) is used to store data.
[0043] During the operation of this business system, due to the influence of various factors such as system upgrades and new function testing, it is necessary to perform grayscale testing on it.
[0044] Since the results of the grayscale test are ultimately reflected as changes in the data in the database of the business system, in order to avoid the adverse effects of the grayscale test on the normal use of the business system by users, the database used for the grayscale test needs to be distinguished from the database in the production environment during the grayscale test. In this disclosure, the database involved in the grayscale test is called a sandbox database, and the database in the production environment is called a formal database.
[0045] As mentioned in the description of the background technology, in order to prevent the grayscale test from affecting the normal use of the business system by users, the grayscale test environment needs to be isolated from the production environment. In the prior art, there are two types of methods. Figure 2 This is a schematic diagram of completely isolating the grayscale test environment from the production environment in the prior art, such as Figure 2 As shown in the figure, according to this method, two business systems need to be set up at the same time, one for the grayscale test environment and one for the production environment. The consequence of this is that the use of underlying computing resources and operation and maintenance costs increase exponentially.
[0046] Figure 3 FIG. 1 is a schematic diagram of isolating some functions of a business system in the prior art. Figure 3 As shown in the figure, some functions in the business logic layer need to be isolated in the gray test environment and the production environment, while other functions in the business logic layer can be shared in the gray test environment and the production environment. Correspondingly, the data access layer can also be divided into two parts: one part accesses the formal database under the control of the shared part in the business logic layer; the other part accesses the formal database or the sandbox database according to the configuration information under the control of the isolated part in the business logic layer. This method requires setting duplicate code for the isolated part of the business system to adapt to different environments. The setting of duplicate code increases the complexity of business system maintenance.
[0047] Combine the following Figure 4-Figure 6 The present invention describes a grayscale testing method, device, electronic device and storage medium.
[0048] Figure 4 A flowchart of the grayscale testing method provided by the present disclosure, such as Figure 4 As shown, the grayscale testing method provided by the present disclosure is applied to the data access layer of the business system, and the method includes:
[0049] Step 401: In the grayscale test, the first component in the data access layer of the business system determines whether the database to be accessed is a sandbox database or a formal database according to the received data access request and configuration information.
[0050] In grayscale testing, data access operations are usually required. The data access layer of the business system receives a data access request from the business logic layer. The data access request contains the type information, address information and data required for the data access operation.
[0051] According to the business logic in the business system, various types of operations need to be performed on the database during the operation of the business system. For example, if the business system is a shopping website, then multiple links such as user registration, user login, web browsing, product selection, transaction payment, etc. all involve operations on the database. However, these operations can be further divided into four basic operations, namely, add operation, delete operation, modify operation, and view operation.
[0052] In this step, the type information of the data access operation contained in the data access request is used to describe whether the data access operation is an add operation, a delete operation, a modify operation, or a view operation. It is easy for those skilled in the art to understand that if the data access operation corresponding to the data access request obtained from the business logic layer of the business system is not a basic operation, it can be decomposed into basic operations. How to decompose a more complex data access operation into basic operations is common knowledge of those skilled in the art and will not be repeated here.
[0053] The address information included in the data access request is used to describe the location where the data access operation occurs. Data is usually stored in the form of a data table in a database, so the address information may include identification information of the data table and address information in the data table.
[0054] When the data access operation involved in the data access request is an adding operation or a modifying operation, the data access request also includes the data to be added or the data to be modified.
[0055] After receiving the data access request, the data access layer will call the first component for subsequent processing. In this embodiment, the first component is obtained according to the base class, which is the base class inherited by the classes of each table in the database and is used to perform operations including adding, deleting, modifying and viewing operations on the database.
[0056] In the present disclosure, the sandbox database is a database in a grayscale testing environment, and the formal database is a database in a production environment.
[0057] In general, business data is stored in the form of data tables in both the sandbox database and the official database. During the grayscale test, data access operations only access the data tables in the sandbox database. If the business data changes during the grayscale test, the business data will be synchronized from the data tables in the sandbox database to the corresponding data tables in the official database during the subsequent release process.
[0058] However, some business data in the business system is relatively fixed, such as user account information, and there is no need for grayscale testing. Such business data usually only needs to be saved in the data table of the formal database. When calling these business data during the grayscale testing process, the corresponding data access operation needs to access the formal database. In the subsequent release process, such data will not be synchronized from the data table of the sandbox database to the corresponding data table of the formal database.
[0059] To summarize, if the business data is stored in both the sandbox database and the formal database, then during the grayscale testing process, the access operation to the business data is access to the sandbox database; if the business data is only stored in the formal database, then during the grayscale testing process, the access operation to the business data is access to the formal database.
[0060] In this step, the first component may determine whether the data access operation corresponding to the data access request accesses the sandbox database or the formal database according to the preset configuration information and the received data access request.
[0061] The configuration information describes the database where the data table is located. For example, suppose there are data tables t1, t2, t3, ..., t10. The configuration information describes that data tables t1, t2, t5, and t10 exist in both the sandbox database and the formal database, and data tables t3, t4, t6, t7, t8, and t9 only exist in the formal database. Then, according to the address information contained in the data access request and the configuration information, the database to be accessed by the data access operation can be determined.
[0062] As is common knowledge among those skilled in the art, when the data scale is very large, there are multiple sandbox databases for the convenience of management. At this time, determining the database to be accessed by the data access operation also includes: determining the first sandbox database from multiple sandbox databases. Similarly, there may be multiple formal databases, and determining the database to be accessed by the data access operation also includes: determining the first formal database from multiple formal databases. How to determine the first sandbox database from multiple sandbox databases, or how to determine the first formal database from multiple formal databases is common knowledge among those skilled in the art, and therefore will not be repeated here.
[0063] Step 402: When the database to be accessed is a sandbox database, the first component performs a data access operation on the sandbox database according to the data access request.
[0064] In the previous step, it has been determined that the database to be accessed by the data access operation is a sandbox database or a formal database. In this step, the case where the database to be accessed is a sandbox database is further discussed.
[0065] When the data access operation is an add operation, the newly added data is stored in the designated storage location of the sandbox database; when the data access operation is a delete operation, the previously stored data is deleted in the designated storage location of the sandbox database; when the data access operation is a modify operation, the previously stored data is modified in the designated storage location of the sandbox data; when the data access operation is a view operation, the previously stored data is viewed in the designated storage location of the sandbox database.
[0066] The grayscale testing method provided by the present invention can determine the database (sandbox database or formal database) to be accessed by the data access operation in the data access layer of the business system by making a small amount of modification to the base class inherited by the classes of each table in the database, thereby realizing the data access operation. Compared with the existing technology, there is no need to make a large number of modifications to the basic business operations in the business logic layer and the data access layer, which significantly reduces the development workload and subsequent maintenance workload.
[0067] Based on any of the above embodiments, in this embodiment, when the database to be accessed is a sandbox database, the first component performs a data access operation on the sandbox database according to the data access request, including:
[0068] When the data access operation is a modification operation or a deletion operation, the first component performs a modification operation or a deletion operation on the sandbox database according to the data access request, and records the modification operation or the deletion operation.
[0069] As is common knowledge in the art, modification or deletion operations will cause changes to the data previously stored in the sandbox database. In order to ensure the consistency of data in the sandbox database and the formal database, in this embodiment, the modification or deletion operations on the sandbox database can be recorded in a detailed table, so that after the grayscale test passes, the formal database can be accessed according to the modification or deletion operations recorded in the detailed table. That is, the changes to the sandbox database in the grayscale test are published to the formal database in the production environment, so as to provide formal services to the outside world.
[0070] The grayscale testing method provided by the present invention records the modification or deletion operations of the sandbox database, so that after the grayscale test is passed, the sandbox database and the formal database can be quickly synchronized according to the records, thereby improving the accuracy and security of the data and also improving efficiency.
[0071] Based on any of the above embodiments, in this embodiment, the data in the database are associated with each other through a self-incrementing primary key identifier;
[0072] Accordingly, when the database to be accessed is a sandbox database, the first component performs a data access operation on the sandbox database according to the data access request, including:
[0073] When the data access operation is an add operation, the first component adds first data in the sandbox database and adds second data in the formal database according to the data access request, and the first data and the second data have the same size and the same auto-increment primary key identifier.
[0074] Those skilled in the art know that there are many ways to implement a database, such as a MySQL database, an Oracle database, etc. The MySQL database has its own characteristics in its implementation mechanism, one of which is that data in the MySQL database are associated with each other through an auto-incrementing primary key ID.
[0075] For example, according to a certain business logic in the business system, the content of item 001 of table t1 and the content of item 002 of table t2 are associated. In order to describe this association, the auto-increment primary key ID 001 of table t1 and the auto-increment primary key ID 002 of table t2 are set to have an associated relationship. In order to ensure that the content of item 001 of table t1 and the content of item 002 of table t2 are still associated after the grayscale test, it is required that item 001 of table t1 in the sandbox database is consistent with item 001 of table t1 in the formal database; item 002 of table t2 in the sandbox database is consistent with item 002 of table t2 in the formal database. That is, the row content of the data table corresponding to the same auto-increment primary key ID (such as 001, 002) in the two tables corresponding to the sandbox database and the formal database is consistent.
[0076] However, in the MySQL database, the process of determining the auto-increment primary key ID value is not manually controlled. Therefore, when performing an addition operation, it is necessary to perform the data addition operation in both the sandbox database and the formal database to ensure that the table entries in the sandbox database and the formal database with the same auto-increment primary key ID are consistent.
[0077] Specifically, by adding data in the sandbox database and the formal database at the same time, the process of generating the auto-increment primary key ID in the sandbox database and the formal database can be realized at the same time. The determination of the auto-increment primary key ID value mainly depends on the external conditions at the time of generation, so the values of the auto-increment primary key ID generated in the sandbox database and the formal database at the same time are the same. This ensures that the table items with the same auto-increment primary key ID in the sandbox database and the formal database are consistent.
[0078] For example, a data access operation is to insert a value A into table t1 of a sandbox database implemented based on a MySQL database. According to the calculation method of the auto-increment primary key ID of the MySQL database, the auto-increment primary key ID corresponding to the addition operation is 003, that is, the value A is inserted into the table entry with the auto-increment primary key ID of 003. When the data access operation is also implemented in the formal database implemented based on the MySQL database, due to the same external conditions at the same time, according to the calculation method of the auto-increment primary key ID of the MySQL database, the auto-increment primary key ID corresponding to the addition operation is also 003, that is, in the formal database, the value A is also inserted into the table entry with the auto-increment primary key ID of 003. This ensures that the table entry with the auto-increment primary key ID of table t1 in the sandbox database is consistent with the table entry with the auto-increment primary key ID of table t1 in the formal database.
[0079] It should be noted that during the grayscale test, if a data table exists in both the sandbox database and the formal database, then in principle, only the newly added data needs to be written in the sandbox database. In this embodiment, in view of the characteristics of the MySQL database, the newly added data needs to be written in both the sandbox database and the formal database. This is inconsistent with the business logic of the grayscale test, so it is necessary to set a flag for the newly added data written in the formal database. During the grayscale test, the flag is in an invalid state, indicating that the newly added data written in the formal database has not taken effect at this time, that is, it has been written physically, but not yet written logically; when the grayscale test results and the business system are officially released, the state of the flag is changed to a valid state, that is, the newly added data has been written both physically and logically.
[0080] The grayscale testing method provided by the present invention ensures that the correspondence between the self-incrementing primary key identifiers is not changed and the accuracy of the data is guaranteed for a database in which data is associated with each other through self-incrementing primary key identifiers by physically double-writing the addition operation (writing to the sandbox database and the formal database at the same time).
[0081] Based on any of the above embodiments, in this embodiment, the data in the database are not associated with each other through a self-incrementing primary key identifier;
[0082] Accordingly, when the database to be accessed is a sandbox database, the first component performs a data access operation on the sandbox database according to the data access request, including:
[0083] When the data access operation is an addition operation, the first component adds first data to the sandbox database and records the addition operation.
[0084] In the previous embodiment, a database such as a MySQL database in which data is associated with each other through an auto-incrementing primary key identifier is described, and how to process the process of adding an operation is described. In this embodiment, a database such as an Oracle database in which data is not associated with each other through an auto-incrementing primary key identifier is described, and how to process the process of adding an operation is described.
[0085] In the Oracle database, data are associated with each other through a custom primary key ID, and the process of setting the primary key ID value can be controlled. Therefore, in this embodiment, there is no need to perform physical double writing (writing the sandbox database and the formal database at the same time) for the addition operation. When implementing the addition operation, it is only necessary to add the first data in the sandbox database and record the addition operation. After the grayscale test passes, the formal database is accessed according to the recorded addition operation. That is: the changes to the sandbox database in the grayscale test are published to the formal database in the production environment, so as to provide formal services to the outside world.
[0086] The grayscale testing method provided by the present invention is for a database in which data is not associated by an auto-incrementing primary key identifier. By performing an addition operation in a sandbox database and recording the addition operation, after the grayscale test is passed, the sandbox database can be quickly synchronized with the formal database based on the record, thereby improving data accuracy and security, and also improving efficiency.
[0087] Based on any of the above embodiments, in this embodiment, the method further includes:
[0088] In the case that the database to be accessed is a formal database, the first component performs a data access operation on the formal database according to the data access request.
[0089] In the previous embodiments, the case where the database to be accessed is a sandbox database is discussed. In practical applications, there is also a case where the database to be accessed is a formal database. In this embodiment, such a case is discussed.
[0090] Since some business data in the business system is relatively fixed, such as user account information, this data is only stored in the official database. In grayscale testing, if this data is involved, the official database can be directly accessed according to the data access request.
[0091] During the release process after the grayscale test is passed, such data does not need to be synchronized from the sandbox database to the official database.
[0092] The grayscale testing method provided by the present invention can determine the database to be accessed by the data access operation in the data access layer of the business system by making a small amount of modification to the base class inherited by the classes of each table in the database, and then implement the data access operation. Compared with the existing technology, there is no need to make a large number of modifications to the basic business operations in the business logic layer and the data access layer, so that the development workload and subsequent maintenance workload are significantly reduced.
[0093] The grayscale testing device provided by the present disclosure is described below. The grayscale testing device described below and the grayscale testing method described above can be referenced to each other.
[0094] Figure 5 is a schematic diagram of a grayscale testing device provided by the present disclosure, such as Figure 5 As shown, the grayscale testing device provided by the present disclosure includes:
[0095] The database determination module 501 is used for determining, in the grayscale test, that the first component in the data access layer of the business system is a sandbox database or a formal database according to the received data access request and configuration information; wherein the first component is obtained according to a base class, and the base class is used to perform operations including adding, deleting, modifying and viewing operations on the database; the sandbox database is a database in the grayscale test environment, and the formal database is a database in the production environment;
[0096] The sandbox database access module 502 is used for, when the database to be accessed is a sandbox database, the first component performing a data access operation on the sandbox database according to the data access request.
[0097] The grayscale testing device provided by the present invention can determine the database (sandbox database or formal database) to be accessed by the data access operation in the data access layer of the business system by making a small amount of modification to the base class inherited by the classes of each table in the database, thereby realizing the data access operation. Compared with the prior art, there is no need to make a large number of modifications to the basic business operations in the business logic layer and the data access layer, which significantly reduces the development workload and subsequent maintenance workload.
[0098] Based on any of the above embodiments, in this embodiment, the sandbox database access module 502 is used to:
[0099] When the data access operation is a modification operation or a deletion operation, the first component performs a modification operation or a deletion operation on the sandbox database according to the data access request, and records the modification operation or the deletion operation.
[0100] The grayscale testing device provided by the present invention records the modification or deletion operations on the sandbox database, so that after the grayscale test is passed, the sandbox database and the formal database can be quickly synchronized according to the records, thereby improving the accuracy and security of the data and also improving efficiency.
[0101] Based on any of the above embodiments, in this embodiment, the data in the database are associated through an auto-incrementing primary key identifier; accordingly, the sandbox database access module is also used for, when the data access operation is an add operation, the first component adds first data to the sandbox database according to the data access request, and adds second data to the formal database, the first data and the second data are the same size and have the same auto-incrementing primary key identifier.
[0102] The grayscale testing device provided by the present invention ensures that the correspondence between self-incrementing primary key identifiers is not changed and the accuracy of the data is guaranteed for a database in which data is associated with each other through self-incrementing primary key identifiers by physically double-writing the addition operation (writing to the sandbox database and the formal database at the same time).
[0103] Based on any of the above embodiments, in this embodiment, the data in the database are not associated with each other through a self-incrementing primary key identifier;
[0104] Correspondingly, the sandbox database access module is also used for, when the data access operation is an adding operation, the first component adding first data to the sandbox database and recording the adding operation.
[0105] The grayscale testing device provided by the present invention performs an addition operation in a sandbox database and records the addition operation for a database whose data are not associated by a self-incrementing primary key identifier. After the grayscale test is passed, the sandbox database can be quickly synchronized with the formal database based on the record, thereby improving data accuracy and security, as well as efficiency.
[0106] Based on any of the above embodiments, in this embodiment, the device further includes:
[0107] The formal database access module is used for, when the database to be accessed is a formal database, the first component performs a data access operation on the formal database according to the data access request.
[0108] The grayscale testing device provided by the present invention can determine the database to be accessed by the data access operation in the data access layer of the business system by making a small amount of modification to the base class inherited by the classes of each table in the database, thereby realizing the data access operation. Compared with the prior art, there is no need to make a large number of modifications to the basic business operations in the business logic layer and the data access layer, which significantly reduces the development workload and subsequent maintenance workload.
[0109] Figure 6 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 6 As shown, the electronic device may include: a processor 610, a communication interface 620, a memory 630 and a communication bus 640, wherein the processor 610, the communication interface 620 and the memory 630 communicate with each other through the communication bus 640. The processor 610 may call the logic instructions in the memory 630 to execute the grayscale test method, which includes:
[0110] In the grayscale test, the first component in the data access layer of the business system determines whether the database to be accessed is a sandbox database or a formal database according to the received data access request and configuration information; wherein the first component is obtained according to a base class, and the base class is used to perform operations including adding, deleting, modifying and viewing operations on the database; the sandbox database is a database in the grayscale test environment, and the formal database is a database in the production environment;
[0111] In the case that the database to be accessed is a sandbox database, the first component performs a data access operation on the sandbox database according to the data access request.
[0112] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present disclosure is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0113] On the other hand, the present disclosure further provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, when the program instructions are executed by a computer, the computer can execute the grayscale testing method provided by the above methods, the method comprising:
[0114] In the grayscale test, the first component in the data access layer of the business system determines whether the database to be accessed is a sandbox database or a formal database according to the received data access request and configuration information; wherein the first component is obtained according to a base class, and the base class is used to perform operations including adding, deleting, modifying and viewing operations on the database; the sandbox database is a database in the grayscale test environment, and the formal database is a database in the production environment;
[0115] In the case that the database to be accessed is a sandbox database, the first component performs a data access operation on the sandbox database according to the data access request.
[0116] In another aspect, the present disclosure further provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the grayscale testing method provided above is implemented, and the method includes:
[0117] In the grayscale test, the first component in the data access layer of the business system determines whether the database to be accessed is a sandbox database or a formal database according to the received data access request and configuration information; wherein the first component is obtained according to a base class, and the base class is used to perform operations including adding, deleting, modifying and viewing operations on the database; the sandbox database is a database in the grayscale test environment, and the formal database is a database in the production environment;
[0118] In the case that the database to be accessed is a sandbox database, the first component performs a data access operation on the sandbox database according to the data access request.
[0119] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0120] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0121] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present disclosure.
Claims
1. A grayscale testing method, characterized in that: include: In the grayscale test, the first component in the data access layer of the business system determines whether the database to be accessed is a sandbox database or a formal database according to the received data access request and configuration information; wherein the first component is obtained according to the base class, the base class is the base class inherited by the classes of each table in the database, and is used to perform operations including adding, deleting, modifying and viewing operations on the database; the configuration information describes the database where the data table is located; the sandbox database is the database in the grayscale test environment, and the formal database is the database in the production environment; In the case where the database to be accessed is a sandbox database, the first component performs a data access operation on the sandbox database according to the data access request; in the case where the database to be accessed is a sandbox database, the first component performs a data access operation on the sandbox database according to the data access request, including: when the data access operation is a modification operation or a deletion operation, the first component performs a modification operation or a deletion operation on the sandbox database according to the data access request, and records the modification operation or the deletion operation.
2. The grayscale testing method according to claim 1, characterized in that: The data in the database are associated with each other through the auto-increment primary key identifier; Accordingly, when the database to be accessed is a sandbox database, the first component performs a data access operation on the sandbox database according to the data access request, including: When the data access operation is an add operation, the first component adds first data in the sandbox database and adds second data in the formal database according to the data access request, and the first data and the second data have the same size and the same auto-increment primary key identifier.
3. The grayscale testing method according to claim 2, characterized in that: In the case where the database to be accessed is a sandbox database, the first component performs a data access operation on the sandbox database according to the data access request, further comprising: The first data is set to a valid state, and the second data is set to an invalid state.
4. The grayscale testing method according to claim 1, characterized in that: The data in the database are not associated with each other through the auto-increment primary key identifier; Accordingly, when the database to be accessed is a sandbox database, the first component performs a data access operation on the sandbox database according to the data access request, including: When the data access operation is an addition operation, the first component adds first data to the sandbox database and records the addition operation.
5. The grayscale testing method according to any one of claims 1 to 4, characterized in that: The method also includes: In the case that the database to be accessed is a formal database, the first component performs a data access operation on the formal database according to the data access request.
6. A grayscale testing device, characterized in that: include: A database determination module is used for determining, during the grayscale test, that the first component in the data access layer of the business system is a sandbox database or a formal database according to the received data access request and configuration information; wherein the first component is obtained according to a base class, the base class is a base class inherited by classes of various tables in the database, and is used to perform operations including adding, deleting, modifying, and viewing operations on the database; the configuration information describes the database where the data table is located; the sandbox database is a database in the grayscale test environment, and the formal database is a database in the production environment; A sandbox database access module, used for, when the database to be accessed is a sandbox database, the first component performs a data access operation on the sandbox database according to the data access request; when the database to be accessed is a sandbox database, the first component performs a data access operation on the sandbox database according to the data access request, including: when the data access operation is a modification operation or a deletion operation, the first component performs a modification operation or a deletion operation on the sandbox database according to the data access request, and records the modification operation or the deletion operation.
7. The grayscale testing device according to claim 6, characterized in that: The data in the database are associated with each other through the auto-increment primary key identifier; Correspondingly, the sandbox database access module is also used to, when the data access operation is an add operation, the first component adds first data to the sandbox database and adds second data to the formal database according to the data access request, and the first data and the second data are of the same size and have the same auto-increment primary key identifier.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the grayscale testing method according to any one of claims 1 to 5 are implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the grayscale testing method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
CIM (common information model) path inquiring method and CIM path inquiring device
CN103617214A
Grey level launch method and device
CN105824745A
Browser testing method and device and computer equipment
CN110837472A
Dynamic loading method and device
CN111221593A
Product gray release method and device based on gray database, equipment and medium
CN112948278A
