CN117951000A - Information generation method, device, electronic equipment and storage medium - Google Patents

Information generation method, device, electronic equipment and storage medium Download PDF

Info

Publication number
CN117951000A
CN117951000A CN202311801192.1A CN202311801192A CN117951000A CN 117951000 A CN117951000 A CN 117951000A CN 202311801192 A CN202311801192 A CN 202311801192A CN 117951000 A CN117951000 A CN 117951000A
Authority
CN
China
Prior art keywords
database
change
target
field
assertion
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311801192.1A
Other languages
Chinese (zh)
Inventor
魏雪风
马颖
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mashang Xiaofei Finance Co Ltd
Original Assignee
Mashang Xiaofei Finance Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Mashang Xiaofei Finance Co Ltd filed Critical Mashang Xiaofei Finance Co Ltd
Priority to CN202311801192.1A priority Critical patent/CN117951000A/en
Publication of CN117951000A publication Critical patent/CN117951000A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the application provides an information generation method, an information generation device, electronic equipment and a storage medium, wherein an application function execution record of a target function test event is obtained from an application log of a target application; based on the application function execution record, acquiring a corresponding database change record from a database log of the target database; generating database assertion information of the target functional test event based on the database change record; by means of the application log and the database log, the application function execution record is acquired from the application log, then the database change record which is related to the application function execution record is acquired from the database log, the database change record is analyzed, the database assertion is automatically generated, the specific change content of the database caused by the target function test event can be more rapidly and accurately acquired, and the error change of the database field can be timely found, so that the change rationality of the database field caused by the application function execution is ensured.

Description

