Database table upgrading test method and device, computer equipment and storage medium
By comparing the differences in database table types, generating differences comparison results, and determining the database table upgrade results, the problem of low efficiency in database table upgrade testing in the existing technology is solved, and fast and accurate database table upgrade testing is achieved.
Patent Information
- Application Number
- CN202411811633.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-04-22
AI Technical Summary
In the prior art, the testing efficiency of database table upgrade is low, and it is difficult to automatically detect database table upgrade exceptions, resulting in difficult to ensure data integrity and consistency.
By comparing the differences between the database table types in the first version of the project code and the second version of the project code, the difference comparison results are generated, and the database table upgrade results are determined based on the results to improve the testing efficiency.
It realizes the rapid detection of database table upgrade results in the testing phase of code requirements, improves the testing efficiency of database table upgrades, and reduces the complexity of manual inspection.
Smart Images

Figure CN119861953A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of software testing, and in particular to a method, apparatus, computer equipment, computer-readable storage medium and computer program product for testing database table upgrades. Background Art
[0002] When developers develop a new version of the software based on product requirements, if the database table in the code is upgraded, the integrity and consistency of the data must be ensured when performing version data migration. If there is an upgrade anomaly in the database table, the data in the database table of the new version will be disordered and cause functional anomalies or program crashes. Currently, when developers or testers test the new version of the code, they mainly focus on the code logic related to product requirements. If the code is not carefully checked, it is difficult to find that the database table has been upgraded. In traditional technology, the test method for database table upgrades is mainly to manually install the old version, then install the new version to cover the old version, and perform test processes such as scenario verification, resulting in low test efficiency for database table upgrades. Summary of the invention
[0003] Based on this, it is necessary to provide a database table upgrade testing method, apparatus, computer equipment, computer-readable storage medium and computer program product that can improve the test efficiency of database table upgrade in order to solve the above technical problems.
[0004] In a first aspect, the present application provides a test method for upgrading a database table, comprising:
[0005] In the testing phase for code requirements, a first version of the project code and a second version of the project code are obtained; the second version of the project code is a project code obtained by upgrading the first version of the project code according to the code requirements;
[0006] Determine the database table type used by the first version project code and the second version project code;
[0007] Comparing the differences between the database tables corresponding to the database table type in the first version project code and the second version project code, respectively, to obtain a difference comparison result of the database table type matching;
[0008] According to the difference comparison result, a database table upgrade result of the second version project code is determined.
[0009] 2. In one embodiment, when the data update rule of the database table type is that the database table version number needs to be updated after a new database table field is added, the comparison of the differences between the database tables corresponding to the database table type in the first version project code and the second version project code to obtain the difference comparison result of the database table type matching includes:
[0010] Compare the database table fields respectively included in the first database table and the second database table to obtain a newly added field detection result; the first database table is a database table of the database table type described in the first version project code; the second database table is a database table of the database table type described in the second version project code;
[0011] The database table version numbers of the first database table and the second database table are compared to obtain a version number difference, and a difference comparison result of the database table type matching is generated according to the newly added field detection result and the version number difference.
[0012] In one embodiment, the version number difference is the difference between the database table version number of the second database table and the database table version number of the first database table, and determining the database table upgrade result of the second version project code according to the difference comparison result includes:
[0013] When the newly added field detection result indicates that the second database table has a newly added field and the version number difference is less than or equal to 0, it is determined that the database table upgrade result of the second version project code is that an exception occurs in the upgrade logic.
[0014] In one of the embodiments, when the data update rule of the database table type is that when a database table field is added, the newly added database table field must be located after the original database table field, the comparison of the differences between the database tables corresponding to the database table type in the first version project code and the second version project code to obtain the difference comparison result of the database table type matching includes:
[0015] Compare the database table fields respectively included in the first database table and the second database table to obtain a newly added field detection result; the first database table is a database table of the database table type described in the first version project code; the second database table is a database table of the database table type described in the second version project code;
[0016] According to the newly added field detection result, a difference comparison result of the database table type matching is generated.
[0017] In one embodiment, determining the database table upgrade result of the second version project code according to the difference comparison result includes:
[0018] When the newly added field detection result indicates that the second database table has a newly added misplaced field, determining that the database table upgrade result of the second version project code is that an abnormality occurs in the upgrade logic;
[0019] The newly added misplaced field is a newly added field located before the database table field included in the first database table.
[0020] In one embodiment, obtaining the first version project code and the second version project code includes:
[0021] In the case where the test phase is a system test phase, downloading the current required version project code and the previous required version project code, merging the previous required version project code into the current required version project code to obtain a merged version code;
[0022] The merged version code is used as the second version project code, and the last required version project code is used as the first version project code.
[0023] In one embodiment, after the step of determining the database table upgrade result of the second version project code according to the difference comparison result, the method further includes:
[0024] When the database table upgrade result of the second version project code is that an exception occurs in the upgrade logic, sending upgrade exception information to the code testing platform, so that the code testing platform generates an upgrade exception list according to the upgrade exception information;
[0025] And / or, when the database table upgrade result of the second version project code is an exception in the upgrade logic, a notification generation request is sent to the user terminal; the notification generation request is used to instruct the instant messaging software of the user terminal to display an upgrade exception notification in the conversation interface corresponding to the virtual object.
[0026] In a second aspect, the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0027] In a third aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.
[0028] In a fourth aspect, the present application also provides a computer program product, including a computer program, which implements the steps of the above method when executed by a processor.
[0029] The above-mentioned database table upgrade test method, device, computer equipment, computer-readable storage medium and computer program product, in the test phase for code requirements, obtain the first version project code and the second version project code, wherein the second version project code is the project code obtained by upgrading the first version project code according to the code requirements; determine the database table type adopted by the first version project code and the second version project code; compare the differences between the database tables corresponding to the database table types in the first version project code and the second version project code, respectively, to obtain a difference comparison result matching the database table type; determine the database table upgrade result of the second version project code according to the difference comparison result, and can determine the database table type adopted by the new and old versions of the project code in the test phase for code requirements, and perform difference comparison on the database tables of each database table type in the new and old versions of the project code, respectively, so as to quickly detect the difference comparison result that can automatically adapt to different database table types, and determine the database table upgrade result of the new version of the project code according to the difference comparison result, thereby improving the test efficiency of the database table upgrade. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0031] Figure 1 An application environment diagram of a test method for upgrading a database table in one embodiment;
[0032] Figure 2 A schematic diagram of a flow chart of a test method for upgrading a database table in one embodiment;
[0033] Figure 3 A flowchart of a test method for upgrading a database table in one embodiment;
[0034] Figure 4 A flowchart of another test method for upgrading a database table in one embodiment;
[0035] Figure 5 A test device for upgrading a database table in one embodiment;
[0036] Figure 6FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0037] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0038] The test method for database table upgrade provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. In the test phase for code requirements, the terminal 102 obtains the first version project code and the second version project code; the second version project code is the project code obtained by upgrading the first version project code according to the code requirements; the terminal 102 determines the database table type used by the first version project code and the second version project code; the terminal 102 compares the differences between the database tables corresponding to the database table types in the first version project code and the second version project code, respectively, and obtains the difference comparison result of the database table type matching; the terminal 102 determines the database table upgrade result of the second version project code according to the difference comparison result. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The head mounted device may be a virtual reality (VR) device, an augmented reality (AR) device, smart glasses, etc. The server 104 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0039] In an exemplary embodiment, Figure 2 As shown, a test method for upgrading a database table is provided, and the method is applied to Figure 1 The terminal 102 in FIG. 1 is used as an example for explanation, including:
[0040] Step S202: in the testing phase for code requirements, obtaining the first version of the project code and the second version of the project code.
[0041] Among them, code requirements can refer to the content that needs to be modified in the code in order to realize specific functions of the software during the development process, such as modifying the structure of the database table, etc. In actual applications, code requirements can be new functions added to the software according to product requirements during the development process, and developers can upgrade the project code based on code requirements.
[0042] During the testing phase for code requirements, the project code that has been upgraded according to the code requirements can be verified and tested to determine whether the project code upgrade is correct. This can further ensure the correctness of the database table upgrade, thereby effectively identifying upgrade anomalies such as field misalignment, omissions, and version number errors, ensuring data consistency and integrity, and avoiding software functional abnormalities caused by abnormal database table upgrades.
[0043] The second version project code is a project code obtained by upgrading the first version project code according to the code requirements.
[0044] The first version of the project code is the old version of the project code before the upgrade. The first version of the project code can be upgraded according to the code requirements to obtain a new version of the project code, that is, the second version of the project code. The second version of the project code may include code content that reflects the new functions of the software.
[0045] In a specific implementation, upgrading the first version of the project code may be to upgrade the database table in the first version of the project code. The database is an important component used to store and manage application data during development, and the database table is the basic structural unit for storing data in the database. A database table consists of rows and columns, each row represents a record, and each column represents a field. The database table may include four basic operations: inserting data, querying data, updating data, and deleting data. Upgrading a database table may refer to modifying the structure of an existing database table to adapt to new requirements or improve the design. Optionally, the way to upgrade a database table may include operations such as adding new columns, modifying existing columns, and deleting columns.
[0046] Step S204, determining the database table types used by the first version project code and the second version project code.
[0047] The database table type may refer to the type of database table included in the first version project code and the second version project code. The database table type may be the classification result of the database table according to classification rules such as data storage method, data reading and writing method, and data upgrade method.
[0048] For example, the database table type can be used to specify different data update rules, different field update orders, or different database table structure upgrade methods. For example, if the database table does not meet the upgrade method required by the database table type during the upgrade, it can be determined that the upgrade is abnormal. Therefore, determining the database table type helps to perform targeted difference detection later.
[0049] Step S206 , comparing the differences between the database tables corresponding to the database table types in the first version project code and the second version project code, and obtaining a difference comparison result of database table type matching.
[0050] In a specific implementation, when comparing the differences between the corresponding database tables in the first version of the project code and the second version of the project code, the database tables in the first version of the project code belong to the same database table type, so that the difference comparison between the database tables under the same database table type can be accurately performed, so that it is possible to determine whether the upgrade of the database table meets the requirements of the specific database table type based on the difference comparison results, making the difference comparison more efficient and accurate. For example, some database table types require that the database tables must follow the order of fields when upgrading, but some database table types do not require it. At this time, when performing the difference comparison, targeted verification and testing can be performed based on the characteristics of the database table type, so that the anomalies and errors in the database table upgrade can be quickly and accurately identified; and, it has strong versatility, and the database table upgrade test method is applicable to database tables of different database table types; and, the test has high accuracy, and can comprehensively judge the upgrade status of database tables of various database table types.
[0051] In a specific implementation, the differences between the database tables corresponding to the database table types in the first version project code and the second version project code are compared. The differences may be the addition, deletion, order change or version number modification of fields between the database tables, and a difference comparison result matching the database table types is generated.
[0052] The difference comparison result may be a comparative analysis result of the database tables in the first version of the project code and the second version of the project code in terms of fields, version numbers, field order, etc. For example, by comparing the field differences or version number differences between the database tables, detailed difference comparison results such as added fields, deleted fields, and misplaced fields may be generated to determine the database table upgrade result.
[0053] The difference comparison result matches the database table type, which means that the content contained in the difference comparison result can be used to verify whether the upgrade of the database table meets the requirements of the database table type. For example, if the data update rule of a certain database table type requires that the version number of the database table be updated when the database table is upgraded, then the difference comparison result must include the difference content of the version number; if the data update rule of a certain database table type does not require that the version number of the database table be updated when the database table is upgraded, then the difference comparison result may not include the difference content of the version number.
[0054] Step S208: Determine the database table upgrade result of the second version project code according to the difference comparison result.
[0055] In a specific implementation, the terminal can identify newly added fields, deleted fields, changes in field order, changes in field data types, etc. based on the field differences contained in the difference comparison results, so as to determine whether the fields are added correctly and whether they meet the code requirements; the terminal can also determine whether the version number has been correctly updated based on the version number differences contained in the difference comparison results, and determine the database table upgrade results of the second version project code based on the above judgment results.
[0056] The difference comparison result can be used to verify the correctness of the data table upgrade and generate the corresponding database table upgrade result. The database table upgrade result is used to indicate whether the second version project code has correctly upgraded the database table. Optionally, the database table upgrade result may include the results of the upgrade logic, the results of the data integrity verification, etc.
[0057] Exemplarily, assuming that the data update rule of the database table type is that after a new field is added to the database table, the version number of the database table needs to be updated, then the terminal can determine whether there is a new field in the second version project code based on the difference comparison result, and check whether the version number is updated. If the database table in the second version project code has a new field but the version number is not updated, it can be determined that the database table upgrade result is an upgrade exception.
[0058] In the above-mentioned test method for database table upgrade, in the test phase for code requirements, a first version project code and a second version project code are obtained, wherein the second version project code is a project code obtained by upgrading the first version project code according to the code requirements; the database table type adopted by the first version project code and the second version project code is determined; the differences between the database tables corresponding to the database table types in the first version project code and the second version project code are compared, and a difference comparison result matching the database table type is obtained; according to the difference comparison result, the database table upgrade result of the second version project code is determined, so that the database table types adopted by the new and old versions of the project code can be determined in the test phase for code requirements, and the database tables of each database table type are compared in the new and old versions of the project code, respectively, so as to quickly detect the difference comparison result that can automatically adapt to different database table types, and determine the database table upgrade result of the new version of the project code according to the difference comparison result, thereby improving the test efficiency of the database table upgrade.
[0059] In another embodiment, when the data update rule of the database table type is that the database table version number needs to be updated after a new database table field is added, the comparison of the differences between the database tables corresponding to the database table type in the first version project code and the second version project code, respectively, to obtain a difference comparison result of the database table type matching, includes: comparing the database table fields respectively contained in the first database table and the second database table to obtain a new field detection result; comparing the database table version numbers of the first database table and the second database table to obtain a version number difference, and generating a difference comparison result of the database table type matching based on the new field detection result and the version number difference.
[0060] The database table type can be used to specify data update rules, which means that during the upgrade process of the database table, the update of data needs to follow the rules matching the database table type.
[0061] The data update rule of the database table type is that after adding a new database table field, the database table version number needs to be updated. Among them, the database table field is a field in the database table, and a column in the database table can represent a field in the database table; the database table version number is the version number of the database table, which is a number that can be used to identify the database table structure version.
[0062] In actual applications, the database table of this database table type can read and write data from the database through a cursor, and the version number of the database table needs to be upgraded after adding a new field to the database table, but there is no requirement for the relative order of the fields. Optionally, in the database table of this database table type, the version number of the database table can be upgraded in the database class, or the version number of the database table can be upgraded in the entity class. Among them, the database class is a class used to manage and operate the database, the entity class is a class used to represent the database table structure, the attributes of the entity class correspond to the fields in the database table, and each instance represents a row in the database table.
[0063] The first database table is a database table of the database table type in the first version of the project code; the second database table is a database table of the database table type in the second version of the project code. The first database table and the second database table are database tables of the same database table type in the first version of the project code and the second version of the project code.
[0064] The terminal compares the database table fields respectively included in the first database table and the second database table, and can determine whether the second database table has a newly added database table field relative to the first database table, and obtain a newly added field detection result. The newly added field detection result can be used to indicate whether the second database table has a newly added database table field relative to the first database table. If so, the newly added field detection result also includes the newly added database table field.
[0065] The terminal compares the database table version numbers of the first database table and the second database table to obtain a version number difference. Optionally, the version number difference may be a difference between the version numbers, a ratio between the version numbers, an incremental type of the version number, a symbol mark difference of the version number, a level difference of the version number, etc. Since the database table type stipulates that when a new database table field is added, the database table version number needs to be updated, the version number difference can be used to check whether the version number is upgraded according to the data update rule of the database table type.
[0066] The terminal generates a difference comparison result of the database table type matching based on the new field detection result and the version number difference, and the difference comparison result may include the new field detection result and the version number difference, etc.; based on the difference comparison result, the database table upgrade result of the second version project code is determined, which can be to determine whether there is a new field in the second database table based on the new field detection result, and determine whether the version number of the second database table is updated based on the version number difference, so as to verify whether the upgrade of the database table complies with the data update rule, so as to obtain the database table upgrade result, thereby improving the testing efficiency of the database table upgrade.
[0067] Further, in one of the embodiments, the version number difference is the difference between the database table version number of the second database table and the database table version number of the first database table, and determining the database table upgrade result of the second version project code based on the difference comparison result includes: when the new field detection result indicates that there are new fields in the second database table, and the version number difference is less than or equal to 0, determining that the database table upgrade result of the second version project code is that an abnormality occurs in the upgrade logic.
[0068] The version number difference is the difference between the database table version number of the second database table and the database table version number of the first database table. Generally speaking, the value of the new database table version number is greater than the old database table version number. For example, if the database table version number of the second database table is 10 and the database table version number of the first database table is 9, the difference between the database table version numbers is 1.
[0069] If the second database table has a new field, it means that the second database table has a new database table field relative to the first database table. According to the data update rule of the database table type, the database table version number of the second database table should also be updated relative to the database table version number of the first database table, that is, the version number difference should be greater than 0. Therefore, when the new field detection result indicates that the second database table has a new field, and the version number difference is less than or equal to 0, it means that the data update rule of the database table type is not met, and it can be determined that the database table upgrade result of the second version project code is an exception in the upgrade logic.
[0070] The abnormality in the upgrade logic may refer to that the database table does not follow the predetermined rules during the upgrade process. For example, failure to follow the data update rules of the database table type may cause the abnormality in the upgrade logic.
[0071] Accordingly, when the new field detection result indicates that there are new fields in the second database table and the version number difference is greater than 0, it is determined that the database table upgrade result of the second version project code is that the upgrade logic is normal.
[0072] The technical solution of this embodiment determines whether the upgrade of the database table complies with the data update rules of the database table type through automated field difference comparison and version number difference comparison. It can quickly identify upgrade logic anomalies in the case where the version number is not updated after adding a new field, thereby reducing the complexity of manual inspection and improving the testing efficiency of database table upgrades.
[0073] For example, when the data update rule of the database table type is that the database table version number needs to be updated after a new database table field is added, the difference comparison result matching the database table type can be expressed as:
[0074] diff = {[class name A: version number difference, new field n, new field m, ...], [class name B: version number difference, new field o, new field p, ...], ..., [class name N: version number difference, new field x, new field y, ...]};
[0075] Among them, diff represents the difference comparison result; the class name is the name used to identify a class in the code, and the class is used to define a template for a group of objects with common characteristics and behaviors; the version number difference can be the difference between the database table version number of the second database table and the database table version number of the first database table; the newly added field is the newly added database table field in the second database table relative to the first database table.
[0076] In another embodiment, when the data update rule of the database table type is that when a new database table field is added, the new database table field must be located after the original database table field, the comparison of the differences between the database tables corresponding to the database table type in the first version project code and the second version project code, respectively, to obtain the difference comparison result of the database table type matching, includes: comparing the database table fields respectively contained in the first database table and the second database table to obtain the new field detection result; generating the difference comparison result of the database table type matching according to the new field detection result.
[0077] Among them, the first database table is a database table of the database table type in the first version of the project code; the second database table is a database table of the database table type in the second version of the project code.
[0078] The data update rule of the database table type is that when a new database table field is added, the new database table field must be located after the original database table field.
[0079] In actual applications, the database table of this database table type can be used to package the data in the database into a format that is easy to transmit for reading and writing data, and the newly added fields in the database table must be located after the original database table fields and cannot be inserted at any position, but there is no requirement to update the database table version number. In other words, the newly added fields in the second database table need to be after the original database table fields in the first database table.
[0080] Since the database table type specifies a strict field order but does not specify a requirement for version number update, when comparing the differences between the first database table and the second database table, only the database table fields contained in the first database table and the second database table need to be compared to obtain the newly added field detection result.
[0081] The terminal generates a difference comparison result of the database table type matching based on the new field detection result; determines the database table upgrade result of the second version project code based on the difference comparison result, which can be to determine whether there is a new field in the second database table based on the new field detection result, and judge whether the position of the new field complies with the data update rules to obtain the database table upgrade result, thereby improving the testing efficiency of the database table upgrade.
[0082] Furthermore, in one of the embodiments, based on the difference comparison result, determining the database table upgrade result of the second version project code includes: when the new field detection result indicates that there is a new misplaced field in the second database table, determining that the database table upgrade result of the second version project code is that an abnormality occurs in the upgrade logic; wherein the new misplaced field is a new field located before the database table field included in the first database table.
[0083] If there are new fields in the second database table, according to the data update rules of the database table type, the new fields in the second database table should be located after the database table fields included in the first database table. Therefore, if the new field detection result indicates that the new fields in the second database table are located before the database table fields included in the first database table, the new fields can be determined as new misplaced fields. In the case that there are new misplaced fields in the second database table, it means that the data update rules of the database table type are not met, and the database table upgrade result of the second version of the project code can be determined as an exception in the upgrade logic.
[0084] Accordingly, when the newly added field detection result indicates that there is no newly added misplaced field in the second database table, it is determined that the database table upgrade result of the second version project code is that the upgrade logic is normal.
[0085] The technical solution of this embodiment determines whether the upgrade of the database table complies with the data update rules of the database table type through automated field difference comparison. It can quickly identify upgrade logic anomalies when the newly added fields do not follow the field sequence rules, thereby reducing the complexity of manual inspection and improving the testing efficiency of database table upgrades.
[0086] For example, when the data update rule of the database table type is that when a new database table field is added, the new database table field must be located after the original database table field, the difference comparison result matching the database table type can be expressed as:
[0087] diff = {[class name A: new field n, new field m, ...], [class name B: new misplaced field o, new misplaced field p, ...], ..., [class name N: new field x, new misplaced field y, ...]};
[0088] Among them, diff represents the difference comparison result; the class name is the name used to identify a class in the code, and the class is used to define a template for a group of objects with common characteristics and behaviors; the newly added field is the newly added database table field that exists in the second database table relative to the first database table; the newly added misplaced field is the newly added field that is located before the database table field contained in the first database table.
[0089] In another embodiment, obtaining the first version project code and the second version project code includes: when the testing phase is a system testing phase, downloading the current requirement version project code and the previous requirement version project code, merging the previous requirement version project code into the current requirement version project code to obtain a merged version code; using the merged version code as the second version project code, and using the previous requirement version project code as the first version project code.
[0090] In a specific implementation, the testing phase for code requirements may include a functional testing phase and a system testing phase. In the process of upgrading the first version of the project code, the first version of the project code may be upgraded differently based on different code requirements, thereby obtaining multiple second version project codes.
[0091] The functional testing phase may be a phase in which each second version of the project code obtained by upgrading based on specific code requirements is tested separately to test whether a single newly added software function can work properly. For example, the version number of the first version of the project code is 9.0, and the version numbers of the two second versions of the project code are 9.1 and 9.2 respectively. Based on the above database table upgrade test method, the database table upgrade results of version 9.1 relative to version 9.0 and the database table upgrade results of version 9.2 relative to version 9.0 can be obtained respectively.
[0092] The system testing phase may be a phase for unified testing of multiple second version project codes to test whether each newly added software function can work together normally. The system testing phase is carried out in strict accordance with the order of the size of the version numbers. For example, the version number of the first version project code is 9.0, and the version numbers of the two second version project codes are 9.1 and 9.2 respectively. Based on the above database table upgrade test method, the database table upgrade result of version 9.1 relative to version 9.0 can be obtained first, and then the database table upgrade result of version 9.2 relative to version 9.1 can be obtained.
[0093] Among them, the current requirement version project code is the version project code upgraded based on the current code requirement, and the previous requirement version project code is the version project code upgraded based on the previous code requirement. The version number of the current requirement version project code is greater than the version number of the previous requirement version project code. For example, the version number of the current requirement version project code is 9.2, and the version number of the previous requirement version project code is 9.1. In addition, the current requirement version project code and the previous requirement version project code can be project codes upgraded on the basis of the same project code based on different code requirements. For example, the current requirement version project code (version 9.2) and the previous requirement version project code (version 9.1) are both project codes upgraded on the basis of the 9.0 version project code.
[0094] Since the system testing phase needs to test whether the new functions corresponding to each code requirement can work together, it is necessary to merge the previous requirement version project code into the current requirement version project code to obtain a merged version code. The merged version code includes both the code upgrade content corresponding to the previous code requirement and the code upgrade content corresponding to the current code requirement. The merged version code is used as the second version project code, and the previous requirement version project code is used as the first version project code. The database table upgrade result of the second version project code can be obtained by comparing the differences, so as to test whether the new functions corresponding to each code requirement can work together as a whole. Whether in the functional testing phase or in the system testing phase, the testing efficiency of the database table upgrade can be improved.
[0095] For example, assume that the current requirement version project code (version 9.2) and the previous requirement version project code (version 9.1) are both upgraded project codes based on version 9.0 project code, the project code of version 9.0 is A, the project code of version 9.1 is A+a (a is the code upgrade content corresponding to the previous code requirement), and the project code of version 9.2 is A+b (b is the code upgrade content corresponding to the current code requirement). In the system testing phase, it is necessary to first obtain the database table upgrade result of version 9.1 relative to version 9.0 based on the above-mentioned database table upgrade test method, and then merge the project code of version 9.1 into the project code of version 9.2. The merged version code obtained is version "9.2+". The project code of version "9.2+" is A+a+b. The project code of version "9.2+" is used as the second version project code, and the project code of version 9.1 is used as the first version project code. The database table upgrade result of version "9.2+" relative to version 9.1 is obtained based on the above-mentioned database table upgrade test method.
[0096] The technical solution of this embodiment can perform overall testing on the project code obtained based on the upgrade of each code requirement during the system testing phase, so as to efficiently test whether the new functions corresponding to each code requirement can work together, thereby improving the testing efficiency of the database table upgrade.
[0097] In another embodiment, in the testing phase for code requirements, when the testing phase is a functional testing phase, a first version project code and a second version project code are obtained; the second version project code is the project code obtained by upgrading the first version project code according to the code requirements; the database table types adopted by the first version project code and the second version project code are determined; the differences between the database tables corresponding to the database table types in the first version project code and the second version project code are compared to obtain a difference comparison result of the database table type matching; based on the difference comparison result, the database table upgrade result of the second version project code is determined.
[0098] It should be noted that the specific limitations of the above steps can refer to the specific limitations of a test method for upgrading a database table mentioned above.
[0099] In another embodiment, in the testing phase for code requirements, when the testing phase is a system testing phase, the current requirement version project code and the previous requirement version project code are downloaded, and the previous requirement version project code is merged into the current requirement version project code to obtain a merged version code; the merged version code is used as the second version project code, and the previous requirement version project code is used as the first version project code; the second version project code is the project code obtained by upgrading the first version project code according to the code requirements; the database table type used by the first version project code and the second version project code is determined; the differences between the database tables corresponding to the database table types in the first version project code and the second version project code are compared to obtain a difference comparison result of the database table type matching; based on the difference comparison result, the database table upgrade result of the second version project code is determined.
[0100] It should be noted that the specific limitations of the above steps can refer to the specific limitations of a test method for upgrading a database table mentioned above.
[0101] In another embodiment, after the step of determining the database table upgrade result of the second version project code based on the difference comparison result, it also includes: when the database table upgrade result of the second version project code is an exception in the upgrade logic, sending upgrade exception information to the code testing platform, so that the code testing platform generates an upgrade exception list according to the upgrade exception information; and / or, when the database table upgrade result of the second version project code is an exception in the upgrade logic, sending a notification generation request to the user terminal; the notification generation request is used to instruct the instant messaging software of the user terminal to display an upgrade exception notification in the session interface corresponding to the virtual object.
[0102] Among them, the upgrade exception information can be detailed information generated when an exception occurs in the database table upgrade logic. These detailed information may include specific circumstances that do not comply with expected rules during the upgrade process, such as failure to update the version number after adding a new field, incorrect field order, etc.
[0103] Among them, the code testing platform can be a platform for agile collaboration and software development management. The code testing platform can also be used to obtain code requirements and manage software testing processes.
[0104] In actual applications, the code testing platform generates an upgrade exception list based on the upgrade exception information. The upgrade exception list may include a list of exception problems and record detailed information of all upgrade logic exceptions, which helps testers and developers to centrally view all upgrade exceptions, track and fix problems, and improve the efficiency of handling database table upgrade exceptions.
[0105] When the database table upgrade result of the second version project code is an exception in the upgrade logic, a notification generation request can also be sent to the user terminal (mobile phone, computer, etc.) of the tester or developer. The notification generation request is used to instruct the instant messaging software of the user terminal to display an upgrade exception notification in the conversation interface corresponding to the virtual object.
[0106] Exemplarily, the conversation interface corresponding to the virtual object in the instant messaging software may be a chat window associated with the virtual object in the instant messaging software, such as a chat window corresponding to a robot (such as an intelligent customer service, etc.). The instant messaging software of the user terminal generates a request based on the notification to display an upgrade exception notification in the conversation interface corresponding to the virtual object, which can remind the tester or developer to pay attention to the upgrade exception problem in a timely manner.
[0107] The technical solution of this embodiment can quickly notify relevant personnel, generate an exception list, and push exception notifications in an automated manner when an exception occurs in the database table upgrade logic, thereby realizing automated database table upgrade exception detection and notification, reducing the workload of manual troubleshooting of the upgrade logic, and improving the reliability and efficiency of the database table upgrade.
[0108] To facilitate the understanding of those skilled in the art, Figure 3 A flowchart of a test method for upgrading a database table is provided exemplarily. It can be seen that the version cycle of a version of a project code may include a development phase, a functional testing phase, and a system testing phase. In the functional testing phase, the download of the first version of the project code and the second version of the project code can be automatically triggered, and then the newly added field detection results of the database table of the second version of the project code relative to the first version of the project code and the version number difference of the corresponding database table are generated, and then it is determined whether the upgrade method of the corresponding database table is correct. If an exception occurs in the upgrade, an upgrade exception message is generated to the code testing platform, and the tester is notified through the instant messaging software of the user terminal. In the system testing phase, the upgrade of the database table is tested again, which can not only find out whether there are upgrade problems between the code upgrade contents based on different code requirements in the same version of the project code, but also find out the upgrade problems of the database tables of the same database table type between different versions.
[0109] The embodiment of the present application can accurately determine the upgrade status and upgrade risks of all database tables, and advance the problem discovery stage from the operation stage to the coding stage, effectively reducing the crash problem caused by abnormal database table upgrade after the software is launched; the test method for database table upgrade based on the automated process is short in time, can detect the submitted new version of the project code at any time, and has high efficiency in database table upgrade testing; moreover, the test process of the above-mentioned database table upgrade can be automatically triggered in the functional testing stage and the system testing stage, and timely feedback and notification can be given when there is an upgrade abnormality, which greatly improves the test efficiency of the database table upgrade compared to the manual verification method; and the database table upgrade test method is highly versatile and can be applicable to database tables of different database table types.
[0110] To facilitate the understanding of those skilled in the art, Figure 4 A flowchart of another database table upgrade test method is provided exemplarily. Specifically, in the test phase for code requirements, the first version project code and the second version project code are downloaded, and the database table types used by the first version project code and the second version project code are determined.
[0111] Compare the differences between the corresponding database tables of the first database table type in the first version project code and the second version project code, and obtain the difference comparison result of the first database table type matching. The data update rule of the first database table type is that after adding a new database table field, the database table version number needs to be updated; when it is determined according to the difference comparison result that the second database table has a new field and the version number difference is less than or equal to 0, it is determined that the upgrade result of the database table of the second version project code is that the upgrade logic is abnormal; otherwise, it is determined that the upgrade result of the database table of the second version project code is that the upgrade is successful.
[0112] At the same time, the differences between the corresponding database tables of the second database table type in the first version project code and the second version project code are compared to obtain the difference comparison result of the second database table type matching. The data update rule of the second database table type is that when a new database table field is added, the new database table field must be located after the original database table field; when it is determined according to the difference comparison result that the second database table has a new misplaced field, the upgrade result of the database table of the second version project code is determined to be an abnormality in the upgrade logic; otherwise, the upgrade result of the database table of the second version project code is determined to be a successful upgrade.
[0113] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0114] Based on the same inventive concept, the embodiment of the present application also provides a test device for database table upgrade for implementing the test method for database table upgrade involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of one or more test devices for database table upgrade provided below can refer to the limitations of the test method for database table upgrade above, and will not be repeated here.
[0115] In an exemplary embodiment, Figure 5 As shown, a test device for upgrading a database table is provided, comprising:
[0116] The acquisition module 510 is used to acquire the first version project code and the second version project code in the testing phase for the code requirements; the second version project code is the project code obtained by upgrading the first version project code according to the code requirements.
[0117] The type determination module 520 is used to determine the database table type used by the first version project code and the second version project code.
[0118] The difference comparison module 530 is used to compare the differences between the database tables corresponding to the database table type in the first version project code and the second version project code, respectively, to obtain a difference comparison result of matching the database table types.
[0119] The upgrade verification module 540 is used to determine the database table upgrade result of the second version project code according to the difference comparison result.
[0120] In one of the embodiments, when the data update rule of the database table type is that the database table version number needs to be updated after a new database table field is added, the difference comparison module 530 is specifically used to compare the database table fields respectively contained in the first database table and the second database table to obtain the new field detection result; the first database table is a database table of the database table type in the first version project code; the second database table is a database table of the database table type in the second version project code; the database table version numbers of the first database table and the second database table are compared to obtain the version number difference, and the difference comparison result of the database table type matching is generated according to the new field detection result and the version number difference.
[0121] In one embodiment, the version number difference is the difference between the database table version number of the second database table and the database table version number of the first database table, and the upgrade verification module 540 is specifically used to determine that the database table upgrade result of the second version project code is an exception in the upgrade logic when the new field detection result indicates that the second database table has a new field and the version number difference is less than or equal to 0.
[0122] In one of the embodiments, when the data update rule of the database table type is that when a new database table field is added, the new database table field must be located after the original database table field, the difference comparison module 530 is specifically used to compare the database table fields respectively contained in the first database table and the second database table to obtain the new field detection result; the first database table is a database table of the database table type in the first version project code; the second database table is a database table of the database table type in the second version project code; based on the new field detection result, the difference comparison result of the database table type matching is generated.
[0123] In one embodiment, the upgrade verification module 540 is specifically used to determine that the database table upgrade result of the second version project code is an exception in the upgrade logic when the new field detection result indicates that the second database table has a new misplaced field; wherein the new misplaced field is a new field located before the database table field included in the first database table.
[0124] In one embodiment, the acquisition module 510 is specifically used to download the current requirement version project code and the previous requirement version project code when the test phase is a system test phase, merge the previous requirement version project code into the current requirement version project code to obtain a merged version code; use the merged version code as the second version project code, and use the previous requirement version project code as the first version project code.
[0125] In one embodiment, the test device for upgrading the database table also includes a sending module, which is specifically used to send upgrade exception information to the code testing platform when the upgrade result of the database table of the second version project code is an exception in the upgrade logic, so that the code testing platform generates an upgrade exception list according to the upgrade exception information; and / or, when the upgrade result of the database table of the second version project code is an exception in the upgrade logic, send a notification generation request to the user terminal; the notification generation request is used to instruct the instant messaging software of the user terminal to display an upgrade exception notification in the session interface corresponding to the virtual object.
[0126] Each module in the above-mentioned database table upgrade test device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each of the above modules.
[0127] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 6 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be realized through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a test method for upgrading a database table is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0128] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0129] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0130] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0131] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0132] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0133] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0134] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0135] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A test method for upgrading a database table, characterized in that: The method comprises: In the testing phase for code requirements, a first version of the project code and a second version of the project code are obtained; the second version of the project code is a project code obtained by upgrading the first version of the project code according to the code requirements; Determine the database table type used by the first version project code and the second version project code; Comparing the differences between the database tables corresponding to the database table type in the first version project code and the second version project code, respectively, to obtain a difference comparison result of the database table type matching; According to the difference comparison result, a database table upgrade result of the second version project code is determined.
2. The method according to claim 1, characterized in that In the case where the data update rule of the database table type is that the database table version number needs to be updated after a database table field is added, the comparison of the differences between the database tables corresponding to the database table type in the first version project code and the second version project code, respectively, to obtain the difference comparison result of the database table type matching includes: Compare the database table fields respectively included in the first database table and the second database table to obtain a newly added field detection result; the first database table is a database table of the database table type described in the first version project code; the second database table is a database table of the database table type described in the second version project code; The database table version numbers of the first database table and the second database table are compared to obtain a version number difference, and a difference comparison result of the database table type matching is generated according to the newly added field detection result and the version number difference.
3. The method according to claim 2, characterized in that The version number difference is the difference between the database table version number of the second database table and the database table version number of the first database table, and determining the database table upgrade result of the second version project code according to the difference comparison result includes: When the newly added field detection result indicates that the second database table has a newly added field and the version number difference is less than or equal to 0, it is determined that the database table upgrade result of the second version project code is that an exception occurs in the upgrade logic.
4. The method according to claim 1, characterized in that: In the case where the data update rule of the database table type is that when a database table field is added, the newly added database table field must be located after the original database table field, the comparison of the differences between the database tables corresponding to the database table type in the first version project code and the second version project code, respectively, to obtain the difference comparison result of the database table type matching includes: Compare the database table fields respectively included in the first database table and the second database table to obtain a newly added field detection result; the first database table is a database table of the database table type described in the first version project code; the second database table is a database table of the database table type described in the second version project code; According to the newly added field detection result, a difference comparison result of the database table type matching is generated.
5. The method according to claim 4, characterized in that Determining the database table upgrade result of the second version project code according to the difference comparison result includes: When the newly added field detection result indicates that the second database table has a newly added misplaced field, determining that the database table upgrade result of the second version project code is that an abnormality occurs in the upgrade logic; The newly added misplaced field is a newly added field located before the database table field included in the first database table.
6. The method according to claim 1, characterized in that The obtaining of the first version project code and the second version project code comprises: In the case where the test phase is a system test phase, downloading the current required version project code and the previous required version project code, merging the previous required version project code into the current required version project code to obtain a merged version code; The merged version code is used as the second version project code, and the last required version project code is used as the first version project code.
7. The method according to claim 1, characterized in that After the step of determining the database table upgrade result of the second version project code according to the difference comparison result, the method further includes: When the database table upgrade result of the second version project code is that an exception occurs in the upgrade logic, sending upgrade exception information to the code testing platform, so that the code testing platform generates an upgrade exception list according to the upgrade exception information; And / or, when the database table upgrade result of the second version project code is an exception in the upgrade logic, a notification generation request is sent to the user terminal; the notification generation request is used to instruct the instant messaging software of the user terminal to display an upgrade exception notification in the conversation interface corresponding to the virtual object.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
9. A 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 method according to any one of claims 1 to 7 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.