CN115774672A - Test case generation method, test case generation device, server and storage medium - Google Patents

Test case generation method, test case generation device, server and storage medium Download PDF

Info

Publication number
CN115774672A
CN115774672A CN202211545515.0A CN202211545515A CN115774672A CN 115774672 A CN115774672 A CN 115774672A CN 202211545515 A CN202211545515 A CN 202211545515A CN 115774672 A CN115774672 A CN 115774672A
Authority
CN
China
Prior art keywords
case
data
test cases
attribute information
initial test
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
CN202211545515.0A
Other languages
Chinese (zh)
Inventor
林解元
暨光耀
黎观平
胡俊秀
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202211545515.0A priority Critical patent/CN115774672A/en
Publication of CN115774672A publication Critical patent/CN115774672A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The present application relates to a test case generation method, a test case generation device, a server, a storage medium, and a computer program product. The method comprises the following steps: acquiring predefined N data objects contained in batch files aiming at the batch files containing financial service data to be processed; acquiring N first example templates matched with the structural attribute information corresponding to the N data objects from a database; assigning the structural attribute information of the N data objects matched with the N first case templates based on the assignment types of the L1 branch nodes to generate P1 initial test cases for each data object; the initial test cases comprise valid initial test cases and invalid initial test cases; and packaging the initial test cases of the data objects to generate the test cases corresponding to the N data objects contained in the batch file. By adopting the method, the generation efficiency of the test case can be improved, and the coverage rate of the test case can be improved.

Description

Test case generation method, test case generation device, server and storage medium
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a method, an apparatus, a server, a storage medium, and a computer program product for generating a test case.
Background
With the continuous development of financial industry science and technology, the program function of using in the financial industry can change by work such as marketing, wind control that traditional modes such as expert's rule, business experience carried out, very big promotion the application accuracy. At present, the updating and optimization of the program functions applied in the financial industry mainly tests the application program through a packaged test case, so as to find out the defects and the optimization direction of the program functions.
Generally, one method for testing an application program is that a developer writes a test code manually and then runs the test code to determine the correctness of the code, but the method is purely dependent on the quality of the developer, has no normalization, is difficult to count and is difficult to evaluate the quality of the test code; the other method is to write test cases by means of a test case library, developers can write own test case codes according to the test case library, so that the development efficiency is improved, but the method needs to be developed manually by the developers to adapt to corresponding application programs, and some test events are easy to miss, so that the test cases are not completely covered.
Disclosure of Invention
In view of the above, it is necessary to provide a test case generation method, a test case generation apparatus, a server, a storage medium, and a computer program product, which can improve the test case coverage.
In a first aspect, the present application provides a method for generating a test case, where the method includes:
acquiring predefined N data objects contained in batch files containing financial service data to be processed; the data object is used for representing a data structure of the financial service data, and the data structure carries corresponding M1 kinds of structure attribute information;
acquiring N first example templates matched with the structural attribute information corresponding to the N data objects from a database; the N first example templates are sample test cases obtained based on L1 branch node assignments in a first decision tree, and each branch node is matched with at least one type of structure attribute information;
assigning the structural attribute information of the N data objects matched with the N first case templates based on the assignment types of the L1 branch nodes to generate P1 initial test cases for each data object; the initial test case comprises a valid initial test case and an invalid initial test case;
and packaging the initial test case of each data object to generate test cases corresponding to the N data objects contained in the batch file.
In one embodiment, the first case templates carry at least part of the structure attribute information, and the structure attribute information carried by each first case template is matched with a corresponding data object;
the assigning the structure attribute information of the N data objects matched with the N first example templates based on the assignment types of the L1 branch nodes includes:
determining assignment types of L2 branch nodes corresponding to each first example template; the assignment type comprises a filling data type, a function assignment type and a random access type, and L1 is greater than L2;
assigning the structural attribute information of the data objects respectively matched with each first case template according to the assignment types of the L2 branch nodes and a preset case generation rule;
the case generation rule includes presetting the number of test cases to be generated corresponding to the N data objects and case coverage frequency.
In one embodiment, the structure attribute information carried by the data structure includes a data type, a data length, an input type, an option type, and a data dictionary type;
after the generating P1 initial test cases for each of the data objects, further comprising:
identifying that the P1 initial test cases are P2 effective initial test cases and P3 ineffective initial test cases based on the assignment of the structural attribute information corresponding to each initial test case; p1 is equal to the sum of P2 and P3;
and aggregating the P2 effective initial test cases into a first type case set, and aggregating the P3 ineffective initial test cases into a second type case set.
In one embodiment, each of the initial test cases carries usage information and a text description;
the packaging the initial test cases of the data objects to generate the test cases corresponding to the N data objects contained in the batch file includes:
performing matrix filling processing on the P2 initial test cases in the first class case set based on the number and the coverage frequency of each initial test case corresponding to the N data objects, and the utilization rate information and the Chinese description carried by the P2 initial test cases in the first class case set to obtain P4 effective sub-class test cases after processing; the matrix filling processing is used for merging the initial test cases in the first type case set, the first type case set is a set formed by effective initial test cases, and P2 is larger than P4; and
based on the number and the coverage frequency of each initial test case corresponding to the N data objects, and the utilization rate information and the Chinese description carried by the P3 initial test cases in the second type case set, performing matrix filling processing on the P3 initial test cases in the second type case set to obtain processed P5 invalid sub-type test cases; the matrix filling processing is used for merging the initial test cases in the second type case set, the second type case set is a set formed by invalid initial test cases, and P3 is larger than P5;
and packaging the P4 effective subclass test cases and the P5 ineffective subclass test cases to generate a first class test case corresponding to the N data objects contained in the batch file.
In one embodiment, the method further comprises:
acquiring preset R second example templates; the second example template is sample service data which is obtained based on assignment of S branch nodes in a second decision tree and corresponds to the financial service data, and the sample service data carries M2 service attribute information;
based on the association degree between the structural attribute information carried by the N data objects and the service attribute information carried by the R second case templates, deleting at least part of the initial test cases corresponding to the data objects;
and packaging the rest initial test cases of the N data objects to generate a second type of test case corresponding to the N data objects contained in the batch file.
In one embodiment, the deleting, based on the degree of association between the structure attribute information carried by the N data objects and the service attribute information carried by the R second case templates, at least part of the initial test cases corresponding to each data object includes:
based on the structural attribute information corresponding to the N data objects and the service attribute information corresponding to the R second example templates, performing fuzzy matching on each data object and each second example template respectively, and determining the association degree between each data object and each second example template;
respectively taking the second use case template with the maximum corresponding association degree with each data object as an associated use case template of the corresponding data object;
determining whether there is an opposite characteristic between the structure attribute information carried by each initial test case corresponding to each data object and the service attribute information carried by the corresponding associated case template;
and deleting the initial test case corresponding to the anisotropic characteristic.
In one embodiment, the method further comprises:
in the second type test case of the N data objects, determining effective structure attribute information in the remaining initial test cases corresponding to each data object based on the effectiveness of assignment of the structure attribute information; and
determining effective service attribute information in the R second example templates based on the effectiveness of the attribute values of the M2 service attribute information carried in the sample service data;
determining the association degree between the effective structure attribute information corresponding to each initial test case and the effective service attribute information corresponding to each second case template;
and merging and recombining the initial test cases with the correlation degree larger than or equal to a first threshold value and the corresponding sample service data to generate a third type of test cases corresponding to the N data objects contained in the batch file.
In one embodiment, the method further comprises:
determining effective service attribute information in the R second example templates based on the effectiveness of the attribute values of the service attribute information;
determining the degree of association between the corresponding effective service attribute information among the second example templates;
and merging and recombining the second example templates with the association degree larger than or equal to a second threshold value to obtain a new second example template.
In a second aspect, the application further provides a device for generating a test case. The device comprises:
the system comprises a first acquisition unit, a second acquisition unit and a third acquisition unit, wherein the first acquisition unit is configured to execute acquisition of predefined N data objects contained in a batch file containing financial service data to be processed; the data object is used for representing a data structure of the financial service data, and the data structure carries corresponding M1 kinds of structure attribute information;
a second obtaining unit configured to perform obtaining, from a database, a plurality of first case templates that match the structure attribute information corresponding to the N data objects; the N first example templates are sample test cases obtained based on L1 branch node assignments in a first decision tree, and each branch node is matched with at least one type of structure attribute information;
the data assignment unit is configured to perform assignment on the basis of assignment types of the L1 branch nodes, assign the structural attribute information of the N data objects matched with the N first case templates, and generate P1 initial test cases for each data object; the initial test case comprises a valid initial test case and an invalid initial test case;
and the case packaging unit is configured to perform packaging of the initial test case of each data object, and generate the test cases corresponding to the N data objects contained in the batch file.
In a third aspect, the application also provides a server. The server includes:
a processor;
a memory for storing executable instructions of the processor;
wherein the processor is configured to execute the executable instructions to implement the test case generation method as described above.
In a fourth aspect, the present application further provides a computer-readable storage medium. The computer readable storage medium includes program data therein, which when executed by a processor of a server, enables the server to execute the method for generating test cases as described above.
In a fifth aspect, the present application further provides a computer program product. The computer program product includes program instructions, and the program instructions, when executed by a processor of a server, enable the server to execute the test case generation method described above.
Firstly, aiming at a batch file to be processed and containing financial business data, acquiring predefined N data objects contained in the batch file; the data object is used for representing a data structure of financial service data, and the data structure carries corresponding M1 kinds of structure attribute information; then, acquiring N first example templates matched with the structure attribute information corresponding to the N data objects from the database; the N first example templates are sample test cases obtained based on L1 branch node assignments in the first decision tree, and each branch node is matched with at least one type of structure attribute information; then, based on the assignment types of the L1 branch nodes, assigning the structural attribute information of the N data objects matched with the N first case templates to generate P1 initial test cases for each data object; the initial test cases comprise effective initial test cases and ineffective initial test cases; and finally, packaging the initial test cases of the data objects to generate the test cases corresponding to the N data objects contained in the batch file. Therefore, on one hand, the test cases corresponding to the batch files are generated by utilizing the predefined N data objects and the corresponding case templates contained in the batch files, so that the generation efficiency of the test cases can be improved, the generation flow of the test cases can be optimized, and the labor and time cost can be saved; on the other hand, the structural attribute information of the data object is assigned through the assignment types of the branch nodes corresponding to the N first example templates to generate an initial test case for each data object, so that the coverage rate of the test cases can be improved, test events are prevented from being omitted, and the accuracy and reliability of a subsequent test flow are improved.
Drawings
FIG. 1 is a diagram illustrating an application environment for a method for test case generation in accordance with an illustrative embodiment;
FIG. 2 is a flowchart illustrating a first test case generation method according to an exemplary embodiment;
FIG. 3 is a block diagram illustrating one type of generating initial test cases in accordance with an illustrative embodiment;
FIG. 4 is a flow diagram illustrating the assignment of structural attribute information in accordance with an exemplary embodiment;
FIG. 5 is a flowchart illustrating an aggregation of initial test cases in accordance with an illustrative embodiment;
FIG. 6 is a flowchart illustrating packaging of test cases in accordance with an illustrative embodiment;
FIG. 7 is a flowchart illustrating a second test case generation method according to an example embodiment;
FIG. 8 is a block diagram illustrating a deletion of an initial test case in accordance with an illustrative embodiment;
FIG. 9 is a flowchart illustrating deletion of test cases in accordance with an illustrative embodiment;
FIG. 10 is a flowchart illustrating a third method for generating test cases according to an example embodiment;
FIG. 11 is a flowchart illustrating an update to a use case template in accordance with an illustrative embodiment;
FIG. 12 is a block diagram illustrating an apparatus for generating test cases in accordance with an illustrative embodiment;
FIG. 13 is a block diagram illustrating a server for a test case generation apparatus in accordance with an illustrative embodiment;
FIG. 14 is a block diagram illustrating a computer-readable storage medium for a test case generation apparatus in accordance with an illustrative embodiment;
FIG. 15 is a block diagram illustrating a computer program product for a test case generation apparatus in accordance with one illustrative embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The term "and/or" in embodiments of the present application refers to any and all possible combinations including one or more of the associated listed items. It is also to be noted that: when used in this specification, the term "comprises/comprising" specifies the presence of stated features, integers, steps, operations, elements and/or components but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements and/or components and/or groups thereof.
The terms "first", "second", etc. in this application are used to distinguish between different objects and not to describe a particular order. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
In addition, although the terms "first", "second", etc. are used several times in this application to describe various operations (or various elements or various applications or various instructions or various data) and the like, these operations (or elements or applications or instructions or data) should not be limited by these terms. These terms are only used to distinguish one operation (or element or application or instruction or data) from another operation (or element or application or instruction or data). For example, the first kind of use case set may be referred to as a second kind of use case set, and the second kind of use case set may also be referred to as the first kind of use case set, only the included ranges of the two kinds of use case sets are different without departing from the scope of the present application, and the first kind of use case set and the second kind of use case set are both test case sets aggregated by various initial test cases, only the two kinds of use case sets are not test case sets aggregated by the same initial test cases.
The method for generating the test case provided by the embodiment of the application can be applied to the application environment shown in fig. 1. Wherein the terminal 102 communicates with the server 104 via a communication network. The data storage system may store data that the server 104 needs to process. The data storage system may be integrated on the server 104, or may be located on the cloud or other network server.
In some embodiments, referring to fig. 1, the server 104 first obtains, for a batch file to be processed containing financial transaction data, predefined N data objects contained in the batch file; the data object is used for representing a data structure of financial service data, and the data structure carries corresponding M1 kinds of structure attribute information; then, the server 104 acquires N first example templates matched with the structure attribute information corresponding to the N data objects from the database; the N first example templates are sample test cases obtained based on L1 branch node assignments in the first decision tree, and each branch node is matched with at least one type of structure attribute information; then, the server 104 assigns the structural attribute information of the N data objects matched with the N first case templates based on the assignment types of the L1 branch nodes, and generates P1 initial test cases for each data object; the initial test cases comprise effective initial test cases and ineffective initial test cases; finally, the server 104 packages the initial test cases of the data objects to generate test cases corresponding to the N data objects included in the batch file.
In some embodiments, the terminal 102 (e.g., mobile terminal, fixed terminal) may be implemented in various forms. The terminal 102 may be a mobile terminal that can generate a corresponding test case for a participle information file stored in a system database by using a pre-prepared decision tree and a test case generation rule, such as a mobile phone, a smart phone, a notebook computer, a portable handheld device, a Personal Digital Assistant (PDA), a tablet computer (PAD), and the like, and the terminal 102 may also be a fixed terminal that can generate a corresponding test case for a participle information file stored in a system database by using a pre-prepared decision tree and a test case generation rule, such as an Automated Teller Machine (ATM), an all-in-one Machine, a Digital TV, a desktop computer, a fixed computer, and the like.
In the following, it is assumed that the terminal 102 is a fixed terminal. However, it will be understood by those skilled in the art that the configuration according to the embodiment disclosed in the present application can also be applied to the mobile type terminal 102 if there are operations or elements particularly for the purpose of movement.
In some embodiments, the data processing components run by the server 104 may load data that is being executed may include any of a variety of additional server applications and/or intermediate tier applications, including, for example, HTTP (hypertext transfer protocol), FTP (file transfer protocol), CGI (common gateway interface), RDBMS (relational database management system), and the like.
In some embodiments, the server 104 may be implemented as a stand-alone server or a server cluster of multiple servers. The server 104 may be adapted to run one or more application services or software components providing the terminal 102 described in the foregoing disclosure.
In some embodiments, the application services may include service interfaces that provide sample data processing to the user (e.g., an operation interface for the tester to submit a participle information file, a presentation interface for the tester to initiate a preparation request to a server requesting a batch of files), and corresponding program services, among others. The software component may include, for example, an application program (SDK) or a client (APP) having a function of generating a test case for a participle information file stored in a system database using a decision tree and a generation rule prepared in advance.
In some embodiments, the user may input corresponding code data or control parameters to the APP or client through input means in the terminal 102 to execute application services of the computer program in the server 104 and to display application services in the user interface.
In some embodiments, the operating system on which the terminal 102 operates may include versions of Microsoft Windows
Figure BDA0003979645650000061
Apple
Figure BDA0003979645650000062
And/or Linux operating system, various business or class
Figure BDA0003979645650000063
Operating systems (including but not limited to various GNU/Linux operating systems, ***)
Figure BDA0003979645650000064
OS, etc.) and/or mobile operating systems, such as
Figure BDA0003979645650000065
Figure BDA0003979645650000066
Phone、
Figure BDA0003979645650000067
OS、
Figure BDA0003979645650000068
OS、
Figure BDA0003979645650000069
The OS operating system, as well as other online operating systems or offline operating systems, is not specifically limited herein.
In some embodiments, as shown in fig. 2, a first test case generation method is provided, which is described by taking the method as an example applied to the server 104 in fig. 1, and the method includes the following steps:
step S11, aiming at the batch files containing the financial service data to be processed, predefined N data objects contained in the batch files are obtained.
In some embodiments, the development engineer firstly imports the batch files containing financial service data to be processed into the server through the client, and then stores the batch files into a special storage path of the database for standby through the server. When a development engineer needs to generate a test case about financial business data, the control server extracts batch files from the database.
In some embodiments, the batch file stored in the dedicated storage path of the database may be stored multiple times. For example, a development engineer stores a first batch of files to be processed on a first date, stores a second batch of files to be processed on a second date, and executes the test case generation method through the server until the number of files to be processed in the special storage path reaches a predetermined number.
In some embodiments, the database may store batch files, operator use cases of single data objects, use cases synthesized by operator use cases of multiple data objects, and a relationship set (key-value pair) of a single set of use cases.
In some embodiments, the batch file to be processed, which contains financial transaction data, contains predefined N data objects, where the data objects are used to represent a data structure of financial transaction data, and the data structure carries corresponding M1 kinds of structure attribute information.
As an example, N is 50, and M1 is 5, that is, 50 predefined data objects are included in the batch file, and the data structure of each data object carries corresponding 5 kinds of structure attribute information.
In some embodiments, the structure attribute information carried in the data structure includes a serial number, an english name of the data, a chinese name of the data, a data type, a data length, whether it is necessary to lose, whether it is allowed to be empty, a data dictionary, a data association rule, and the like.
As an example, for a data object a, the data structure of the corresponding characterized financial transaction data is: (number: 1; domain name: record; length: 1; field name: transaction sequence number; field type: input; data type: value; whether to fill in: yes; whether to allow empty: no; data dictionary: 2020-05-25).
In some embodiments, before the server executes the test case generation method, the development engineer may select to extract a specified number of batch files, test case keywords to be included, a case generation mode, a case frequency, a result storage path, a file storage format, and the like. Wherein the data dictionary of certain data objects needs to be covered each time.
In some embodiments, 2 use case generation modes are provided to be selectable: and generating a full use case and a limited use case.
In some embodiments, a use case generation pattern is used to determine whether a number of generation of use cases is specified. If yes, the number is specified, and at the end (namely, when the test case is generated), the server needs to check whether the number reaches the standard.
In some embodiments, a use case generation schema is used to determine whether a keyword requirement is included. If so, the server designates some data objects as keywords to fully cover the designated data objects. At the end (i.e. when the test case is generated), the server needs to check whether the data is up to standard.
In some embodiments, the use case generation mode is used to determine a storage path for a given result file, which may have a default value.
In some embodiments, the use case generation schema is used to determine a storage encoding format, such as ASCll code, EBDIC code, etc., in which the result file may be specified.
And step S12, acquiring N first example templates matched with the structure attribute information corresponding to the N data objects from the database.
In some embodiments, the first example template is a sample test case obtained based on L1 branch node assignments in the first decision tree, and each branch node is matched with at least one piece of structure attribute information. Wherein L1 is a positive integer such as 1,2, 3, etc.
In some embodiments, the first decision tree may be referred to as a generic decision tree. The general decision tree is a test case of a sample which is made by adopting a test case design method such as an equivalence class division method, a boundary value analysis method and the like aiming at inherent attributes (namely, structural attribute information carried in a data structure, including whether data dictionary is necessary or not, whether data type is limited or not) of a data object.
In some embodiments, the generic decision tree primarily stores some commonly used fill values, fill range values, rules, variable names, logic, etc. for the input data.
In some embodiments, the decision tree of the generic decision tree is pre-constructed and rules may be added, deleted, adjusted.
In some embodiments, each branch node of the general decision tree stores a valid test case set T1 and an invalid test case set T2.
In some embodiments, the set of valid test cases T1: the input data (i.e. financial business data) which is normal and can be accepted successfully is referred to, and the operation result of the test case (which is expected to do relevant business, such as depositing and withdrawing, etc.) can be expected to be successful. For example, the data allows for the entry of a null, normal state card number for empty time.
In some embodiments, the invalid test case set T2 includes an invalid business class test case set: the invalid service class test case set refers to abnormal service class data which can only be accepted and reported incorrectly or fail. For example, a card number in a sales status (which is not expected to be relevant for business, such as depositing and withdrawing, etc.).
In some embodiments, the set of invalid test cases T2 includes a set of invalid technology class test cases: the invalid technical class test case set refers to abnormal technical class data which can only be accepted and reported incorrectly or fail. For example, data is not allowed to enter null values for space-time; data is of numeric type, and characters or dates are entered; the data is of a date type and an invalid date (e.g., 2022-2-29, 2022-T-29) is entered.
In some embodiments, each branch node is matched with at least one type of structure attribute information, and each branch node is configured with a corresponding assignment type, and the branch node can assign values to obtain some sample test cases by combining the corresponding assignment type (including specific filling data, function method, random access method) and the matched structure attribute information (such as data length).
In some embodiments, the first example templates output by the branch nodes carry at least part of structure attribute information, and the structure attribute information carried by each first example template is matched with a corresponding data object.
In some embodiments, the branch nodes of the first decision tree may store sample test cases if they are not random numbers.
In some embodiments, if the branch node of the first decision tree is a random number, it may store the method name of the random function.
In some embodiments, the first decision tree may specify case frequencies for test cases to be generated (including full case coverage, high case coverage, medium case coverage, low case coverage).
And S13, assigning the structural attribute information of the N data objects matched with the N first case templates based on the assignment types of the L1 branch nodes, and generating P1 initial test cases for each data object.
In some embodiments, the P1 initial test cases include P2 valid initial test cases and P3 invalid initial test cases. Wherein P1= P1+ P3.
In an exemplary embodiment, referring to fig. 3, fig. 3 is a schematic block diagram of an embodiment of generating an initial test case in the present application. The server inputs the general case decision tree and each data object into the general case generator, and the general case generator assigns the structural attribute information of each data object matched with the first case templates based on the assignment types of the branch nodes corresponding to the first case templates of the general case decision tree, and generates a plurality of initial test cases for each data object in real time. And each initial test case is marked with a large-class label of 'valid case' and 'invalid case'. The plurality of initial test cases for each data object includes valid initial test cases: a field type test case (valid), a dictionary value test case (valid), a must-fail item test case (valid), a select-fail item test case (valid), a boundary value test case (valid), a date type test case (valid), and the like. The plurality of initial test cases for each data object includes an invalid initial test case: a field type test case (invalid), a dictionary value test case (invalid), a must-fail item test case (invalid), a select-fail item test case (invalid), a boundary value test case (invalid), a date type test case (invalid), and the like.
In some embodiments, the generic use case generator specifies a "number", "chinese description" for each use case, and the initialization is "used frequently" to 0 (used in subsequent combinations).
In some embodiments, each initial test case is labeled with a "valid test case" or "invalid test case". That is, a node containing T data use cases is divided into 2 nodes, and each node contains T1 and T2 data use cases (T = T1+ T2).
In some embodiments, based on the above use case classification, the server resets other attribute tags of each basic use case. Each data object may generate a finite number of discrete test cases, forming T triples: (Xi, lj, pk). Where Xi is a data object, n data objects X1, X2,. Cndot.XN. Lj is the test case number of a certain data object. Each data object corresponds to its own test case set, and if there are M test cases, it is L1, L2, ·, LM. Pk is the frequency with which a certain underlying test case is used. If there are M test cases, P1, P2, PM. Initialized to 0 (used in subsequent combinations).
In some embodiments, the case number of each initial test case is "TestCase _ x.y.z". It contains 3 meaning labels, X is the data object number; y is a large-class label of a use case (corresponding to T1 and T2); z is the self-increment sequence number of the case number under the data object. X, Y, Z, which is sequentially incremented from 0 by 0,1,2. X, Y, Z is parameterized in storage length.
For example: the use cases for the 2 nd data object are TestCase _1.0.1, testCase _1.1.2, testCase _1.2.1.
In some embodiments, the example Chinese description of each initial test case represents the characteristics of each sub-case using Chinese language descriptor, and the purpose is to read the result case file (because the result case file is actually a string of data, the readability is not high) for the subsequent automatic operation and analysis of docking, which can conveniently know the context information and quickly locate the defect problem.
And S14, packaging the initial test cases of the data objects to generate test cases corresponding to the N data objects contained in the batch file.
In some embodiments, the server first combines the initial test cases of the data objects to form N composite test cases. And then packaging the N synthesized test cases to generate the test cases corresponding to the plurality of data objects contained in the batch file.
In some embodiments, the server combines the initial test cases of the data objects by the word synthesis generator according to the valid case and the invalid case respectively by using a matrix filling method.
In some embodiments, the matrix filling method for the valid cases refers to creating a matrix in advance, refilling each initial test case of the data object A1, then merging each initial test case of another data object B1 into another column of the created matrix (the cases of the data objects A1 and B1 may be in the same row), and increasing the number of rows as needed.
In some embodiments, the matrix filling method for invalid cases refers to creating a matrix, refilling each initial test case of the data object A2, and then supplementing each initial test case of the other data object B2 to other columns of other rows of the created matrix (the cases of the data objects A1 and B1 must be in different rows), and increasing the number of rows as needed. And filling other blank values in the matrix with valid cases (the reason is that invalid cases need to exclude interference of other data objects, and the reason for ensuring the invalidity or the unlawful reason of the cases is caused by the invalid cases of the data object and not caused by other data objects).
In some embodiments, the method of implementation of the utility conjunctive generator is as follows.
(1) And creating a matrix column structure according to the data structure of the batch files, and adding auxiliary information such as 'use case Chinese description' and the like.
(2) And if the user specifies the number of use cases, automatically creating the number of matrix rows according with the number. If not, the method is created according to 1000 lines, and the number of the created lines and the number of the deleted lines are added according to the requirement subsequently.
(3) Only valid operator use cases (i.e., initial test cases) are selected.
(4) And sorting according to the frequency of the operator use cases (comprising full coverage, high coverage, middle coverage and low coverage).
(5) And selecting an operator use case, and adding the operator use case into the matrix to be stored according to the column where the data object is positioned.
And if the frequency of the operator use cases is all covered, all the use cases are selected and added into the matrix for storage according to the column of the data object.
If the frequency of the operator use cases is high, medium and low, all the operator use cases of the data object are selected according to the frequency weight and the required quantity of the use cases, and the selected operator use cases are added into the matrix to be stored according to the column of the data object.
Wherein each time it is added to the matrix, the actual usage frequency of each operator use case is increased by 1.
And if the data object only has the universal use case, only selecting the universal use case set as the operator use case.
(6) And filling other data objects into other columns (which can be in the same row) of the created matrix one by one according to the above rule until the completion.
(7) When the number of the filled operator use cases is larger than the number of matrix rows, the number of the use cases is not specified by a user, and the operator use cases are not used (the actual use frequency is 0), the number of the rows can be additionally created and deleted as required.
(8) And selecting and filling some matrix values which are additionally created and have blank values according to the operator frequency weight of the data object and the quantity required by the use cases. And processing the data objects one by one according to the data objects until no blank value exists.
In some embodiments, the implementation of the invalidation case conjunct generator is as follows.
(1) And creating a matrix column structure according to the data structure of the batch file, and adding auxiliary information such as 'use case Chinese description' and the like.
(2) And if the user specifies the number of use cases, automatically creating the number of matrix rows according with the number. If not, the method is created according to 1000 lines, and the number of the created lines and the number of the deleted lines are added according to the requirement subsequently.
(3) And selecting invalid operator use cases.
(4) And sorting according to the frequency (all coverage, high, medium and low) of the operator use cases.
(5) And selecting an operator use case, and adding the operator use case into the matrix to store according to the column where the data object is positioned.
And if the frequency of the operator use cases is all covered, all the use cases are selected and added into the matrix for storage according to the column of the data object.
If the frequency of the operator use cases is high, medium and low, all the operator use cases of the data object are selected according to the frequency weight and the required quantity of the use cases, and the selected operator use cases are added into the matrix to be stored according to the column of the data object.
Wherein each time it is added to the matrix, the actual usage frequency of each operator use case is increased by 1.
And if the data object only has the universal use case, only selecting the universal use case set as the operator use case.
(6) Other data objects are filled one by one into other columns (necessarily in different rows) of other rows of the created matrix according to the above rules.
(7) When the number of the filled operator use cases is larger than the number of matrix rows, the number of the use cases is not specified by a user, and the operator use cases are not used (the actual use frequency is 0), the number of the rows can be additionally created and deleted as required.
(8) And selecting an effective operator use case. And filling with valid cases for other blank values in the matrix. The valid use case can be randomly selected for filling, and the specified use case can also be written to fill.
In some embodiments, for effective initial test cases, a combined filling mode is adopted, so that some cases can be covered more, and the storage and performance consumption brought by strong combination of Cartesian products (the combination of 2 sets is realized by the thought of Cartesian products mathematically, and the obtained result is used as a new set). For an invalid initial test case, a combined filling mode of an invalid case and a valid case is adopted, so that the interference of other data objects can be eliminated, and the invalid or illegal reason of the case is ensured to be caused by the invalid case of the data object but not by other data objects.
In the method for generating the test case, firstly, predefined N data objects contained in batch files are obtained aiming at the batch files containing financial service data to be processed; the data object is used for representing a data structure of financial service data, and the data structure carries corresponding M1 kinds of structure attribute information; then, acquiring N first example templates matched with the structure attribute information corresponding to the N data objects from the database; the N first example templates are sample test cases obtained based on L1 branch node assignments in the first decision tree, and each branch node is matched with at least one type of structure attribute information; then, based on the assignment types of the L1 branch nodes, assigning the structural attribute information of the N data objects matched with the N first case templates to generate P1 initial test cases for each data object; the initial test cases comprise effective initial test cases and ineffective initial test cases; and finally, packaging the initial test cases of the data objects to generate the test cases corresponding to the N data objects contained in the batch file. Therefore, on one hand, the test cases corresponding to the batch files are generated by utilizing the predefined N data objects and the corresponding case templates contained in the batch files, so that the generation efficiency of the test cases can be improved, the generation flow of the test cases can be optimized, and the labor and time cost can be saved; on the other hand, the structural attribute information of the data object is assigned through the assignment types of the branch nodes corresponding to the N first example templates to generate an initial test case for each data object, so that the coverage rate of the test cases can be improved, test events are prevented from being omitted, and the accuracy and reliability of a subsequent test flow are improved.
It will be appreciated by those of skill in the art that in the foregoing method of the specific embodiment, the disclosed method may be practiced in a more specific manner. For example, the above-described embodiment of the test case generation process is merely an exemplary description.
In an exemplary embodiment, referring to fig. 4, fig. 4 is a schematic flowchart illustrating an embodiment of assigning value to structure attribute information in the present application. In step S13, the server assigns the structural attribute information of the N data objects matched with the N first example templates based on the assignment types of the L1 branch nodes, which may specifically be implemented in the following manner:
step S131, determining assignment types of the L2 branch nodes corresponding to each first-instance template.
In some embodiments, the assignment types of the branch nodes corresponding to the first example template include a padding data type, a function assignment type, and a random access type, and L1 is greater than L2.
In some embodiments, the first decision tree has L1 branch nodes, and each first case template corresponds to L2 branch nodes.
Step S132, assigning the structural attribute information of the data object respectively matched with each first case template according to the assignment types of the L2 branch nodes and a preset case generation rule.
The general use case generator can control the branch nodes to assign the structural attribute information of the test use case to be generated according to the corresponding assignment type and a preset use case generation rule.
In some embodiments, the use case generation rule includes presetting the number of test cases to be generated and the use case coverage frequency corresponding to the N data objects.
In some embodiments, the ranking is by frequency of use case coverage (including full coverage, high coverage, medium coverage, low coverage).
In some embodiments, the structure attribute information carried by the data structure includes data type, data length, input type, option type, data dictionary type.
In some embodiments, the input type of the structure attribute information is whether the corresponding structure attribute data must be input, which includes both must-input and non-must-input.
In some embodiments, the option type of the structure attribute information is whether the corresponding structure attribute data must be empty, which includes both must be empty and non-must be empty.
In an exemplary embodiment, referring to fig. 5, fig. 5 is a flowchart illustrating an embodiment of aggregating initial test cases according to the present application. In step S13, after the generating P1 initial test cases for each data object, the server may further specifically implement the following steps:
step a1, identifying P1 initial test cases as P2 effective initial test cases and P3 ineffective initial test cases based on the assignment of the structural attribute information corresponding to each initial test case.
Wherein, P1 is equal to the sum of P2 and P3, that is, P1 initial test cases include P2 valid initial test cases and P3 invalid initial test cases.
Step a2, aggregating the P2 valid initial test cases into a first type case set, and aggregating the P3 invalid initial test cases into a second type case set.
In some embodiments, the usage information and the text description are carried in each initial test case.
In some embodiments, the initial utilization information of each initial test case is 0, i.e., an initialization state (the utilization information may be used in subsequent combinations).
In some embodiments, the use case chinese description is a feature of each sub-case described by using the chinese language, and is used to read for the user (because the result use case file is actually a string of data, the readability is not high), so that the subsequent docking automation operation and analysis can be performed, the context information can be conveniently known, and the defect problem can be quickly located.
In an exemplary embodiment, referring to fig. 6, fig. 6 is a schematic flowchart of an embodiment of packaging a test case in the present application. In step S14, the process of encapsulating the initial test case of each data object by the server and generating the test cases corresponding to the N data objects included in the batch file may be specifically implemented in the following manner:
step S141, based on the number and coverage frequency of each initial test case corresponding to the N data objects, and the utilization rate information and the chinese description carried by the P2 initial test cases in the first-class case set, perform matrix filling processing on the P2 initial test cases in the first-class case set, and obtain the processed P4 effective sub-class test cases.
In some embodiments, the matrix filling process is used to merge the initial test cases in the first set of use cases, and P2 is greater than P4.
As an example, the 20 original test cases in the first-class case set are subjected to matrix filling processing to obtain 10 finally merged effective child-class test cases.
In some embodiments, the server first combines the initial test cases for the data objects to merge to form N composite test cases. And then packaging the N synthesized test cases to generate the test cases corresponding to the plurality of data objects contained in the batch file.
In some embodiments, the server combines the initial test cases of the data objects by the word synthesis generator according to the valid case and the invalid case respectively by using a matrix filling method.
In some embodiments, the matrix filling method for the valid cases refers to creating a matrix in advance, refilling each initial test case of the data object A1, then merging each initial test case of another data object B1 into another column of the created matrix (the cases of the data objects A1 and B1 may be in the same row), and increasing the number of rows as needed.
In some embodiments, the matrix filling method for invalid cases refers to creating a matrix, refilling each initial test case of the data object A2, and then supplementing each initial test case of the other data object B2 to other columns of other rows of the created matrix (the cases of the data objects A1 and B1 must be in different rows), and increasing the number of rows as needed. And filling other blank values in the matrix with valid cases (the reason is that invalid cases need to exclude interference of other data objects, and the reason for ensuring the invalidity or the unlawful reason of the cases is caused by the invalid cases of the data object and not caused by other data objects).
Step S142, based on the number and coverage frequency of each initial test case corresponding to the N data objects, and the utilization rate information and the chinese description carried by the P3 initial test cases in the second type case set, performing matrix filling processing on the P3 initial test cases in the second type case set to obtain the processed P5 invalid sub-type test cases.
In some embodiments, the matrix filling process is used to merge the initial test cases in the second set of use cases, and P3 is greater than P5.
As an example, 20 original test cases in the second class case set are subjected to matrix filling processing on the 20 original test cases to obtain finally merged 10 invalid subclass test cases.
In some embodiments, the method of implementation of the conjunctive word generator is effective as follows.
(1) And creating a matrix column structure according to the data structure of the batch file, and adding auxiliary information such as 'use case Chinese description' and the like.
(2) And if the user specifies the number of use cases, automatically creating the number of matrix rows according with the number. If not, the method is created according to 1000 lines, and the number of the created lines and the number of the deleted lines are added according to the requirement subsequently.
(3) Only valid operator cases (i.e., initial test cases) are selected.
(4) And sorting according to the frequency of the operator use cases (comprising full coverage, high coverage, middle coverage and low coverage).
(5) And selecting an operator use case, and adding the operator use case into the matrix to be stored according to the column where the data object is positioned.
And if the frequency of the operator use cases is all covered, all the use cases are selected and added into the matrix for storage according to the column of the data object.
If the frequency of the operator use cases is high, medium and low, all the operator use cases of the data object are selected according to the frequency weight and the required quantity of the use cases, and the selected operator use cases are added into the matrix to be stored according to the column of the data object.
Wherein each time it is added to the matrix, the actual usage frequency of each operator use case is increased by 1.
And if the data object only has the universal use case, only selecting the universal use case set as the operator use case.
(6) And filling other data objects into other columns (which can be in the same row) of the created matrix one by one according to the above rule until the completion.
(7) When the number of the filled operator use cases is larger than the number of the matrix rows, the user does not specify the number of the use cases, and the operator use cases are not used (the actual use frequency is 0), the number of the rows can be additionally created and deleted as required.
(8) And selecting and filling some matrix values which are additionally created and have blank values according to the operator frequency weight of the data object and the quantity required by the use cases. And processing the data objects one by one according to the data objects until no blank value exists.
In some embodiments, the implementation of the invalidation case conjunct generator is as follows.
(1) And creating a matrix column structure according to the data structure of the batch file, and adding auxiliary information such as 'use case Chinese description' and the like.
(2) And if the user specifies the number of use cases, automatically creating the number of matrix rows according with the number. If not, the method is created according to 1000 lines, and the number of the created lines and the number of the deleted lines are added according to the requirement subsequently.
(3) And selecting invalid operator use cases.
(4) And sorting according to the frequency (all coverage, high, medium and low) of the operator use cases.
(5) And selecting an operator use case, and adding the operator use case into the matrix to be stored according to the column where the data object is positioned.
And if the frequency of the operator use cases is all covered, all the use cases are selected and added into the matrix for storage according to the column of the data object.
If the frequency of the operator use cases is high, medium and low, all the operator use cases of the data object are selected according to the frequency weight and the required quantity of the use cases, and the selected operator use cases are added into the matrix to be stored according to the column of the data object.
Wherein each time it is added to the matrix, the actual usage frequency of each operator use case is increased by 1.
And if the data object only has the universal use case, only selecting the universal use case set as the operator use case.
(6) Other data objects are filled one by one into other columns (necessarily in different rows) of other rows of the created matrix according to the above rules.
(7) When the number of the filled operator use cases is larger than the number of the matrix rows, the user does not specify the number of the use cases, and the operator use cases are not used (the actual use frequency is 0), the number of the rows can be additionally created and deleted as required.
(8) And selecting an effective operator use case. And filling with valid cases for other blank values in the matrix. The valid use cases can be randomly selected to be filled, and the appointed use cases can be written to be filled.
Step S143 packages the P4 valid subclasses and the P5 invalid subclasses, and generates a first class test case corresponding to the N data objects included in the batch file.
In an embodiment, the server first packages the P4 valid subclasses of test cases and the P45 invalid subclasses of test cases individually according to the requirements of the corresponding package template files, so as to obtain the packaged test cases of the valid subclasses of test cases and the packaged test cases of the invalid subclasses of test cases.
In an embodiment, the separate packaging may be understood as performing combined packaging on the P4 valid subclass test cases and each assigned value thereof, and performing combined packaging on the P45 invalid subclass test cases and each assigned value thereof. The merged encapsulation refers to hiding the attributes and implementation details of an object (namely a subclass test case), and only externally disclosing a template file interface and controlling the access level of reading and modifying the attributes in a program; the abstracted data (namely assigned value data) and the behaviors (namely template file functions) are combined to form an organic whole, namely, the data and the source codes of the operation data are organically combined to form a class, wherein the data and the functions are members of the class.
In an embodiment, the server performs combined encapsulation on the encapsulated test cases of the valid subclass test cases and the encapsulated test cases of the invalid subclass test cases (that is, performs unified templated encapsulation on all the test cases subjected to the previous step) to obtain the test cases (or test case groups) corresponding to the N data objects included in the batch file, and adds the test cases into a storage medium for storage, or inputs the test cases into a case test platform for case test, and obtains a test result.
In one embodiment, the test case includes at least one of the following parameters: the method comprises the following steps of interface verification layer class name, case method name, interface information to be called (including interface packaging layer class name, request method and parameters required by resource creation), test data layer information (including data test layer class name, data provider method name and whether test data are transmitted through a test data layer), an interface data variable array and expected information (including return result expected information, return code expected information, verification field and test case success condition).
In an exemplary embodiment, referring to fig. 7, a second test case generation method is provided. After step S14, the server may specifically be implemented in the following manner:
and step S21, acquiring preset R second example templates.
In some embodiments, the second example template is sample service data corresponding to financial service data, which is obtained based on the assignment of S branch nodes in the second decision tree, where the sample service data carries M2 types of service attribute information.
In some embodiments, the server sets a matching relationship between the N data objects included in the batch file and the input data object in the second decision tree, and then designs some sample service data having service features through S branch nodes by using a test case design method such as an equivalence class division method, a boundary value analysis method, and the like, with respect to the service meaning (i.e., service attribute information, such as a transaction region, a transaction site, a debit card, a credit card, an account opening institution, a username, an amount of money, and the like) of the input data object in the second decision tree.
In some embodiments, the second decision tree may be referred to as a business class decision tree, which is a complement to a generic decision tree that performs retention, deletion processing on generic test (including valid, invalid) cases. Wherein, the retention case mainly aims at some common attributes (such as allowed null value, data dictionary, etc.), and the deletion mainly aims at the processing of the valid use case.
In some embodiments, the branch nodes of the traffic class decision tree are a valid test case set Y1 and an invalid test case set Y1.
In some embodiments, if the branch node of the service class decision tree is a random number and comes from a service parameter and a service data table, the SQL statement containing the access assembly condition is stored.
In some embodiments, if the branch node of the service class decision tree is a random number and comes from an external subsystem (for example) data pool, the necessary elements of system name, system access condition, etc. are stored.
In some embodiments, if the branch node of the service class decision tree is from a common use case, the original use case of the common use case is stored.
In some embodiments, if the branch node of the traffic class decision tree is not from a general use case and is not a random number, then the data sample is deposited.
In some embodiments, the traffic class decision tree may specify the frequency of use cases (all covering, high, medium, low).
In some embodiments, an excessive radix is not avoided, and at most 1000 business class cases are generated.
In some embodiments, before the server executes the test case generation method, the development engineer may select to extract a specified number of batch files, test case keywords to be included, a case generation mode, a case frequency, a result storage path, a file storage format, and the like. Wherein the data dictionary of certain data objects needs to be covered each time.
In some embodiments, 2 use case generation modes are provided to be selectable: and generating a full use case and a limited use case.
In some embodiments, a use case generation pattern is used to determine whether a number of generation of use cases is specified. If yes, the number is specified, and at the end (namely, when the test case is generated), the server needs to check whether the number reaches the standard.
In some embodiments, a use case generation schema is used to determine whether a keyword requirement is included. If so, the server designates some data objects as keywords to fully cover the designated data objects. At the end (i.e. when the test case is generated), the server needs to check whether the data is up to standard.
In some embodiments, the use case generation mode is used to determine a storage path for a given result file, which may have a default value.
In some embodiments, the use case generation schema is used to determine a storage encoding format, such as ASCll code, EBDIC code, etc., in which the result file may be specified.
And S22, deleting at least part of initial test cases corresponding to the data objects based on the association degree between the structure attribute information carried by the N data objects and the service attribute information carried by the R second case templates.
In an exemplary embodiment, referring to fig. 8, fig. 8 is a schematic block diagram of an embodiment of deleting an initial test case in the present application. The server inputs all data objects contained in the service class case decision tree and the batch files into the service class case generator, and the service class case generator deletes at least part of the initial test cases corresponding to all the data objects based on the association degree between the structure attribute information carried by all the data objects and the service attribute information carried by the R second case templates.
In some embodiments, the business class use case generator processes each data object contained in the batch file one by one: firstly, acquiring a service object (namely a second example template) which is correspondingly matched with each data object contained in the batch file; and then, accessing a general use case library through a service type use case generator by combining a service type use case decision tree, reserving and deleting the general test (effective and ineffective) use case, and generating the service type test use case in real time.
In some embodiments, the retention cases are primarily for some common attributes (e.g., allowed null values, data dictionaries, etc.), and the deletion is primarily for processing of valid use cases. For example, if the branch node of the decision tree is not a random number, then the data sample is stored.
In some embodiments, if the branch node of the traffic class decision tree is not a random number, then the data sample is stored.
In some embodiments, if the branch node of the service class decision tree is a random number and comes from a service parameter and a service data table, the SQL statement containing the access assembly condition is stored.
In some embodiments, if the branch node of the service class decision tree is a random number and comes from an external subsystem (for example) data pool, the necessary elements of system name, system access condition, etc. are stored.
In some embodiments, the branch nodes of the service class decision tree are reserved with some attributes returned by the service parameters, the service data table, the data pool (of the external subsystem). For example, several key attributes of the debit card, the connection data pool obtains relevant information (place of account, account name, amount of money, etc.), and stores the relevant information temporarily for subsequent generation of association rule use cases (for example, a normal card and a transaction place unequal to the place of account of the card belong to valid use cases).
In some embodiments, the branch nodes of the traffic class decision tree may store the frequency (all coverage, high, medium, low) of relevant use cases.
In some embodiments, the branch nodes of the service decision tree may store the frequency specified by the general use case, the frequency of the service decision tree, and the user uploading frequency, and store the highest value upwards.
In an exemplary embodiment, referring to fig. 9, fig. 9 is a schematic flowchart of an embodiment of deleting a test case in the present application. In step S22, the process of deleting, by the server, at least part of the initial test cases corresponding to each data object based on the degree of association between the structure attribute information carried by the N data objects and the service attribute information carried by the R second case templates may further specifically include the following steps:
step S221, based on the structure attribute information corresponding to the N data objects and the service attribute information corresponding to the R second example templates, performing fuzzy matching on each data object and each second example template, and determining a degree of association between each data object and each second example template.
In step S222, a second use case template with the maximum degree of association with each data object is used as an associated use case template of a corresponding data object.
Step S223, determining whether there is an opposite characteristic between the structure attribute information carried by each initial test case corresponding to each data object and the service attribute information carried by the corresponding associated case template.
And S224, deleting the initial test case corresponding to the anisotropic characteristic.
In some embodiments, the retained initial test cases are mainly for some common attributes (e.g., allowed null values, data dictionary, etc.), and the deleted initial test cases are mainly for processing of valid cases.
In some embodiments, the server places each data object of the batch file in an equivalent association with a data object of the business decision tree (referring to an object having business meaning). After fuzzy matching is firstly carried out on data in the business decision tree according to the Chinese name of the data, at most 3 results are displayed back to a client according to the matching degree, and a client designates a related data object (of the business decision tree).
For example, the server correspondingly sends the data object zoneno of the batch file to a region in the service decision tree; the server correspondingly uploads the data objects of the batch files bron to a network point in a service decision tree; the server sends the data object mdcardno of the batch file up to the generic card number (debit, credit, etc.) in the business decision tree, correspondingly. The business decision tree is connected with the data pool to obtain relevant information (account opening place, account name, amount and the like).
And step S23, packaging the remaining initial test cases of the N data objects, and generating a second type of test case corresponding to the N data objects contained in the batch file.
In an embodiment, the server first separately packages all the valid remaining initial test cases and all the invalid remaining initial test cases according to the requirements of the corresponding package template files, so as to obtain the packaged test cases of the valid subclass test cases and the packaged test cases of the invalid subclass test cases.
In one embodiment, the single package may be understood as a combined package of all valid remaining initial test cases and each assigned value data thereof, and a combined package of all invalid remaining initial test cases and each assigned value data thereof. The merged encapsulation is to hide the attribute and implementation details of an object (namely, a subclass test case), externally disclose a template file interface only and control the access level of reading and modifying the attribute in a program; the abstracted data (namely assigned value data) and the behaviors (namely template file functions) are combined to form an organic whole, namely, the data and the source codes of the operation data are combined organically to form a class, wherein the data and the functions are members of the class.
In an embodiment, the server performs combined packaging on the packaged test cases of the remaining valid initial test cases and the packaged test cases of the remaining invalid initial test cases (that is, performs uniform templated packaging on all the test cases subjected to the previous step) to obtain test cases (or test case groups) corresponding to the N data objects included in the batch file, and adds the test cases into the storage medium for storage, or inputs the test cases into a case test platform for case testing, and obtains a test result.
In other embodiments, the server first combines the remaining initial test cases of the data objects to form N composite test cases. And then packaging the N synthesized test cases to generate the test cases corresponding to the plurality of data objects contained in the batch file.
In some embodiments, the server combines the remaining initial test cases of each data object by the word combination generator according to the valid use cases and the invalid use cases respectively by using a matrix filling method.
In some embodiments, the matrix filling method for the valid cases refers to creating a matrix in advance, refilling each remaining initial test case of the data object A1, then merging each remaining initial test case of the other data object B1 into other columns of the created matrix (the cases of the data objects A1 and B1 may be in the same row), and increasing the number of rows as needed.
In some embodiments, the matrix filling method for invalid cases refers to creating a matrix, refilling each remaining initial test case of the data object A2, and then supplementing each remaining initial test case of the other data object B2 to other columns of other rows of the created matrix (the cases of the data objects A1 and B1 must be in different rows), and increasing the number of rows as needed. And filling other blank values in the matrix with valid cases (the reason is that invalid cases need to exclude interference of other data objects, and the reason for ensuring the invalidity or the unlawful reason of the cases is caused by the invalid cases of the data object and not caused by other data objects).
In an exemplary embodiment, referring to FIG. 10, a third test case generation method is provided. After step S23, the server may specifically include the following implementation:
step S31, in the second type test case of the N data objects, effective structure attribute information in the remaining initial test cases corresponding to each data object is determined based on the effectiveness of assignment of the structure attribute information.
Step S32, based on the validity of the attribute values of the M2 service attribute information carried in the sample service data, determining the valid service attribute information in the R second example templates.
Step S33, determining the association degree between the effective structure attribute information corresponding to each initial test case and the effective service attribute information corresponding to each second case template.
In some embodiments, when each data object included in the batch file is associated with another data object (including data objects in other batch files or data objects in the business class decision tree), the server may set some association rules for the associated data objects through the association rule decision tree to determine the association degree between the valid structure attribute information corresponding to each initial test case and the valid business attribute information corresponding to each second case template.
The association rule set by the association rule decision tree only considers the logic rule association among 2 data objects, does not consider the association of the 2 test cases in terms of running sequence and the like, and the association rule decision tree comprises 2 rules.
In some embodiments, the association rule decision tree comprises an explicit association rule decision tree. Where the explicit association rule decision tree has an association rule of the form I → J, where I is a sub-item belonging to data object I and J is a sub-item belonging to data object J. If i is true, j is also true, and the case is a valid case, otherwise, the case is an invalid case. The use case corresponding to the association rule of the decision tree is split into: valid use case (i and j), valid use case (i is not j and not j), valid use case (i is not j) and invalid use case (i and j is not j).
In some embodiments, when the data objects contained in the batch file have non-empty "data association rules" in the preset structure attribute information, the server recombines the interrelated data objects (i.e., the data objects contained in the batch file and the decision trees (e.g., business class data objects) in the association rule decision tree) use case sets based on the use case generator of the association rule i → j, and generates the association rule use case sets of multiple data objects.
Wherein, the server digs more association rules through the above association rule splitting, such as I → (a and B), I not → a, and so on. Rules can be added, adjusted and maintained to achieve the capability of evolution.
In some embodiments, the association rule decision tree comprises an implicit association rule decision tree. The implicit association rule decision tree here refers to an association rule use case between implicit business class data objects (which are already associated and matched with data objects contained in the batch file).
In some embodiments, the business class data object is some additional attribute returned from the business parameter, the business data table, the data pool (of the external subsystem). The decision tree supplements relevant effective and ineffective cases to relevant business data objects, and adds and deletes the business type case library. For example, data object I "card number" is connected to the data pool to obtain additional account opening region attributes (the generated service class case is obtained), and is recombined with data object J "transaction region" to generate: the transaction area is equal to the effective use case of the card number account opening area (local) and the transaction area is not equal to the effective use case of the card number account opening area (remote).
In one embodiment, when there is a correlation between a data object and other objects, the association rule decision tree needs to set some association rules for the correlated data objects.
Where the set of rules in if-then form is called an association rule, an association rule is in the form I → J, where I is a sub-item belonging to data object I and J is a sub-item belonging to data object J. If i is true, then j is also true, and it can be a valid use case. The use case corresponding to the association rule is split into: valid use case (i and j), valid use case (i is not j and not j), valid use case (i is not j) and invalid use case (i and j is not j).
As an example, see table 1 below:
Figure BDA0003979645650000191
table 1-association rules example 1
Wherein the condition of the association rule example 1 is a → B:
SenDNAME =1, then ACCNAMEF is the true house name, and the house name is taken from the data pool (as the valid use case).
SenDNAME =1, then ACCNAMEF is the false username (for invalid case).
SenDNAMME =0, then ACCNAMEF is the true house name, and the house name is taken from the data pool (which is the valid case).
SenDNAMME =0, then ACCNAMEF is the false username (which is the valid case).
As another example, see table 2 below:
Figure BDA0003979645650000201
table 2-association rules example 2
Wherein the condition of association rule example 2 is a → (B or non-B):
OPERFLAG =1, then AMOUNT =0 or AMOUNT > 0.
OPERFLAG =2, then AMOUNT =0 or AMOUNT > 0.
Where a set of rules in if-then form is called an association rule, one association rule is of the form I → J, where I is one term and J is the other term. If I is true, then J is also true. The use cases corresponding to the association rules are split into valid use cases (I and J), valid use cases (I is not J, not J), invalid use cases (I is not J, not J), and invalid use cases (I and J, not).
And step S34, merging and recombining the initial test cases with the correlation degree larger than or equal to the first threshold value and the corresponding sample service data to generate a third type test case corresponding to a plurality of data objects contained in the batch file.
In some embodiments, the server may use a case generator of the association rule to merge and recombine the initial test cases with the association degree greater than or equal to the first threshold value and the corresponding sample business data to generate a third type of test case corresponding to the plurality of data objects contained in the batch file.
In some embodiments, the case generator of the association rule is based on the above generated single data object general case and service class case sets, and then, for the association rule I → J of the data object, an equivalence class partitioning method, a boundary value analysis method and other test case design methods are adopted, and according to the association rule, the mutually associated data object case sets are combined to design some association rule case sets { I, J } with specific filling data, function methods and random number fetching methods as samples and multiple data objects, and finally, cases of the general case and the service class are deleted.
In some embodiments, the association rule use case is a supplement to the general use case and the business class use case, and the association rule use case and the business class use case are recombined according to the i and j filling values to form an association rule use case set. The leaf node of the association rule use case is a recombination of { data object I use case } and { data object J use case }. The specific method of the association rule use case generator is as follows:
if the value of I does not belong to the general or business case set of the data object I, adding the value of I case to the case set of the data object I (the case adding method adopts a general case generator) for correcting the case library.
Wherein, if the J value does not belong to the general or service type case set of the data object J, the processing is the same as above.
The general or business type use case sets of the data object I and the data object J are combined into a use case set { I, J } containing the 2 data objects, and the use case set is stored in an association rule use case set.
Wherein, the general use case set of the data object I and the data object J is set as the association rule data (based on the general or business use case).
In some embodiments, more association rules are mined through this association rule, such as I → (a and B), I not → D, etc. Rules can be added, adjusted and maintained to achieve the capability of evolution.
In some embodiments, after generating the third type test cases corresponding to the N data objects included in the batch file, the server first combines the third type test cases of the N data objects included in the batch file to combine to form N synthesized test cases. And then packaging the N synthesized test cases to generate the test cases corresponding to the plurality of data objects contained in the batch file.
In some embodiments, the server combines the initial test cases of the data objects by the word synthesis generator according to the valid case and the invalid case respectively by using a matrix filling method.
In some embodiments, the matrix filling method for the valid case refers to creating a matrix in advance, refilling the third type test case of the data object A1, merging the third type test cases of other data objects B1 into other columns of the created matrix (the cases of the data objects A1 and B1 may be in the same row), and increasing the number of rows as needed.
In some embodiments, the matrix filling method for invalid cases refers to creating a matrix, refilling the third type test case of the data object A2, and then supplementing the third type test case of the other data object B2 to other columns of other rows of the created matrix (the cases of the data objects A1 and B1 must be in different rows), and increasing the number of rows as needed. And filling other blank values in the matrix with valid cases (the reason is that invalid cases need to exclude interference of other data objects, and the reason for ensuring the invalidity or the unlawful reason of the cases is caused by the invalid cases of the data object and not caused by other data objects).
In an exemplary embodiment, referring to fig. 11, fig. 11 is a schematic flowchart of an embodiment of updating a use case template in the present application. After step S34, the server may specifically include the following implementation:
step S41, based on the validity of the attribute value of the service attribute information, determining the valid service attribute information in the R second example templates.
And step S42, determining the correlation degree between the corresponding effective service attribute information among the second example templates.
In some embodiments, when there is a correlation between the second example templates in the service class decision tree, the server may determine the degree of correlation between the effective service attribute information corresponding to each two second example templates by setting some correlation rules for the correlated second example templates through the correlation rule decision tree.
And S43, merging and recombining the second example templates with the association degree larger than or equal to the second threshold value to obtain a new second example template.
In some embodiments, the server may use the use case generator of the association rule to merge and recombine the second use case templates with the association degree greater than or equal to the second threshold value, so as to obtain a new second use case template.
According to the method for generating the test cases, on one hand, the test cases corresponding to the batch files are generated by utilizing the predefined N data objects and the corresponding case templates contained in the batch files, so that the generation efficiency of the test cases can be improved, the generation flow of the test cases can be optimized, and the labor and time costs are saved; on the other hand, the structure attribute information of the data object is assigned through the assignment types of the branch nodes corresponding to the N first example templates, so that an initial test case for each data object is generated, the coverage rate of the test cases can be improved, test events are prevented from being omitted, and the accuracy and reliability of a subsequent test process are improved.
It should be understood that although the various steps in the flowcharts of fig. 2-11 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-11 may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed in turn or alternately with other steps or at least some of the other steps or stages.
It is understood that the same/similar parts between the embodiments of the method described above in this specification can be referred to each other, and each embodiment focuses on the differences from the other embodiments, and it is sufficient that the relevant points are referred to the descriptions of the other method embodiments.
FIG. 12 is a block diagram illustrating an apparatus for generating test cases in accordance with an illustrative embodiment. Referring to fig. 10, the test case generation apparatus 10 includes a first obtaining unit 11, a second obtaining unit 12, a data assigning unit 13, and a use case packaging unit 14.
The first acquiring unit 11 is configured to execute acquiring predefined N data objects contained in a batch file containing financial service data to be processed; the data object is used for representing a data structure of the financial service data, and the data structure carries corresponding M1 kinds of structure attribute information.
The second obtaining unit 12 is configured to perform obtaining N first case templates matching with the structure attribute information corresponding to the N data objects from the database; the N first example templates are sample test cases obtained based on L1 branch node assignments in a first decision tree, and each branch node is matched with at least one type of structure attribute information.
The data assigning unit 13 is configured to perform assignment of the structure attribute information of the N data objects matched with the N first instance templates based on the assignment types of the L1 branch nodes, and generate P1 initial test cases for each of the data objects; the initial test cases comprise valid initial test cases and invalid initial test cases.
The use case packaging unit 14 is configured to perform packaging of the initial test case of each data object, and generate a test case corresponding to the N data objects included in the batch file.
In an exemplary embodiment, the first case templates carry at least part of the structure attribute information, and the structure attribute information carried by each first case template is matched with a corresponding data object;
in terms of assigning the structure attribute information of the N data objects matching the N first example templates based on the assignment types of the L1 branch nodes, the data assignment unit 13 is further configured to determine assignment types of L2 branch nodes corresponding to each first example template; the assignment type comprises a filling data type, a function assignment type and a random access type, and L1 is greater than L2;
assigning the structural attribute information of the data object respectively matched with each first case template according to the assignment types of the L2 branch nodes and a preset case generation rule;
the case generation rule includes presetting the number of test cases to be generated corresponding to the N data objects and case coverage frequency.
In an exemplary embodiment, the structure attribute information carried by the data structure includes a data type, a data length, an input type, an option type, and a data dictionary type;
after generating P1 initial test cases for each data object, the data assignment unit 13 is further configured to perform assignment based on the structure attribute information corresponding to each initial test case, and identify that the P1 initial test cases are P2 valid initial test cases and P3 invalid initial test cases; p1 is equal to the sum of P2 and P3;
and aggregating the P2 effective initial test cases into a first type case set, and aggregating the P3 ineffective initial test cases into a second type case set.
In an exemplary embodiment, each of the initial test cases carries usage information and a text description; in the aspect of encapsulating the initial test cases of the data objects and generating test cases corresponding to N data objects included in the batch file, the case encapsulating unit 14 is further configured to perform matrix filling processing on P2 initial test cases in the first type case set based on the number and the coverage frequency of the initial test cases corresponding to the N data objects, and the utilization rate information and the textual description carried by the P2 initial test cases in the first type case set, so as to obtain P4 processed effective subclass test cases; the matrix filling processing is used for merging the initial test cases in the first type case set, the first type case set is a set formed by effective initial test cases, and P2 is larger than P4; and
based on the number and the coverage frequency of each initial test case corresponding to the N data objects, and the utilization rate information and the Chinese description carried by the P3 initial test cases in the second type case set, performing matrix filling processing on the P3 initial test cases in the second type case set to obtain processed P5 invalid sub-type test cases; the matrix filling processing is used for merging the initial test cases in the second type case set, the second type case set is a set formed by invalid initial test cases, and P3 is larger than P5;
and packaging the P4 effective subclass test cases and the P5 ineffective subclass test cases to generate a first class test case corresponding to the N data objects contained in the batch file.
In an exemplary embodiment, the device 10 for generating a test case is further configured to execute obtaining preset R second case templates; the second example template is sample service data which is obtained based on assignment of S branch nodes in a second decision tree and corresponds to the financial service data, and the sample service data carries M2 kinds of service attribute information;
based on the association degree between the structural attribute information carried by the N data objects and the service attribute information carried by the R second case templates, deleting at least part of the initial test cases corresponding to the data objects;
and packaging the rest initial test cases of the N data objects to generate a second type of test case corresponding to the N data objects contained in the batch file.
In an exemplary embodiment, in an aspect that at least a part of the initial test case corresponding to each data object is deleted based on the association degree between the structure attribute information carried by the N data objects and the service attribute information carried by the R second case templates, the test case generation apparatus 10 is further configured to perform fuzzy matching on each data object and each second case template based on the structure attribute information corresponding to the N data objects and the service attribute information corresponding to the R second case templates, and determine the association degree between each data object and each second case template;
respectively taking the second use case template with the maximum corresponding association degree with each data object as an associated use case template of the corresponding data object;
determining whether there is an opposite characteristic between the structure attribute information carried by each initial test case corresponding to each data object and the service attribute information carried by the corresponding associated case template;
and deleting the initial test case corresponding to the anisotropic characteristic.
In an exemplary embodiment, the test case generating apparatus 10 is further configured to execute, in a second type of test case of the N data objects, determining, based on the validity of the assignment of the structure attribute information, valid structure attribute information in the remaining initial test cases corresponding to each of the data objects; and
determining effective service attribute information in the R second example templates based on the effectiveness of the attribute values of the M2 service attribute information carried in the sample service data;
determining the association degree between the effective structure attribute information corresponding to each initial test case and the effective service attribute information corresponding to each second case template;
and merging and recombining the initial test cases with the correlation degree larger than or equal to a first threshold value and the corresponding sample business data to generate a third type test case corresponding to a plurality of data objects contained in the batch file.
In an exemplary embodiment, the apparatus 10 for generating test cases is further configured to determine valid service attribute information in the R second case templates based on validity of attribute values of the service attribute information;
determining the degree of association between the corresponding effective service attribute information among the second example templates;
and merging and recombining the second example templates with the association degree larger than or equal to a second threshold value to obtain a new second example template.
FIG. 13 is a block diagram illustrating a server 20 for the generation of test cases in accordance with an exemplary embodiment. For example, the server 20 may be an electronic device. Referring to fig. 13, server 20 includes a processing component 21, which further includes one or more processors, and memory resources, represented by memory 22, for storing executable instructions, such as applications, that are executable by processing component 21. The application programs stored in memory 22 may include one or more modules that each correspond to a set of executable instructions. Furthermore, the processing component 21 is configured to execute executable instructions to perform the above described method.
In one embodiment, server 20 is an electronic device in which a computing system may run one or more operating systems, including any of the operating systems discussed above and any commercially available server operating systems. The server may also run any of a variety of additional server applications and/or intermediate tier applications, including HTTP (hypertext transfer protocol) servers, FTP (file transfer protocol) servers, CGI (common gateway interface) servers, database servers, and the like. Exemplary database servers include, but are not limited to, database servers commercially available from (international business machines) and the like.
In one embodiment, the processing component 21 generally controls overall operation of the server 20, such as operations associated with display, data processing, data communication, and recording operations. The processing component 21 may include one or more processors to execute instructions to perform all or part of the steps of the method described above. Further, the processing component 21 may include one or more modules that facilitate interaction between the processing component 21 and other components. For example, the processing component 21 may comprise a multimedia module to control the interaction between the user terminal and the processing component 21 using the multimedia component.
In one embodiment, the processor in the Processing component 21 may also be referred to as a Central Processing Unit (CPU). The processor may be an electronic chip having signal processing capabilities. The Processor may also be a general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. In addition, the processors may be collectively implemented by an integrated circuit chip.
In one embodiment, memory 22 is configured to store various types of data to support operations at server 20. Examples of such data include instructions for any application or method operating on server 20, captured data, messages, pictures, videos, and so forth. The memory 22 may be implemented by any type or combination of volatile or non-volatile storage devices, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, optical disk, or graphene memory.
In one embodiment, the storage 22 may be a memory bank, a TF card, etc., and may store all information in the server 20, including the input raw data, the computer program, the intermediate operation results, and the final operation results, which are stored in the storage 22 in one embodiment. It stores and retrieves information based on the location specified by the processor. With the memory 22 in one embodiment, the server 20 has a memory function to ensure proper operation. In one embodiment of server 20, storage 22 may be divided into primary storage (memory) and secondary storage (external storage) for each purpose, as well as a classification scheme into external storage and internal storage. The external memory is usually a magnetic medium, an optical disk, or the like, and can store information for a long period of time. The memory refers to a storage component on the main board, which is used for storing data and programs currently being executed, but is only used for temporarily storing the programs and the data, and the data is lost when the power is turned off or the power is cut off.
The server 20 may further include: a power component 23 is configured to perform power management of the server 20, a wired or wireless network interface 24 configured to connect the server 20 to a network, and an input/output (I/O) interface 25. The Server 20 may operate based on an operating system stored in memory 22, such as Windows Server, mac OS X, unix, linux, freeBSD, or the like.
In one embodiment, the power component 23 provides power to the various components of the server 20. The power components 23 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the server 20.
In one embodiment, the wired or wireless network interface 24 is configured to facilitate wired or wireless communication between the server 20 and other devices. The server 20 may access a wireless network based on a communication standard, such as WiFi, an operator network (such as 2G, 3G, 4G, or 5G), or a combination thereof.
In an exemplary embodiment, the wired or wireless network interface 24 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the wired or wireless network interface 24 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
In one embodiment, an input/output (I/O) interface 25 provides an interface between the processing component 21 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
FIG. 14 is a block diagram illustrating a computer-readable storage medium 30 for test case generation in accordance with an illustrative embodiment. The computer-readable storage medium 30 has stored therein program data 31 that can implement the above-described method.
The unit in which the functional units in the embodiments of the present application are integrated may be stored in the computer-readable storage medium 30 if it is implemented in the form of a software functional unit and sold or used as a separate product. Based on such understanding, the technical solution of the present application may be substantially implemented or contribute to the prior art, or all or part of the technical solution may be embodied in the form of a software product, and the computer-readable storage medium 30 includes several instructions for enabling a computer device (which may be a personal computer, a system server, or a network device, etc.), an electronic device (for example, MP3, MP4, etc., and may also be an intelligent terminal such as a mobile phone, a tablet computer, a wearable device, etc., or a desktop computer, etc.) or a processor (processor) to execute all or part of the steps of the method of the embodiments of the present application.
FIG. 15 is a block diagram illustrating a computer program product 40 for test case generation in accordance with an exemplary embodiment. The computer program product 40 comprises program instructions 41, the program data being executable by a processor of the server 20 for performing the method.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method of generating test cases, a device 10 for generating test cases, a server 20, a computer-readable storage medium 30 or a computer program product 40. Accordingly, 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 40 embodied on one or more computer program instructions 41 (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
The present application is described with reference to flowcharts and/or block diagrams of a method for generating a test case, a device 10 for generating a test case, a server 20, a computer-readable storage medium 30, or a computer program product 40 according to an embodiment of the present application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by a computer program product 40. These computer program products 40 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 program instructions 41 executed by 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 products 40 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 program instructions 41 stored in the computer program product 40 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 program instructions 41 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 program instructions 41 that 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.
It should be noted that the descriptions of the various methods, apparatuses, electronic devices, computer-readable storage media, computer program products, etc. according to the method embodiments may also include other embodiments, and specific implementation manners may refer to the descriptions of the related method embodiments, which are not described herein in detail.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (12)

1. A method for generating a test case is characterized in that the method comprises the following steps:
acquiring predefined N data objects contained in batch files containing financial service data to be processed; the data object is used for representing a data structure of the financial service data, and the data structure carries corresponding M1 kinds of structure attribute information;
acquiring N first example templates matched with the structural attribute information corresponding to the N data objects from a database; the N first example templates are sample test cases obtained based on L1 branch node assignments in a first decision tree, and each branch node is matched with at least one type of structure attribute information;
assigning the structural attribute information of the N data objects matched with the N first case templates based on the assignment types of the L1 branch nodes to generate P1 initial test cases for each data object; the initial test case comprises a valid initial test case and an invalid initial test case;
and packaging the initial test case of each data object to generate the test case corresponding to the N data objects contained in the batch file.
2. The method according to claim 1, wherein the first case templates carry at least part of the structure attribute information, and the structure attribute information carried by each of the first case templates matches with a corresponding one of the data objects;
the assigning the structure attribute information of the N data objects matched with the N first example templates based on the assignment types of the L1 branch nodes includes:
determining assignment types of L2 branch nodes corresponding to each first example template; the assignment type comprises a filling data type, a function assignment type and a random access type, and L1 is greater than L2;
assigning the structural attribute information of the data object respectively matched with each first case template according to the assignment types of the L2 branch nodes and a preset case generation rule;
the case generation rule includes presetting the number of test cases to be generated corresponding to the N data objects and case coverage frequency.
3. The method according to claim 2, wherein the structure attribute information carried by the data structure comprises a data type, a data length, an input type, an option type, and a data dictionary type;
after the generating P1 initial test cases for each of the data objects, further comprising:
identifying the P1 initial test cases as P2 effective initial test cases and P3 ineffective initial test cases based on the assignment of the structural attribute information corresponding to each initial test case; p1 is equal to the sum of P2 and P3;
and aggregating the P2 effective initial test cases into a first type case set, and aggregating the P3 ineffective initial test cases into a second type case set.
4. The method according to claim 1, wherein the initial test cases each carry usage information and a textual description;
the packaging the initial test cases of the data objects to generate the test cases corresponding to the N data objects contained in the batch file includes:
performing matrix filling processing on the P2 initial test cases in the first class case set based on the number and the coverage frequency of each initial test case corresponding to the N data objects, and the utilization rate information and the Chinese description carried by the P2 initial test cases in the first class case set to obtain P4 effective sub-class test cases after processing; the matrix filling processing is used for merging the initial test cases in the first type case set, the first type case set is a set formed by effective initial test cases, and P2 is larger than P4; and
based on the number and the coverage frequency of each initial test case corresponding to the N data objects, and the utilization rate information and the Chinese description carried by the P3 initial test cases in the second type case set, performing matrix filling processing on the P3 initial test cases in the second type case set to obtain processed P5 invalid sub-type test cases; the matrix filling processing is used for merging the initial test cases in the second type case set, the second type case set is a set formed by invalid initial test cases, and P3 is larger than P5;
and packaging the P4 effective subclass test cases and the P5 ineffective subclass test cases to generate a first class test case corresponding to the N data objects contained in the batch file.
5. The method of claim 1, further comprising:
acquiring preset R second example templates; the second example template is sample service data which is obtained based on assignment of S branch nodes in a second decision tree and corresponds to the financial service data, and the sample service data carries M2 kinds of service attribute information;
based on the association degree between the structural attribute information carried by the N data objects and the service attribute information carried by the R second case templates, deleting at least part of the initial test cases corresponding to the data objects;
and packaging the rest initial test cases of the N data objects to generate a second type of test case corresponding to the N data objects contained in the batch file.
6. The method according to claim 5, wherein the deleting at least part of the initial test cases corresponding to each of the data objects based on the degree of association between the structure attribute information carried by the N data objects and the service attribute information carried by the R second case templates includes:
based on the structural attribute information corresponding to the N data objects and the service attribute information corresponding to the R second example templates, performing fuzzy matching on each data object and each second example template respectively, and determining the association degree between each data object and each second example template;
respectively taking the second use case template with the maximum corresponding association degree with each data object as an associated use case template of the corresponding data object;
determining whether there is an opposite characteristic between the structure attribute information carried by each initial test case corresponding to each data object and the service attribute information carried by the corresponding associated case template;
and deleting the initial test case corresponding to the anisotropic characteristic.
7. The method of claim 5, further comprising:
in the second type test case of the N data objects, determining effective structure attribute information in the remaining initial test cases corresponding to each data object based on the effectiveness of assignment of the structure attribute information; and
determining effective service attribute information in the R second example templates based on the effectiveness of the attribute values of the M2 service attribute information carried in the sample service data;
determining the association degree between the effective structure attribute information corresponding to each initial test case and the effective service attribute information corresponding to each second case template;
and merging and recombining the initial test cases with the correlation degree larger than or equal to a first threshold value and the corresponding sample service data to generate a third type of test cases corresponding to the N data objects contained in the batch file.
8. The method of claim 5, further comprising:
determining effective service attribute information in the R second example templates based on the effectiveness of the attribute values of the service attribute information;
determining the degree of association between the corresponding effective service attribute information among the second example templates;
and merging and recombining the second example templates with the association degree larger than or equal to a second threshold value to obtain a new second example template.
9. An apparatus for generating a test case, comprising:
the system comprises a first acquisition unit, a second acquisition unit and a third acquisition unit, wherein the first acquisition unit is configured to execute acquisition of predefined N data objects contained in a batch file containing financial service data to be processed; the data object is used for representing a data structure of the financial service data, and the data structure carries corresponding M1 kinds of structure attribute information;
a second obtaining unit configured to perform obtaining, from a database, a plurality of first case templates that match the structure attribute information corresponding to the N data objects; the N first example templates are sample test cases obtained based on L1 branch node assignments in a first decision tree, and each branch node is matched with at least one type of structure attribute information;
the data assignment unit is configured to perform assignment on the basis of assignment types of the L1 branch nodes, assign the structural attribute information of the N data objects matched with the N first case templates, and generate P1 initial test cases for each data object; the initial test case comprises a valid initial test case and an invalid initial test case;
and the case packaging unit is configured to perform packaging of the initial test case of each data object, and generate the test cases corresponding to the N data objects contained in the batch file.
10. A server, comprising:
a processor;
a memory for storing executable instructions of the processor;
wherein the processor is configured to execute the executable instructions to implement the method of generating a test case of any one of claims 1 to 8.
11. A computer-readable storage medium including program data therein, which when executed by a processor of a server, enables the server to perform the method of generating a test case according to any one of claims 1 to 8.
12. A computer program product comprising program instructions which, when executed by a processor of a server, enable the server to perform the method of test case generation of any one of claims 1 to 8.
CN202211545515.0A 2022-12-05 2022-12-05 Test case generation method, test case generation device, server and storage medium Pending CN115774672A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211545515.0A CN115774672A (en) 2022-12-05 2022-12-05 Test case generation method, test case generation device, server and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211545515.0A CN115774672A (en) 2022-12-05 2022-12-05 Test case generation method, test case generation device, server and storage medium

Publications (1)

Publication Number Publication Date
CN115774672A true CN115774672A (en) 2023-03-10

Family

ID=85391243

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211545515.0A Pending CN115774672A (en) 2022-12-05 2022-12-05 Test case generation method, test case generation device, server and storage medium

Country Status (1)

Country Link
CN (1) CN115774672A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116594914A (en) * 2023-07-17 2023-08-15 腾讯科技(深圳)有限公司 Method, device, equipment and storage medium for generating test data

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116594914A (en) * 2023-07-17 2023-08-15 腾讯科技(深圳)有限公司 Method, device, equipment and storage medium for generating test data
CN116594914B (en) * 2023-07-17 2023-12-26 腾讯科技(深圳)有限公司 Method, device, equipment and storage medium for generating test data

Similar Documents

Publication Publication Date Title
US8417715B1 (en) Platform independent plug-in methods and systems for data mining and analytics
US9286329B2 (en) Generating analytics application using reusable application modules
CN107924406A (en) Selection is used for the inquiry performed to real-time stream
US20150186808A1 (en) Contextual data analysis using domain information
US10885087B2 (en) Cognitive automation tool
US7203671B1 (en) System and method for validating the technical correctness of an OLAP reporting project
US20210256396A1 (en) System and method of providing and updating rules for classifying actions and transactions in a computer system
US8260772B2 (en) Apparatus and method for displaying documents relevant to the content of a website
CN104541297A (en) Extensibility for sales predictor (SPE)
CN116594683A (en) Code annotation information generation method, device, equipment and storage medium
CN115774672A (en) Test case generation method, test case generation device, server and storage medium
CN115438740A (en) Multi-source data convergence and fusion method and system
Alghushairy et al. Data storage
US11704345B2 (en) Inferring location attributes from data entries
Huang Data processing
CN108874384A (en) Terminal device, server, web data processing method and computer storage medium
US8396847B2 (en) System and method to retrieve and analyze data for decision making
CN117009397A (en) Data query method, data query device, electronic equipment and storage medium
US11853196B1 (en) Artificial intelligence driven testing
CN115048456A (en) User label generation method and device, computer equipment and readable storage medium
CN112381509A (en) Management system for major special topic of national science and technology for creating major new drug
CN111400623A (en) Method and apparatus for searching information
Zhang Data Synthesis
Imran et al. Data Provenance
Zheng Cloud service and interactive IoT system application in the service management mode of logistics enterprises

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