Information generation method, device, electronic equipment and storage medium
Technical Field
The present application relates to the field of testing technologies, and in particular, to an information generating method, an information generating device, an electronic device, and a storage medium.
Background
At present, with the advent of the internet era, the internet has been widely used in daily study, work and life of people. Various daily transactions for people can be handled and presented through the internet. Meanwhile, with the rapid development of the mobile internet, each internet service provider provides a corresponding service for a user by developing respective application programs, and the user can install the corresponding application programs, such as a game application, a video application, a chat application, a shopping application, a payment application, and the like, in the smart phone according to respective actual demands. However, the target application needs to test the function of the target application before providing the user with the preset business service, and in order to ensure the accuracy of the database change caused by the execution of the application function, the function test process of the target application needs to verify the change content of the database.
Disclosure of Invention
The embodiment of the application aims to provide an information generation method, an information generation device, electronic equipment and a storage medium, which can be used for obtaining the specific change content of a database caused by a target function test event more quickly and accurately and finding out the wrong change of a database field in time so as to ensure the reasonability of the change of the database caused by the execution of an application function.
In order to realize the technical scheme, the embodiment of the application is realized as follows:
In a first aspect, an embodiment of the present application provides an information generating method, where the method includes:
acquiring an application function execution record of a target function test event from an application log of a target application;
Based on the application function execution record, acquiring a database change record corresponding to the target function test event from a database log of a target database;
Generating database assertion information corresponding to the target function test event based on the database change record; the database assertion information is used to characterize database field change content caused by the target functional test event.
In a second aspect, an embodiment of the present application provides an information generating apparatus, including:
The first acquisition module is used for acquiring an application function execution record of a target function test event from an application log of a target application;
The second acquisition module is used for acquiring a database change record corresponding to the target function test event from a database log of the target database based on the application function execution record;
The assertion generating module is used for generating database assertion information corresponding to the target function test event based on the database change record; the database assertion information is used to characterize database field change content caused by the target functional test event.
In a third aspect, an embodiment of the present application provides an electronic device, including:
A processor; and a memory arranged to store computer executable instructions configured to be executed by the processor, the executable instructions comprising steps for performing the method as described in the first aspect.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium, where the storage medium is used to store computer-executable instructions, where the executable instructions cause a computer to perform the steps in the method as described in the first aspect.
It can be seen that, in the embodiment of the present application, the database change record corresponding to the target function test event is obtained through the application log of the target application and the database log of the target database, and the database change record is analyzed, so that the database assertion related to the target function test event is automatically generated, and the database assertion is obtained by analyzing the real database change record, so that the specific change content of the database can be reflected by the database assertion, and thus, the specific change content of the database caused by the target function test event can be more intuitively and accurately known, and the error change of the database field can be quickly found, so that the purpose of checking the database change content is achieved, and the accuracy of the database change caused by the execution of the application function is ensured, and the rationality of the database change caused by the execution of the application function is ensured; the application log is monitored preferentially, and an application function execution record of a target function test event in the application log is obtained; and then, each information item in the application function execution record is used as a screening basis of a database log, and a database change record which is associated with the application function execution record in the database log is obtained, so that the database change record caused by the target function test event can be obtained in a targeted and rapid manner, and the generation efficiency of database assertion is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions of the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments described in one or more of the present application, and that other drawings may be obtained according to these drawings without inventive effort to a person skilled in the art.
Fig. 1 is a flow chart of an information generating method according to an embodiment of the present application;
fig. 2 is a schematic diagram of a first implementation principle of an information generating method according to an embodiment of the present application;
Fig. 3 is a schematic diagram of a second implementation principle of the information generating method according to the embodiment of the present application;
FIG. 4a is a schematic diagram of a tree structure of a similarity table used in a process of determining a similarity change field in the information generating method according to the embodiment of the present application;
Fig. 4b is a schematic diagram of a similar field tree structure used in a process of determining a similar change field in the information generating method according to the embodiment of the present application;
Fig. 5 is a schematic diagram of a third implementation principle of the information generating method according to the embodiment of the present application;
fig. 6 is a schematic diagram of module composition of an information generating apparatus according to an embodiment of the present application;
Fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order that those skilled in the art will better understand the technical solutions of one or more embodiments of the present application, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments, not all embodiments, of one or more embodiments of the present application. All other embodiments, which can be made by one or more embodiments of the application without inventive faculty, are intended to be within the scope of the application.
It should be noted that, without conflict, one or more embodiments of the present application and features of the embodiments may be combined with each other. Embodiments of the present application will be described in detail below with reference to the accompanying drawings in conjunction with the embodiments.
One or more embodiments of the present application provide an information generating method, apparatus, electronic device, and storage medium, which take into account that if a database assertion is written manually by a tester in advance, then constraint is applied to the execution process of a target function test event based on the database assertion (for example, if an erroneous change of a database field is detected, execution of the target function test event is automatically terminated or a prompt message for the erroneous change is automatically sent out), so that there is a problem that writing efficiency of the database assertion is low and accuracy is low; in addition, if database assertions are manually written for the case of a large number of database fields, there is a problem that the comprehensiveness of the written database assertions cannot be ensured; based on the problems, according to the technical scheme, the database change records corresponding to the target function test event are obtained by means of the application log of the target application to be tested and the database log of the target database, the database change records are analyzed, and the database assertion related to the target function test event is automatically generated, and because the database assertion is obtained by analyzing the real database change records, the database assertion can reflect the specific change content of the database, so that the specific change content of the database caused by the target function test event can be more intuitively and accurately obtained, the error change of a database field can be quickly found, the purpose of checking the database change content is achieved, the accuracy of the database change caused by the application function execution is ensured, and the rationality of the database change caused by the application function execution is further ensured; the application log is monitored preferentially, and an application function execution record of a target function test event in the application log is obtained; then, each information item in the application function execution record is used as a screening basis of a database log, and a database change record which has relevance with the application function execution record in the database log is obtained, so that the database change record caused by a target function test event can be obtained in a targeted and rapid manner, and the generation efficiency of database assertion is improved; in addition, after the database change records containing the target change fields are screened out based on the information items in the application function execution records, the similar change fields of the target change fields can be further screened out to generate database assertions of the similar change fields, so that the comprehensiveness of the automatically generated database assertions is improved, the specific change content of the database is more comprehensively checked, and the conditions of missed change and wrong change of the similar change fields are timely found out.
Fig. 1 is a schematic flow diagram of a first method for generating information according to one or more embodiments of the present application, where the method in fig. 1 can be performed by an electronic device, and the electronic device may be a terminal device or a designated server; as shown in fig. 1, the method at least comprises the following steps:
S102, acquiring an application function execution record of the target function test event from an application log of the target application.
The target application may be an application program to be tested for a function, for example, a function test is performed on a newly developed application program, for example, a function upgrade or optimization application program is tested, for example, a function operation test is performed on the target application periodically; the application log is a log file generated in the running process of the target application; the target function test event may be an event for testing a preset function (such as a message sending function and a change message notifier function) of the target application, each target function test event corresponds to an interface test case, the interface test case is executed to trigger the test event for executing the preset function of the target application, and the test process of the preset function of the target application generates at least one application function execution record, so that the at least one application function execution record of the target function test event can be obtained from an application log of the target application; the application function execution record may include at least one of a first record time, a first database identifier (identifier of a target database changed by a target function test event), a first database table identifier (identifier of a target change table changed by the target function test event), and an application function operation field (a first field operated by the target function test event, such as a user name field and a Message field).
S104, based on the application function execution record, acquiring a database change record corresponding to the target function test event from a database log of the target database.
The database log is a log file generated by changing the database during the execution of the target functional test event, for example, a binlog log file, and the database log may include at least one of a second record time, a second database identifier (identifier of the target database changed by the target functional test event), a second database table identifier (identifier of the target change table changed by the target functional test event), and a database field (second field changed by the target functional test event, such as a user name field userAccount and a Message field Message).
Because for a certain target function test event, the first record time and the second record time are corresponding, if the difference value of the first record time and the second record time is smaller than a preset threshold value, the first database identifier and the second database identifier are identical, and therefore, information items (such as the first record time, the first database identifier and the first database identifier) in the application function execution record and information items (such as the second record time, the second database identifier and the second database table identifier) in the database change record are correspondingly matched, and a plurality of alternative change records are determined from the database log based on a matching result; and the naming rule of the second field and the first field have a certain relevance, so that the similarity of the field names of the second field changed by the target function test event and the first field operated by the target function test event is higher, and therefore, the target change record (namely, the database change record corresponding to the target function test event) containing the second field corresponding to the first field can be determined by calculating the similarity of the field names of the first field and the second field.
S106, generating database assertion information corresponding to the target function test event based on the database change record; the database assertion information is used to characterize the contents of database field changes caused by the target functional test event.
After determining a database change record corresponding to the target function test event, a second database identifier in the database change record is the identifier of the target database, a second database table identifier in the database change record is the identifier of the target change table, a database field in the database change record is the target change field, and database assertion information corresponding to the target function test event is generated based on at least one of the field value and the field type of the target change field; the database assertion information may include description information about the change condition of the target change field; the database assertion information can characterize the change content of the database field caused by the target function test event, so that a tester can verify the specific change content of the database by combining with the database assertion information, and error change of the database field can be found out quickly.
According to the embodiment of the application, the database change record corresponding to the target function test event is obtained by means of the application log of the target application to be tested and the database log of the target database, and the database change record is analyzed, so that the database assertion related to the target function test event is automatically generated; the application log is monitored preferentially, and an application function execution record of a target function test event in the application log is obtained; and then, each information item in the application function execution record is used as a screening basis of a database log, and a database change record which is associated with the application function execution record in the database log is obtained, so that the database change record caused by the target function test event can be obtained in a targeted and rapid manner, and the generation efficiency of database assertion is improved.
In a specific embodiment, taking a change message notifier function of the test target application as an example; as shown in fig. 2, a specific implementation process of an information generating method is provided, which mainly includes:
calling an interface test case of a target function test event to trigger a change message of an execution target application to notify a test event of a human function;
Monitoring an application log of a target application, and acquiring an application function execution record of a target function test event from the application log of the target application;
Monitoring a database log of a target database, matching a plurality of information items in the application function execution record with corresponding information items in field change records in the database log, and acquiring a target change record (namely, a database change record corresponding to a target function test event) from the database log based on a matching result;
and generating database assertion information corresponding to the target function test event based on the target change field in the target change record.
In the generating process of the database assertion information, the step S106 of generating the database assertion information corresponding to the target functional test event based on the database change record specifically includes:
a1, determining a target change table and a target change field of a target function test event based on the database change record; the target change field is a database field changed during the execution of the target function test event, and the target change table is a database table containing the target change field.
In some example embodiments, the target change table is determined based on a second database table identification in the database change record corresponding to the target functional test event, i.e., the database table corresponding to the second database table identification is determined as the target change table, and the database field in the database change record corresponding to the target functional test event is determined as the target change field.
And step A2, generating database assertion information corresponding to the target function test event based on the target change table and the target change field.
In some example embodiments, the database assertion information corresponding to the target functional test event includes only database assertion information corresponding to the target change field; specifically, based on at least one of a field value and a field type of a target change field, database assertion information corresponding to a target function test event is generated; the database assertion information includes description information about the change condition of the target change field; in other example embodiments, the database assertion information corresponding to the target functional test event includes not only database assertion information corresponding to the target change field, but also database assertion information corresponding to a similar change field of the target change field; specifically, based on at least one of a field value and a field type of a target change field, database assertion information corresponding to a target function test event is generated, and based on at least one of a field value and a field type of a similar change field of the target change field, database assertion information corresponding to the target function test event is generated; the database assertion information includes description information about the change condition of the target change field, and description information about the change condition of the similar change field of the target change field.
Wherein, the database assertion information corresponding to the target function test event includes not only database assertion information corresponding to the target change field, but also database assertion information corresponding to a similar change field of the target change field, and the step A2 of generating database assertion information corresponding to the target function test event based on the target change table and the target change field specifically includes:
step A21, determining similar change fields in a preset database table based on the target change table and the target change fields; the preset database table comprises a plurality of database fields, and the similar change field is a database field similar to the field name of the target change field in the plurality of database fields contained in the preset database table.
The preset database table can be a database table under a target database or a database table under a non-target database; in some example embodiments, the field name similarity of the target change field and each database field in the preset database table may be directly calculated, and based on the field name similarity, a similar change field of the target change field is determined from a plurality of database fields in the preset database table, that is, the name similarity of the target change field and all database fields in the preset database table is directly matched, and the similar change field is screened out; however, in order to improve the efficiency and accuracy of determining the similar change fields, the similar change table may be determined from a plurality of preset database tables based on the target change table, and then the similar change fields of the target change field are determined from the similar change table, that is, only the name similarity of the target change field and the database fields in the similar change table is matched, and the similar change fields are screened out.
Step A22, generating a first database assertion based on the target change field; wherein the first database predicate includes descriptive information about a change condition of the target change field.
Step A23, generating a second database assertion based on the similar change fields; wherein the second database assertion includes descriptive information about the change instances of the similar change fields.
And step A24, based on the first database assertion and the second database assertion, generating database assertion information corresponding to the target function test event.
The database assertion information comprises a first database assertion corresponding to a target change field and a second database assertion corresponding to a similar change field of the target change field; the target change field is obtained by matching a plurality of information items (such as log record time, database identification and database table identification) in the log record, and belongs to the database field which has been changed and is queried based on the application function execution record, so that whether the database field has error change can be judged based on the first database assertion corresponding to the target change field; the similar change field is obtained by performing field name similarity matching based on the target change field, and belongs to a database field which is not changed or a database field which is not queried based on the application function execution record (for example, the obtained database table identification of the database corresponding to the target function test event is incomplete due to incomplete identification of the change database table contained in the application function execution record, and thus incomplete determination of the target change field is caused), so that whether the database field which is not changed is subjected to missed change can be determined based on second database assertion corresponding to the similar change field, and whether the database field which is changed but is queried based on the application function execution record is subjected to false change can be determined, thereby improving the comprehensiveness of database field change verification for the target function test event.
In the embodiment of the application, after the database change records containing the target change fields are screened based on the information items in the application function execution records, the similar change fields of the target change fields can be further screened to generate the database assertion of the similar change fields, so that the comprehensiveness of the automatically generated database assertion is improved, the verification of the specific change content of the database is realized more comprehensively, and the conditions of missed change and wrong change of the similar change fields are found in time.
In one embodiment, the change message notifier function of the test target application is taken as an example; on the basis of the above fig. 2, as shown in fig. 3, a specific implementation process of an information generating method is provided, which mainly includes:
calling an interface test case of a target function test event to trigger a change message of an execution target application to notify a test event of a human function;
Monitoring an application log of a target application, and acquiring an application function execution record of a target function test event from the application log of the target application;
Monitoring a database log of a target database, matching a plurality of information items in the application function execution record with corresponding information items in field change records in the database log, and acquiring a target change record (namely, a database change record corresponding to a target function test event) from the database log based on a matching result;
determining similar change fields in a preset database table based on the target change fields in the target change record;
Generating a first database assertion based on the target change field; and generating a second database assertion based on the similar change field;
and generating database assertion information corresponding to the target function test event based on the first database assertion and the second database assertion.
Wherein, for the process of determining the similar change fields of the target change field, the step a21 determines the similar change fields in the preset database table based on the target change table and the target change field, and specifically includes:
Step A211, determining a similar change table from a plurality of preset database tables based on the target change table; the similar change table is a database table similar to the attribute information of the target change table in a plurality of preset database tables.
In some example embodiments, table name similarity of the target change table and the preset database table may be directly calculated, and a similar change table of the target change table is determined from the preset database table based on the table name similarity; however, in order to improve accuracy of determining the similar change table, in other exemplary embodiments, instead of performing similarity matching directly on table names of the database tables, first attribute information of the target change table and second attribute information of the preset database table are acquired, attribute correlation degrees of the first attribute information and the second attribute information are calculated, and the similar change table of the target change table is determined from the preset database table based on the attribute correlation degrees; the attribute information of the database table may include at least one of a table name, an application name of an associated application of the database table, and a function name of an associated application function of the database table, where the associated application of the database table refers to an application program that causes a change of the database table, and the associated application function of the database table refers to a service function of the application program that causes a change of the database table.
Step A212, based on the target change field, determining a similar change field in the similar change table; specifically, for each similar change table, a similar change field of the target change field is determined based on the field name similarity of the target change field and the database field in the similar change table.
In the embodiment of the application, a certain correspondence relationship exists between the application function and the database tables is considered, so that even if two irrelevant database tables (for example, database tables related to different application functions) contain similar change fields of the target change field, the similar change fields are not used as fields needing to be changed, therefore, the similar change table of the target change table can be positioned first, and then the similar change fields of the target change field can be determined from the similar change table, instead of directly matching the similar change fields from all database tables, thus not only improving the determination efficiency of the similar change fields, but also ensuring that the similar change fields are determined in a targeted manner, and further improving the accuracy of the similar change fields.
It will be appreciated that for the determination of similar change fields for a target change field, in some example embodiments, the field name similarity of the target change field to a database field in the similar change table may be calculated in real-time, and the similar change field may be determined based on the name similarity; however, to further improve the efficiency of determining similar change fields of the target change field, in other exemplary embodiments, a field name similarity between database fields in two preset database tables may be pre-calculated, and a similar field tree structure may be constructed based on the field name similarity, where the similar field tree structure includes a root node, a primary child node, a secondary child node, and a tertiary child node (i.e., leaf node), the root node corresponds to the target database, and the primary child node of the root node corresponds to a database table, i.e., a branch node of the root node (i.e., primary child node) characterizes a certain database table; the secondary child nodes of the root node correspond to database fields in the database table, namely, the branch node (namely, the secondary child node) of each primary child node represents the database fields in the database table, and the branch node of each primary child node is determined based on the database fields contained in the database table; the tertiary child nodes of the root node correspond to similar fields of the database fields characterized by the secondary child nodes, i.e., the branch nodes of each secondary child node (i.e., the tertiary child nodes) characterize similar fields of the database fields, and the branch nodes of each secondary child node are determined based on field name similarities between the database fields.
In addition, because the determining process of the similar change field of the target change field needs to determine a similar change table, for the determining process of the similar change table, similarly, attribute correlation degrees of two preset database tables are calculated in advance, and a similar table tree structure is constructed based on the attribute correlation degrees, wherein the similar table tree structure comprises a root node, a first-level child node and a second-level child node (namely leaf nodes), the root node corresponds to the target database, the first-level child node of the root node corresponds to the database table, namely a branch node (namely first-level child node) of the root node represents a certain database table; the secondary child nodes of the root node correspond to the similarity tables of the database tables represented by the primary child nodes, namely, the branch nodes (namely, the secondary child nodes) of each primary child node represent the similarity tables of the database tables, and the branch nodes of each primary child node are determined based on the attribute correlation degree among the database tables.
After a similar table tree structure and a similar field tree structure are pre-built, in the process of determining the similar change field of the target change field, determining a similar change table of the target change table from a plurality of preset database tables directly based on the similar table tree structure; specifically, based on the tree structure of the similar table, determining a target child node (namely a first-level child node of the root node) where the target change table is located, and determining a database table represented by a branch node (namely a second-level child node of the root node) under the first-level child node as the similar change table of the target change table; determining similar change fields from the similar change table based on the similar field tree structure; specifically, considering that the branch node under the secondary child node where the target change field is located includes similar change fields in all preset database tables (i.e., includes not only similar change fields in the similar change table but also similar change fields in the dissimilar change table), the target child node (i.e., the primary child node of the root node) where the similar change table is located is determined based on the tree structure of the similar fields; determining leaf nodes (namely three-level child nodes of the root node) used for representing the target change field under the target child node; the database field characterized by the parent node of the leaf node (i.e., the secondary child node of the root node) is determined to be a similar change field to the target change field.
That is, the similarity change table is determined based on a pre-constructed similarity table tree structure, which is pre-constructed based on the degree of attribute correlation between the pre-set database tables; the similarity change field is determined based on a pre-constructed similarity field tree structure, and the similarity field tree structure is pre-constructed based on the similarity of field names between database fields in two preset database tables.
Illustratively, as shown in fig. 4a and 4b, taking as an example the database table 1, the database table 2, the database table 3 and the database table 4, wherein the database table 1 comprises a database field 11, a database field 12 and a database field 13, the database table 2 comprises a database field 21, a database field 22 and a database field 23, the database table 3 comprises a database field 31, a database field 32 and a database field 33, the database table 4 comprises a database field 41, a database field 42 and a database field 43, the first-level sub-node in the similar table tree structure comprises the sub-nodes for characterizing the database table 1, the database table 2, the database table 3 and the database table 4, and the second-level sub-node in the similar table tree structure comprises the similar tables of the database tables, wherein the branch node of the first-level sub-node where the database table 1 is located comprises the database table 2 and the database table 4; the first level sub-nodes in the similar field tree structure comprise sub-nodes for representing database table 1, database table 2, database table 3 and database table 4, the second level sub-nodes in the similar field tree structure comprise sub-nodes for representing database field 11, database field 12, database field 13, database field 21, database field 22, database field 23, database field 31, database field 32, database field 33, database field 41, database field 42 and database field 43, and the third level sub-nodes in the similar field tree structure comprise similar fields of all the database fields, wherein the branch nodes of the second level sub-nodes where the database field 11 is located comprise database field 23, database field 1 and database field 42.
If the target change table is database table 1 and the target change field is database field 11, it can be known that the similar change table of the target change table includes: database table 2 and database table 4; based on the similar field tree structure in fig. 4b, it can be seen that the similar change fields of the database field 11 in the database table 2 are: database field 23, similar change fields to database field 11 in database table 4 are: database field 42, and thus, similar change fields to the target change field described above include database field 23 and database field 42; because the branch node of the secondary child node where the database field 11 is located includes not only the similar fields (such as the database field 23 and the database field 42) in the similar change table, but also the similar fields (such as the database field 31) in the dissimilar change table, the database field corresponding to the branch node of the secondary child node where the database field 11 is located is not directly determined as the similar change field, but the parent node of the tertiary child node characterizing the data field 11 under the similar change table is determined as the similar change field.
It should be noted that, for simplicity of illustration, only a portion of the three-level sub-nodes, for example, three-level sub-nodes related to the database field 11, are illustrated in fig. 4b, and another portion of the three-level sub-nodes are not illustrated in fig. 4 b.
Wherein, for the generating process of the database assertion related to the target change field, the step a22 generates the first database assertion based on the target change field, which specifically includes:
step A221, based on the field value of the target change field, generating a first database sub-assertion about the field value change description of the target change field.
Step a222, based on the field type of the target change field, generates a second database sub-predicate concerning a field type change specification of the target change field.
Step A223, generating a first database assertion based on at least one of the first database sub-assertion and the second database sub-assertion; the first database predicate includes predicate information about a field value change specification of a target change field, and/or predicate information about a field type change specification of the target change field.
Wherein, for the generation process of the database assertion related to the similar change field, the step a23 generates the second database assertion based on the similar change field, which specifically includes:
Step A231, based on the field value of the similar change field, generating a third database sub-assertion about the field value change description of the similar change field.
Step A232, based on the field types of the similar change fields, generating a fourth database sub-assertion about the field type change description of the similar change fields.
Step A233, generating a second database assertion based on at least one of the third database sub-assertion and the fourth database sub-assertion; the second database assertion is used as a database recommendation assertion to be verified and confirmed; the second database assertions may include assertions information about field value change descriptions of similar change fields, and/or assertions information about field type change descriptions of similar change fields.
Considering that the similar change field of the determined target change field can be a database field which is not changed, the user can be guided to check whether the similar change field has a condition of missing change or not by automatically generating database assertion information of the database field and recommending the database assertion information to the user, for example, the similar field which needs to be changed is not changed; and considering that the similar change field of the determined target change field can also be a changed database field which is not queried based on the application function execution record (for example, the obtained change database table identification contained in the application function execution record is incomplete, so that the determined database change record corresponding to the target function test event is incomplete, and the target change field is determined to be incomplete), the database assertion information of the database field is automatically generated, and the database assertion information is recommended to the user, so that the database assertion information displayed to the user is more comprehensive, and the user can be guided to verify whether the similar change field has the wrong change, for example, the similar field which does not need to be changed is changed.
Wherein, for the determining process of the database change record corresponding to the target function test event, the application function execution record may include: the database association information and application function operation field can include at least one of log record time, database identification and database table identification; based on this, S104, based on the application function execution record, a database change record corresponding to the target function test event is obtained from a database log of the target database, and specifically includes:
And step B1, acquiring a plurality of alternative change records from a database log of the target database based on the database association information.
Because there are interrelated information items (for example, record time, database identifier, database table identifier) between the application log and the database log, the database association information in the application function execution record and the corresponding information items of the change record in the database log can be matched first, so as to obtain a first matching result, and a plurality of alternative change records in the database log are selected based on the first matching result.
For the determination of multiple alternative change records, in some example embodiments, a first record time in the application function execution record is first matched with a second record time in the database change record, and the database change record with the second record time matched with the first record time is determined as a first screening change record; then, matching a first database identifier in the application function execution record with a second database identifier in the first screening change record, and determining the first screening change record matched with the second database identifier as a second screening change record; then, matching a first database table identifier in the application function execution record with a second database table identifier in a second screening change record, and determining the second screening change record matched with the first database table identifier as an alternative change record; in other exemplary embodiments, the database identifier and the database table identifier may be matched first, and then the recording time may be matched.
And step B2, performing field name similarity matching based on the application function operation field, and determining a database change record corresponding to the target function test event from a plurality of alternative change records.
After screening a plurality of alternative change records, matching an application function operation field in the application function execution record with a change field of a change record in a database log to obtain a second matching result, and selecting a target change record in the plurality of alternative change records based on the second matching result; in some example embodiments, a field name similarity of an application function operation field in the application function execution record and a database field in the alternative change record is determined; determining a database change record corresponding to the target function test event from a plurality of alternative change records based on the field name similarity; specifically, the alternative change record with the field name similarity larger than the preset threshold value is determined as the target change record (namely, the database change record corresponding to the target function test event).
In one embodiment, the change message notifier function of the test target application is taken as an example; on the basis of the above fig. 3, fig. 4a and fig. 4b, as shown in fig. 5, a specific implementation process of an information generating method is provided, which mainly includes:
calling an interface test case of a target function test event to trigger a change message of an execution target application to notify a test event of a human function;
Monitoring an application log of a target application, and acquiring an application function execution record of a target function test event from the application log of the target application;
Monitoring a database log of a target database, matching a plurality of information items in the application function execution record with corresponding information items in field change records in the database log, and acquiring a target change record (namely, a database change record corresponding to a target function test event) from the database log based on a matching result;
determining a similar change table of the target change table based on a pre-constructed similar table tree structure and the target change table in the target change record;
Determining a similar change field of the target change field based on a pre-constructed similar field tree structure, the similar change table and the target change field in the target change record;
Generating a first database assertion based on the target change field; and generating a second database assertion based on the similar change field;
and generating database assertion information corresponding to the target function test event based on the first database assertion and the second database assertion.
According to the information generation method, the database change records corresponding to the target function test event are obtained through the application log of the target application to be tested and the database log of the target database, the database change records are analyzed, the database assertion related to the target function test event is automatically generated, and the database assertion is obtained through analyzing the real database change records, so that the specific change content of the database can be reflected, the specific change content of the database caused by the target function test event can be obtained more intuitively and accurately, the error change of a database field can be found rapidly, the purpose of checking the database change content is achieved, the accuracy of the database change caused by the application function execution is ensured, and the rationality of the database change caused by the application function execution is further ensured; the application log is monitored preferentially, and an application function execution record of a target function test event in the application log is obtained; and then, each information item in the application function execution record is used as a screening basis of a database log, and a database change record which is associated with the application function execution record in the database log is obtained, so that the database change record caused by the target function test event can be obtained in a targeted and rapid manner, and the generation efficiency of database assertion is improved.
Corresponding to the information generating method described in fig. 1 to 5, based on the same technical concept, an embodiment of the present application further provides an information generating apparatus, and fig. 6 is a schematic block diagram of the information generating apparatus provided in the embodiment of the present application, where the apparatus is configured to execute the information generating method described in fig. 1 to 5, and as shown in fig. 6, the apparatus includes:
a first obtaining module 602, configured to obtain an application function execution record of a target function test event from an application log of a target application;
a second obtaining module 604, configured to obtain, based on the application function execution record, a database change record corresponding to the target function test event from a database log of a target database;
An assertion generating module 606, configured to generate database assertion information corresponding to the target functional test event based on the database change record; the database assertion information is used to characterize database field change content caused by the target functional test event.
According to the information generating device, the database change records corresponding to the target function test event are obtained through the application log of the target application to be tested and the database log of the target database, the database change records are analyzed, and the database assertion related to the target function test event is automatically generated; the application log is monitored preferentially, and an application function execution record of a target function test event in the application log is obtained; and then, each information item in the application function execution record is used as a screening basis of a database log, and a database change record which is associated with the application function execution record in the database log is obtained, so that the database change record caused by the target function test event can be obtained in a targeted and rapid manner, and the generation efficiency of database assertion is improved.
It should be noted that, the embodiment of the information generating apparatus according to the present application and the embodiment of the information generating method according to the present application are based on the same inventive concept, so that the specific implementation of this embodiment may refer to the implementation of the corresponding information generating method, and the repetition is not repeated.
Further, corresponding to the methods shown in fig. 1 to 5, based on the same technical concept, the embodiment of the present application further provides an electronic device, where the device is configured to perform the information generating method as shown in fig. 7.
The electronic device may vary considerably in configuration or performance and may include one or more processors 701 and memory 702, where the memory 702 may store one or more stored applications or data. Wherein the memory 702 may be transient storage or persistent storage. The application programs stored in the memory 702 may include one or more modules (not shown), each of which may include a series of computer-executable instructions for use in an electronic device. Still further, the processor 701 may be arranged to communicate with the memory 702 and execute a series of computer executable instructions in the memory 702 on an electronic device. The electronic device may also include one or more power supplies 703, one or more wired or wireless network interfaces 704, one or more input/output interfaces 705, one or more keyboards 706, and the like.
In one particular embodiment, an electronic device includes a memory, and one or more programs, where the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer-executable instructions for the electronic device, and execution of the one or more programs by one or more processors includes instructions for:
acquiring an application function execution record of a target function test event from an application log of a target application;
Based on the application function execution record, acquiring a database change record corresponding to the target function test event from a database log of a target database;
Generating database assertion information corresponding to the target function test event based on the database change record; the database assertion information is used to characterize database field change content caused by the target functional test event.
According to the electronic equipment provided by the embodiment of the application, the database change record corresponding to the target function test event is obtained by means of the application log of the target application to be tested and the database log of the target database, and the database change record is analyzed, so that the database assertion related to the target function test event is automatically generated; the application log is monitored preferentially, and an application function execution record of a target function test event in the application log is obtained; and then, each information item in the application function execution record is used as a screening basis of a database log, and a database change record which is associated with the application function execution record in the database log is obtained, so that the database change record caused by the target function test event can be obtained in a targeted and rapid manner, and the generation efficiency of database assertion is improved.
It should be noted that, the embodiment of the present application related to the electronic device and the embodiment of the present application related to the information generating method are based on the same inventive concept, so the specific implementation of this embodiment may refer to the implementation of the corresponding information generating method, and the repetition is not repeated.
Further, corresponding to the methods shown in fig. 1 to 5, based on the same technical concept, the embodiments of the present application further provide a computer readable storage medium, which is used to store computer executable instructions, in a specific embodiment, the storage medium may be a U disc, an optical disc, a hard disk, etc., where the computer executable instructions stored in the storage medium can implement the following flow when executed by a processor:
acquiring an application function execution record of a target function test event from an application log of a target application;
Based on the application function execution record, acquiring a database change record corresponding to the target function test event from a database log of a target database;
Generating database assertion information corresponding to the target function test event based on the database change record; the database assertion information is used to characterize database field change content caused by the target functional test event.
When the computer executable instructions stored in the storage medium in the embodiment of the application are executed by a processor, the database change records corresponding to the target function test event are obtained by means of the application log of the target application to be tested and the database log of the target database, and are analyzed, the database assertion related to the target function test event is automatically generated, and the database assertion is obtained by analyzing the real database change records, so that the specific change content of the database can be reflected by the database assertion, the specific change content of the database caused by the target function test event can be more intuitively and accurately obtained, the error change of a database field can be quickly found, the purpose of checking the database change content is achieved, the accuracy of the database change caused by the application function execution is ensured, and the rationality of the database change caused by the application function execution is further ensured; the application log is monitored preferentially, and an application function execution record of a target function test event in the application log is obtained; and then, each information item in the application function execution record is used as a screening basis of a database log, and a database change record which is associated with the application function execution record in the database log is obtained, so that the database change record caused by the target function test event can be obtained in a targeted and rapid manner, and the generation efficiency of database assertion is improved.
It should be noted that, the embodiment of the storage medium in the present application and the embodiment of the information generating method in the present application are based on the same inventive concept, so the specific implementation of this embodiment may refer to the implementation of the corresponding information generating method, and the repetition is not repeated.
The foregoing describes certain embodiments of the present application. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, embodiments of the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-readable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks. These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory. The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media. Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Disks (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium for storing information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises the element.
Embodiments of the application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. One or more embodiments of the application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices. The embodiments of the present application are described in a progressive manner, and the same and similar parts of the embodiments are all referred to each other, and each embodiment is mainly described in the differences from the other embodiments. In particular, for system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, as relevant to see a section of the description of method embodiments.
The foregoing description is by way of example only and is not intended to limit the present disclosure. Various modifications and changes may occur to those skilled in the art. Any modifications, equivalent substitutions, improvements, etc. that fall within the spirit and principles of the present document are intended to be included within the scope of the claims of the present document.

Claims (10)

1. An information generation method, the method comprising:
acquiring an application function execution record of a target function test event from an application log of a target application;
Based on the application function execution record, acquiring a database change record corresponding to the target function test event from a database log of a target database;
Generating database assertion information corresponding to the target function test event based on the database change record; the database assertion information is used to characterize database field change content caused by the target functional test event.
2. The method of claim 1, wherein generating database assertion information corresponding to the target functional test event based on the database change record comprises:
Determining a target change table and a target change field based on the database change record; the target change field is a database field changed in the execution process of the target function test event, and the target change table is a database table containing the target change field;
and generating database assertion information corresponding to the target function test event based on the target change table and the target change field.
3. The method of claim 2, wherein generating database assertion information corresponding to the target functional test event based on the target change table and the target change field comprises:
Determining similar change fields in a preset database table based on the target change table and the target change field; the preset database table comprises a plurality of database fields, and the similar change field is a database field similar to the field name of the target change field in the plurality of database fields;
generating a first database assertion based on the target change field;
Generating a second database assertion based on the similar change fields;
And generating database assertion information corresponding to the target functional test event based on the first database assertion and the second database assertion.
4. The method of claim 3, wherein the determining similar change fields in a preset database table based on the target change table and the target change field comprises:
Determining a similar change table from a plurality of preset database tables based on the target change table; the similar change table is a database table similar to the attribute information of the target change table in the plurality of preset database tables;
and determining a similar change field in the similar change table based on the target change field.
5. The method of claim 3, wherein generating a first database predicate based on the target change field comprises:
Generating a first database sub-predicate on a field value change specification of the target change field based on a field value of the target change field;
Generating a second database sub-predicate on a field type change specification of the target change field based on a field type of the target change field;
a first database assertion is generated based on at least one of the first database sub-assertion and the second database sub-assertion.
6. The method of claim 3, wherein the generating a second database predicate based on the similar change field comprises:
Generating a third database sub-predicate on a field value change specification of the similar change field based on the field value of the similar change field;
Generating a fourth database sub-predicate on a field type change specification of the similar change field based on a field type of the similar change field;
A second database assertion is generated based on at least one of the third database sub-assertion and the fourth database sub-assertion.
7. The method of claim 1, wherein the application function execution record comprises: database association information and application function operation fields, wherein the database association information comprises at least one of log record time, database identification and database table identification;
The obtaining, based on the application function execution record, a database change record corresponding to the target function test event from a database log of a target database includes:
Based on the database association information, acquiring a plurality of alternative change records from a database log of a target database;
And performing field name similarity matching based on the application function operation field, and determining a database change record corresponding to the target function test event from the plurality of alternative change records.
8. An information generating apparatus, characterized in that the apparatus comprises:
The first acquisition module is used for acquiring an application function execution record of a target function test event from an application log of a target application;
The second acquisition module is used for acquiring a database change record corresponding to the target function test event from a database log of the target database based on the application function execution record;
The assertion generating module is used for generating database assertion information corresponding to the target function test event based on the database change record; the database assertion information is used to characterize database field change content caused by the target functional test event.
9. An electronic device, the device comprising:
A processor; and
A memory arranged to store computer executable instructions configured to be executed by the processor, the executable instructions comprising steps for performing the method of any of claims 1 to 7.
10. A computer-readable storage medium storing computer-executable instructions for causing a computer to perform the method of any one of claims 1 to 7.
CN202311801192.1A 2023-12-25 2023-12-25 Information generation method, device, electronic equipment and storage medium Pending CN117951000A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311801192.1A CN117951000A (en) 2023-12-25 2023-12-25 Information generation method, device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311801192.1A CN117951000A (en) 2023-12-25 2023-12-25 Information generation method, device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117951000A true CN117951000A (en) 2024-04-30

Family

ID=90802802

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311801192.1A Pending CN117951000A (en) 2023-12-25 2023-12-25 Information generation method, device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117951000A (en)

Similar Documents

Publication Publication Date Title
CN106897334B (en) Question pushing method and equipment
CN106656536B (en) Method and equipment for processing service calling information
US9483387B1 (en) Tree comparison functionality for services
JP2019517040A (en) Cloud platform based client application information statistics method and apparatus
US10713152B2 (en) Automated path generator for optimized application testing
CN103544220A (en) Method and device for recommending applications
CN111224923B (en) Detection method, device and system for counterfeit websites
CN109344046B (en) Data processing method, device, medium and electronic equipment
CN114116496A (en) Automatic testing method, device, equipment and medium
CN110941632A (en) Database auditing method, device and equipment
CN110334012B (en) Risk assessment method and device
CN113626558B (en) Intelligent recommendation-based field standardization method and system
CN110716912B (en) SQL performance detection method and server
CN113221036B (en) Method and device for processing electronic bill mail
CN107784043B (en) Monitoring method, device and system for data table of data warehouse
CN111435327B (en) Log record processing method, device and system
CN117951000A (en) Information generation method, device, electronic equipment and storage medium
CN113031995B (en) Rule updating method and device, storage medium and electronic equipment
CN114490413A (en) Test data preparation method and device, storage medium and electronic equipment
CN110134583B (en) Software testing and data processing method and device
CN113448985A (en) API (application program interface) interface generation method, calling method and device and electronic equipment
CN113037521A (en) Method for identifying state of communication equipment, communication system and storage medium
CN113886132B (en) Intelligent web-side error repairing method and device and computer-readable storage medium
CN116661758B (en) Method, device, electronic equipment and medium for optimizing log framework configuration
CN114338494B (en) Service dependency topological relation obtaining method and device, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination