An automated testing method and device based on business scenario library

Through the automated testing method based on the business scenario library, the problem of difficulty in covering the subtle modification and refined testing of code in the existing technology is solved, and efficient automated testing of large-scale business systems in the financial field is realized, reducing the risk of regression testing and hardware equipment costs.

CN113688044BActive Publication Date: 2024-12-17INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202110987001.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-26
Publication Date
2024-12-17
Estimated Expiration
2041-08-26

AI Technical Summary

Technical Problem

The existing software automation testing methods are difficult to cover the subtle modification of code segments during program development, and are difficult to conduct refined testing, especially in the testing of large-scale business systems in the financial field.

Method used

Using an automated test method based on the business scenario library, the initial business scenario library is generated by traversing the original test programs, comparing and changing the test programs with the original test programs, generating a combined business scenario library, and performing automated tests to realize automatic intelligent scene recognition and high-risk scenario analysis.

Benefits of technology

It improves testing efficiency, reduces the risk of regression testing, adapts to the fast version iteration cycle, and can analyze high-risk scenarios for testing when the test time is insufficient, reducing the cost of hardware equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113688044B_ABST
    Figure CN113688044B_ABST
Patent Text Reader

Abstract

The present application provides an automated testing method and device based on a business scenario library, which relates to the field of software testing and can also be used in the financial field, including: traversing the original program to be tested to generate an initial business scenario library corresponding to the original program to be tested; comparing the changed program to be tested with the original program to be tested, and generating a combined business scenario library based on the comparison result and the initial business scenario library; wherein the changed program to be tested is obtained by modifying the original program to be tested; and performing automated testing on the changed program to be tested based on the combined business scenario library. The present application can realize automated testing based on the business scenario library.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of software testing and can be used in the financial field. Specifically, it is an automated testing method and device based on a business scenario library. Background Art

[0002] For business systems in the financial sector, availability, stability and security are important criteria for evaluating system quality. Especially for large business systems, their quality is more directly related to the customer's trading experience. If a business system is put online without software testing, there may be huge security risks, causing irreparable losses. Therefore, before a business system is put into operation, it must undergo rigorous system testing.

[0003] In the process of testing business systems in the financial field, existing software automation testing methods (including black box testing and white box testing) are difficult to cover minor modifications to code segments during program development. Incomplete coverage is prone to occur during testing, and it is even more difficult to conduct refined testing for test scenarios of business systems. Summary of the invention

[0004] In view of the problems in the prior art, the present application provides an automated testing method and device based on a business scenario library, which can realize automated testing based on the business scenario library.

[0005] In order to solve the above technical problems, this application provides the following technical solutions:

[0006] In a first aspect, the present application provides an automated testing method based on a business scenario library, comprising:

[0007] Traversing the original program to be tested to generate an initial business scenario library corresponding to the original program to be tested;

[0008] Comparing the changed program to be tested with the original program to be tested, and generating a combined business scenario library according to the comparison result and the initial business scenario library; wherein the changed program to be tested is obtained by modifying the original program to be tested;

[0009] The changed program to be tested is automatically tested according to the combined business scenario library.

[0010] Further, the traversing the original program to be tested to generate an initial business scenario library corresponding to the original program to be tested includes:

[0011] Obtaining various types, objects and methods in the original program to be tested;

[0012] Determine the test nodes in the original program to be tested according to the classes, objects and methods;

[0013] An initial business scenario library of the original program to be tested is generated according to the test node.

[0014] Furthermore, the comparing the changed program to be tested with the original program to be tested, and generating a combined business scenario library according to the comparison result and the initial business scenario library, includes:

[0015] Comparing the changed program to be tested with the original program to be tested to determine classes, objects and methods that are added or deleted;

[0016] Modifying the test nodes in the initial business scenario library according to the newly added or deleted classes, objects and methods;

[0017] Determine whether the number of program lines of classes, objects, and methods that are not newly added or deleted has changed;

[0018] If yes, modify the test node in the initial business scenario library;

[0019] A combined business scenario library is generated according to the test nodes in the modified initial business scenario library.

[0020] Furthermore, the comparing the changed program to be tested with the original program to be tested, and generating a combined business scenario library according to the comparison result and the initial business scenario library, includes:

[0021] Comparing the changed program to be tested with the original program to be tested to determine classes, objects and methods that are added or deleted;

[0022] Modifying the test nodes in the initial business scenario library according to the newly added or deleted classes, objects and methods;

[0023] Determine whether program keywords of classes, objects, and methods that are not newly added or deleted have changed;

[0024] If yes, modify the test node in the initial business scenario library;

[0025] A combined business scenario library is generated according to the test nodes in the modified initial business scenario library.

[0026] In a second aspect, the present application provides an automated testing device based on a business scenario library, comprising:

[0027] An initial scenario library generating unit, used for traversing the original program to be tested to generate an initial business scenario library corresponding to the original program to be tested;

[0028] A combined scenario library generating unit is used to compare the changed program to be tested with the original program to be tested, and generate a combined business scenario library according to the comparison result and the initial business scenario library; wherein the changed program to be tested is obtained by modifying the original program to be tested;

[0029] The automated testing unit is used to perform automated testing on the changed program to be tested according to the combined business scenario library.

[0030] Furthermore, the initial scene library generating unit includes:

[0031] An acquisition module, used to acquire various types, objects and methods in the original program to be tested;

[0032] A test node determination module, used to determine the test nodes in the original program to be tested according to the class, object and method;

[0033] The initial scenario library generation module is used to generate an initial business scenario library of the original program to be tested according to the test node.

[0034] Furthermore, the combined scene library generating unit includes:

[0035] An addition and deletion determination module, used to compare the changed program to be tested with the original program to be tested, and determine the classes, objects and methods that are added or deleted;

[0036] An initial scenario library modification module, used to modify the test nodes in the initial business scenario library according to the newly added or deleted classes, objects and methods;

[0037] A program line number change determination module is used to determine whether the program line number of non-newly added or non-deleted classes, objects and methods has changed;

[0038] The initial scenario library modification module is used to modify the test nodes in the initial business scenario library when the number of rows changes;

[0039] The combined scenario library generation module is used to generate a combined business scenario library according to the test nodes in the modified initial business scenario library.

[0040] Furthermore, the combined scene library generating unit includes:

[0041] An addition and deletion determination module, used to compare the changed program to be tested with the original program to be tested, and determine the classes, objects and methods that are added or deleted;

[0042] The initial scenario library modification module is used to modify the test nodes in the initial business scenario library according to the newly added or deleted classes, objects and methods;

[0043] A keyword change determination module is used to determine whether program keywords of non-newly added or non-deleted classes, objects, and methods have changed;

[0044] The initial scenario library modification module is used to modify the test nodes in the initial business scenario library when the keywords change;

[0045] The combined scenario library generation module is used to generate a combined business scenario library according to the test nodes in the modified initial business scenario library.

[0046] In a third aspect, the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the automated testing method based on the business scenario library when executing the program.

[0047] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the automated testing method based on the business scenario library.

[0048] In response to the problems in the prior art, the automated testing method and device based on the business scenario library provided by the present application can perform automatic intelligent scenario recognition, and provide an automated testing method based on the business scenario library with low hardware equipment cost in the field of white box testing. When the testing time is not sufficient, high-risk scenarios can be analyzed according to the amount of program changes for testing, adapting to the rapid version iteration cycle, improving testing efficiency, and reducing regression testing risks. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0050] Figure 1 This is a flowchart of an automated testing method based on a business scenario library in an embodiment of the present application;

[0051] Figure 2 This is one of the program logic diagrams in the embodiment of this application;

[0052] Figure 3 This is the second program logic diagram in the embodiment of this application;

[0053] Figure 4 A flowchart for generating an initial business scenario library in an embodiment of the present application;

[0054] Figure 5 One of the flowcharts for generating a combined business scenario library in an embodiment of the present application;

[0055] Figure 6 This is the second flowchart of generating a combined business scenario library in an embodiment of the present application;

[0056] Figure 7 This is one of the structural diagrams of the automated testing device based on the business scenario library in the embodiment of the present application;

[0057] Figure 8 This is a structural diagram of an initial scene library generation unit in an embodiment of the present application;

[0058] Fig. 9 This is one of the structural diagrams of the combined scene library generation unit in the embodiment of the present application;

[0059] Fig.10 This is the second structural diagram of the combined scene library generation unit in the embodiment of the present application;

[0060] Fig.11 A schematic diagram of the structure of an electronic device in an embodiment of the present application;

[0061] Fig.12 This is the third program logic diagram of the embodiment of the present application;

[0062] Fig.13 This is the fourth program logic diagram of the embodiment of the present application;

[0063] Fig.14 This is the fifth program logic diagram of the embodiment of the present application. DETAILED DESCRIPTION

[0064] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0065] It should be noted that the automated testing method and device based on the business scenario library provided in the present application can be used in the financial field, and can also be used in any field other than the financial field. The application field of the automated testing method and device based on the business scenario library provided in the present application is not limited.

[0066] In one embodiment, see Figure 1 In order to implement automated testing based on a business scenario library, the present application provides an automated testing method based on a business scenario library, including:

[0067] S101: traversing the original program to be tested to generate an initial business scenario library corresponding to the original program to be tested;

[0068] S102: Compare the changed program to be tested with the original program to be tested, and generate a combined business scenario library according to the comparison result and the initial business scenario library; wherein the changed program to be tested is obtained by modifying the original program to be tested;

[0069] S103: Performing automated testing on the changed program to be tested according to the combined business scenario library.

[0070] It is understandable that the method described in the present application can search for various types, objects and methods of the original program to be tested when traversing the original program to be tested, and these classes, objects and methods are determined as test nodes. According to the logical trend of the test node and the program, a test branch (scenario) can be determined. The initial business scenario library includes the test branches (scenario) formed by the nodes corresponding to the classes, objects and methods in the original program to be tested and the logical relationship between each node. When the original program to be tested is modified to form a change to the program to be tested, the test nodes can be added, deleted or modified to modify the test branches (scenario) in the initial business scenario library, thereby forming a combined business scenario library. The combined business scenario library includes the test branches (scenario) formed by the nodes corresponding to the classes, objects and methods contained in the change to be tested and the logical relationship between each node.

[0071] Each test branch (scenario) in the combined business scenario library corresponds to a script. A test script can be written according to the test branches (scenario) in the combined business scenario library. By setting the execution order of the test script, the automated script of the combined business scenario library can be executed. The generation process of the test script can be automatically generated by a computer or manually assisted in generation, and this application is not limited to this.

[0072] For example, a program that compares three numbers has the following pseudo code:

[0073] Begin

[0074] Input A, B, C;

[0075] IF A>B, then MAX=A;

[0076] Otherwise MAX = B;

[0077] IF C>MAX, then MAX=C;

[0078] Print MAX;

[0079] End

[0080] See also Figure 2 , there are a total of 4 branches from the beginning to the end: (1)->(2)->(3)->(4)->(5)->End; (1)->(2)->(3)->(4)->(6)->End; (1)->(2)->(7)->(8)->(9)->End; (1)->(2)->(7)->(8)->(10)->End.

[0081] See also Figure 3 At this time, if the original program to be tested is modified and one node B is reduced, there are two branches from the beginning to the end:

[0082] (1)->(3)->(4)->(5)->End; (1)->(3)->(4)->(6)->End.

[0083] The method provided in this application solves the problem of how to add or delete a node on a test branch (scenario) in an existing (initial) scene set, thereby obtaining a new (combined) scene set, and finally realizing automated testing based on the new (combined) scene set.

[0084] From the above description, it can be seen that the automated testing method based on the business scenario library provided by the present application can perform automatic intelligent scenario recognition, and provide an automated testing method based on the business scenario library with low hardware equipment cost in the field of white box testing. When the testing time is not sufficient, high-risk scenarios can be analyzed according to the amount of program changes for testing, adapting to the rapid version iteration cycle, improving testing efficiency, and reducing regression testing risks.

[0085] In one embodiment, see Figure 4 , traverse the original program to be tested to generate an initial business scenario library corresponding to the original program to be tested, including:

[0086] S401: Acquire various types, objects and methods in the original program to be tested;

[0087] S402: Determine the test nodes in the original program to be tested according to the class, object and method;

[0088] S403: Generate an initial business scenario library of the original program to be tested according to the test node.

[0089] It can be understood that by traversing the original program to be tested, various classes, objects and methods in the original program to be tested can be obtained; according to actual testing needs, these classes, objects and methods can be determined as test nodes in the original program to be tested; combined with the logical branching direction of the original program to be tested, these test nodes can form test branches (scenarios); these test branches (scenarios) can be combined to obtain the initial business scenario library.

[0090] It can be seen from the above description that the automated testing method based on the business scenario library provided in the present application can traverse the original program to be tested to generate an initial business scenario library corresponding to the original program to be tested.

[0091] In one embodiment, see Figure 5 , compare the changed program to be tested with the original program to be tested, and generate a combined business scenario library based on the comparison results and the initial business scenario library, including:

[0092] S501: Compare the changed program to be tested with the original program to be tested to determine the classes, objects and methods that are added or deleted;

[0093] S502: modifying the test nodes in the initial business scenario library according to the added or deleted classes, objects and methods;

[0094] S503: Determine whether the number of program lines of the classes, objects, and methods that are not newly added or deleted has changed;

[0095] S504: If yes, modify the test node in the initial business scenario library;

[0096] S505: Generate a combined business scenario library according to the test nodes in the modified initial business scenario library.

[0097] It is understandable that the business scenarios corresponding to the program before modification are first sorted out, and a relationship library is established to refine the role of a certain function, class or method and the business scenarios involved. The classes, objects or methods involved in the changes (addition, modification or deletion) before and after the modification are analyzed; based on the changed classes, objects or methods, the combined business scenarios involved in the modification of the program can be generated.

[0098] Specifically, the number of text code lines can be counted, the number of lines added or reduced before and after the modification can be compared, and the specific content of the program modification can be obtained, including but not limited to classes, objects or methods.

[0099] In one embodiment, before modification, the classes, objects or methods of the original program under test are traversed and can be stored in library A; after modification, the classes, objects or methods of the changed program under test are traversed and can be stored in library B; A is compared with B, and the added or reduced classes, objects or methods are stored in library C.

[0100] By analyzing the classes, objects or methods in library C, we can derive test branches (scenarios); in some cases, the names of the classes, objects and methods in library A and library B have not changed, but the number of lines of code has changed, which means that the function or method name has not changed, but the internal function has changed.

[0101] In one embodiment, the number of lines of code of functions or methods in library A and library B can be compared, and those with changes can be put into library D. By analyzing the classes, objects or methods of library D, new test branches (scenarios) can be obtained. That is, a combined business scenario library is generated.

[0102] From the above description, it can be seen that the automated testing method based on the business scenario library provided in the present application can compare the changed program to be tested with the original program to be tested, and generate a combined business scenario library based on the comparison results and the initial business scenario library.

[0103] In one embodiment, see Figure 6 , compare the changed program to be tested with the original program to be tested, and generate a combined business scenario library based on the comparison results and the initial business scenario library, including:

[0104] S601: Compare the changed program to be tested with the original program to be tested to determine the classes, objects and methods that are added or deleted;

[0105] S602: modifying the test nodes in the initial business scenario library according to the added or deleted classes, objects and methods;

[0106] S603: Determine whether the program keywords of the classes, objects, and methods that are not newly added or deleted have changed;

[0107] S604: If yes, modify the test node in the initial business scenario library;

[0108] S605: Generate a combined business scenario library according to the test nodes in the modified initial business scenario library.

[0109] It can be understood that the logic of this embodiment is substantially the same as that of the embodiment described in step S501 to step S505, and the only difference is that step S503 is to determine whether the number of program lines of non-newly added or non-deleted classes, objects, and methods has changed, while this embodiment is a refinement of the embodiment described in step S501 to step S505, that is, to determine whether the program keywords of non-newly added or non-deleted classes, objects, and methods have changed. Compared with only checking the change in the number of program lines, the inspection granularity of this embodiment is finer, and the changed nodes can be locked more accurately, thereby modifying the combined business scenario library.

[0110] From the above description, it can be seen that the automated testing method based on the business scenario library provided in the present application can compare the changed program to be tested with the original program to be tested, and generate a combined business scenario library based on the comparison results and the initial business scenario library.

[0111] The method provided by this application can achieve the technical effect described in this application, and an example is given below to verify. After each version modification program is submitted, the incremental scenario is automatically or manually triggered to associate with the relationship library to generate the combined business scenario involved in modifying the program.

[0112] In one embodiment, the modified program is traversed, and according to the execution path, a new combined business scenario library is generated for each test node using functions and classes as judgment conditions. After comparing the combined business scenario library with the initial business scenario library, an incremental business scenario library corresponding to the interface, function or method can also be obtained. The incremental business scenario library reflects the difference between the combined business scenario library and the initial business scenario library.

[0113] In one embodiment, the business scenarios corresponding to the program can be sorted out and improved, and a relationship library can be established to refine the role of a certain class or method and the business scenarios involved, as shown in the following table.

[0114] Calling interface Called interface Function or method Scenario Interface 1 Interface 2 Method 1() Scene 1, Scene 2 Interface 1 Interface 2 Method 2() Scene 1, Scene 2, Scene 3 Interface 1 Interface 2 Method 3() Scene 1, Scene 2, Scene 3

[0115] In one embodiment, after each version modification program is submitted, it can automatically trigger the acquisition of the initial business scenario library and the incremental business scenario library to generate a combined business scenario library corresponding to the modified program.

[0116] Fig.12 The corresponding procedures can be understood as follows:

[0117]

[0118] See also Fig.13 , reduce methods, delete method 4, affect scenes 1, 3, pull out pile 4, scene reduction.

[0119] a->b->1->2->5 Scene 2 Path piling blue flag

[0120] a->b->1->2->3 Scene 4 Path Piling Yellow Flag

[0121] a->b->6 Scene 5 Path Piling Black Flag

[0122] See also Fig.14 , added method 7, added scene 6 and scene 7, green flag and orange flag for piling.

[0123]

[0124] In this embodiment, the initial business scenario library can be registered in the first phase of product development. The function corresponding to each method should be clearly stated when annotating the product code to facilitate semantic identification. The methods or functions in the program need to be registered for stubbing. Thereafter, when the first node and the final node are added, deleted or modified, the test nodes can be traversed and reorganized, and the functional description of the changed test nodes can be output with the new path, and the scenario description can be output with the stock (old) path, so as to facilitate the subsequent improvement of the business scenario library.

[0125] Based on the same inventive concept, the embodiment of the present application also provides an automated testing device based on a business scenario library, which can be used to implement the method described in the above embodiment, as described in the following embodiment. Since the principle of solving the problem by the automated testing device based on the business scenario library is similar to the automated testing method based on the business scenario library, the implementation of the automated testing device based on the business scenario library can refer to the implementation of the method based on software performance benchmark determination, and the repetitions are not repeated. As used below, the term "unit" or "module" can implement a combination of software and / or hardware for a predetermined function. Although the system described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.

[0126] In one embodiment, see Figure 7 In order to implement automated testing based on a business scenario library, the present application provides an automated testing device based on a business scenario library, including: an initial scenario library generation unit 701, a combined scenario library generation unit 702 and an automated testing unit 703.

[0127] An initial scenario library generating unit 701 is used to traverse the original program to be tested to generate an initial business scenario library corresponding to the original program to be tested;

[0128] The combined scenario library generating unit 702 is used to compare the changed program to be tested with the original program to be tested, and generate a combined business scenario library according to the comparison result and the initial business scenario library; wherein the changed program to be tested is obtained by modifying the original program to be tested;

[0129] The automated testing unit 703 is used to perform automated testing on the changed program to be tested according to the combined business scenario library.

[0130] In one embodiment, see Figure 8 The initial scene library generating unit 701 comprises:

[0131] The acquisition module 801 is used to acquire various types, objects and methods in the original program to be tested;

[0132] A test node determination module 802, configured to determine the test nodes in the original program to be tested according to the class, object and method;

[0133] The initial scenario library generation module 803 is used to generate an initial business scenario library of the original program to be tested according to the test node.

[0134] In one embodiment, see Fig. 9 The combined scene library generating unit 702 includes:

[0135] The addition and deletion determination module 901 is used to compare the changed program to be tested with the original program to be tested to determine the classes, objects and methods that are added or deleted;

[0136] An initial scenario library modification module 902 is used to modify the test nodes in the initial business scenario library according to the newly added or deleted classes, objects and methods;

[0137] A program line number change determination module 903 is used to determine whether the program line number of non-newly added or non-deleted classes, objects and methods has changed;

[0138] The initial scenario library modification module 902 is further used to modify the test nodes in the initial business scenario library when the number of rows changes;

[0139] The combined scenario library generating module 904 is used to generate a combined business scenario library according to the test nodes in the modified initial business scenario library.

[0140] In one embodiment, see Fig.10 The combined scene library generating unit 702 includes:

[0141] The addition and deletion determination module 901 is used to compare the changed program to be tested with the original program to be tested to determine the classes, objects and methods that are added or deleted;

[0142] The initial scenario library modification module 902 is used to modify the test nodes in the initial business scenario library according to the added or deleted classes, objects and methods;

[0143] A keyword change determination module 1003 is used to determine whether program keywords of non-newly added or non-deleted classes, objects, and methods have changed;

[0144] The initial scenario library modification module 902 is further used to modify the test node in the initial business scenario library when the keyword changes;

[0145] The combined scenario library generating module 904 is used to generate a combined business scenario library according to the test nodes in the modified initial business scenario library.

[0146] From a hardware perspective, in order to implement automated testing based on a business scenario library, the present application provides an embodiment of an electronic device for implementing all or part of the contents of the automated testing method based on the business scenario library, and the electronic device specifically includes the following contents:

[0147] Processor, memory, communication interface and bus; wherein the processor, memory and communication interface communicate with each other through the bus; the communication interface is used to realize information transmission between the automated testing device based on the business scenario library and related equipment such as the core business system, user terminal and related database; the logic controller can be a desktop computer, a tablet computer and a mobile terminal, etc., but the present embodiment is not limited thereto. In the present embodiment, the logic controller can be implemented with reference to the embodiment of the automated testing method based on the business scenario library and the embodiment of the automated testing device based on the business scenario library in the embodiment, and the contents thereof are incorporated herein, and the repeated parts are not repeated.

[0148] It is understandable that the user terminal may include a smart phone, a tablet electronic device, a network set-top box, a portable computer, a desktop computer, a personal digital assistant (PDA), a vehicle-mounted device, a smart wearable device, etc. Among them, the smart wearable device may include smart glasses, a smart watch, a smart bracelet, etc.

[0149] In practical applications, part of the automated testing method based on the business scenario library can be executed on the electronic device side as described above, or all operations can be completed in the client device. The specific selection can be based on the processing capability of the client device and the limitations of the user's usage scenario. This application does not limit this. If all operations are completed in the client device, the client device may also include a processor.

[0150] The client device may have a communication module (i.e., a communication unit) that can communicate with a remote server to achieve data transmission with the server. The server may include a server on the task scheduling center side, and other implementation scenarios may also include a server on an intermediate platform, such as a server on a third-party server platform that has a communication link with the task scheduling center server. The server may include a single computer device, or a server cluster consisting of multiple servers, or a server structure of a distributed device.

[0151] Fig.11 FIG. 9 is a schematic block diagram of the system structure of the electronic device 9600 according to an embodiment of the present application. Fig.11As shown, the electronic device 9600 may include a central processor 9100 and a memory 9140; the memory 9140 is coupled to the central processor 9100. It is worth noting that Fig.11 is exemplary; other types of structures may also be used to supplement or replace this structure to implement telecommunication functions or other functions.

[0152] In one embodiment, the automated testing method function based on the business scenario library may be integrated into the central processing unit 9100. The central processing unit 9100 may be configured to perform the following control:

[0153] S101: traversing the original program to be tested to generate an initial business scenario library corresponding to the original program to be tested;

[0154] S102: Compare the changed program to be tested with the original program to be tested, and generate a combined business scenario library according to the comparison result and the initial business scenario library; wherein the changed program to be tested is obtained by modifying the original program to be tested;

[0155] S103: Performing automated testing on the changed program to be tested according to the combined business scenario library.

[0156] From the above description, it can be seen that the automated testing method based on the business scenario library provided by the present application is capable of automatic intelligent scenario recognition, and provides an automated testing method based on the business scenario library with low hardware equipment cost in the field of white-box testing. When the testing time is not sufficient, high-risk scenarios can be analyzed according to the amount of program changes for testing, adapting to the rapid version iteration cycle, improving testing efficiency, and reducing regression testing risks.

[0157] In another embodiment, the automated testing device based on the business scenario library can be configured separately from the central processing unit 9100. For example, the data compound transmission device based on the automated testing device based on the business scenario library can be configured as a chip connected to the central processing unit 9100, and the functions of the automated testing method based on the business scenario library can be realized through the control of the central processing unit.

[0158] like Fig.11 As shown, the electronic device 9600 may also include: a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It is worth noting that the electronic device 9600 does not necessarily have to include Fig.11 In addition, the electronic device 9600 may also include Fig.11 For components not shown, reference may be made to the prior art.

[0159] like Fig.11As shown, the central processing unit 9100 is sometimes also referred to as a controller or an operation control, and may include a microprocessor or other processor device and / or logic device. The central processing unit 9100 receives input and controls the operation of various components of the electronic device 9600.

[0160] The memory 9140 may be, for example, one or more of a cache, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory or other suitable devices. The above-mentioned information related to the failure may be stored, and a program for executing the relevant information may also be stored. The CPU 9100 may execute the program stored in the memory 9140 to implement information storage or processing, etc.

[0161] The input unit 9120 provides input to the central processing unit 9100. The input unit 9120 is, for example, a key or a touch input device. The power supply 9170 is used to provide power to the electronic device 9600. The display 9160 is used to display display objects such as images and texts. The display may be, for example, an LCD display, but is not limited thereto.

[0162] The memory 9140 may be a solid-state memory, such as a read-only memory (ROM), a random access memory (RAM), a SIM card, etc. It may also be a memory that saves information even when the power is off, can be selectively erased, and is provided with more data, examples of which are sometimes referred to as EPROMs, etc. The memory 9140 may also be some other type of device. The memory 9140 includes a buffer memory 9141 (sometimes referred to as a buffer). The memory 9140 may include an application / function storage unit 9142, which is used to store application programs and function programs or processes for executing the operation of the electronic device 9600 through the central processor 9100.

[0163] The memory 9140 may also include a data storage unit 9143 for storing data, such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit 9144 of the memory 9140 may include various drivers for communication functions of the electronic device and / or for executing other functions of the electronic device (such as messaging applications, address book applications, etc.).

[0164] The communication module 9110 is a transmitter / receiver 9110 that sends and receives signals via an antenna 9111. The communication module (transmitter / receiver) 9110 is coupled to the central processor 9100 to provide input signals and receive output signals, which may be the same as the case of a conventional mobile communication terminal.

[0165] Based on different communication technologies, multiple communication modules 9110 may be provided in the same electronic device, such as a cellular network module, a Bluetooth module and / or a wireless LAN module. The communication module (transmitter / receiver) 9110 is also coupled to a speaker 9131 and a microphone 9132 via an audio processor 9130 to provide an audio output via the speaker 9131 and receive an audio input from the microphone 9132, thereby realizing a common telecommunication function. The audio processor 9130 may include any suitable buffer, decoder, amplifier, etc. In addition, the audio processor 9130 is also coupled to the central processor 9100, so that recording can be performed on the local machine through the microphone 9132, and the sound stored on the local machine can be played through the speaker 9131.

[0166] The embodiments of the present application also provide a computer-readable storage medium capable of implementing all steps of the automated testing method based on a business scenario library in the above embodiments, where the execution subject is a server or a client. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, all steps of the automated testing method based on a business scenario library in the above embodiments are implemented. For example, when the processor executes the computer program, the following steps are implemented:

[0167] S101: traversing the original program to be tested to generate an initial business scenario library corresponding to the original program to be tested;

[0168] S102: Compare the changed program to be tested with the original program to be tested, and generate a combined business scenario library according to the comparison result and the initial business scenario library; wherein the changed program to be tested is obtained by modifying the original program to be tested;

[0169] S103: Performing automated testing on the changed program to be tested according to the combined business scenario library.

[0170] From the above description, it can be seen that the automated testing method based on the business scenario library provided by the present application is capable of automatic intelligent scenario recognition, and provides an automated testing method based on the business scenario library with low hardware equipment cost in the field of white-box testing. When the testing time is not sufficient, high-risk scenarios can be analyzed according to the amount of program changes for testing, adapting to the rapid version iteration cycle, improving testing efficiency, and reducing regression testing risks.

[0171] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0172] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (apparatus), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0173] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0174] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0175] The present invention uses specific embodiments to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. An automated testing method based on a business scenario library, It is characterized in that include: Traversing the original program to be tested to generate an initial business scenario library corresponding to the original program to be tested; Compare the changed program to be tested with the original program to be tested, and generate a combined business scenario library according to the comparison result and the initial business scenario library; wherein the changed program to be tested is obtained by modifying the original program to be tested; specifically, count the number of lines of text code, and compare the number of lines of code increased or decreased before and after the modification to obtain the specific content of the program modification, including classes, objects or methods; before the modification, traverse the classes, objects or methods of the original program to be tested, and enter library A; after the modification, traverse the classes, objects or methods of the changed program to be tested, and enter library B; compare A with B, and compare the increased or decreased classes, objects or methods and enter library C; analyze the classes, objects or methods in library C to obtain the test scenario; Performing automated testing on the changed program to be tested according to the combined business scenario library; Among them, after comparing the combined business scenario library with the initial business scenario library, an incremental business scenario library corresponding to the interface, function or method is also obtained; wherein, the incremental business scenario library reflects the difference between the combined business scenario library and the initial business scenario library; wherein, the business scenarios corresponding to the program are sorted out and improved, and a relationship library is established, which is refined to the role of the class or method and the business scenarios involved; after each version modification program is submitted, it is automatically triggered to obtain the initial business scenario library and the incremental business scenario library, and generate the combined business scenario library corresponding to the modified program.

2. According to the automated testing method based on the business scenario library according to claim 1, It is characterized in that The traversing the original program to be tested to generate an initial business scenario library corresponding to the original program to be tested includes: Obtaining various types, objects and methods in the original program to be tested; Determine the test nodes in the original program to be tested according to the classes, objects and methods; An initial business scenario library of the original program to be tested is generated according to the test node.

3. According to the automated testing method based on the business scenario library according to claim 1, It is characterized in that The comparing the changed program to be tested with the original program to be tested, and generating a combined business scenario library according to the comparison result and the initial business scenario library, includes: Comparing the changed program to be tested with the original program to be tested to determine classes, objects and methods that are added or deleted; Modifying the test nodes in the initial business scenario library according to the newly added or deleted classes, objects and methods; Determine whether the number of program lines of classes, objects, and methods that are not newly added or deleted has changed; If yes, modify the test node in the initial business scenario library; A combined business scenario library is generated according to the test nodes in the modified initial business scenario library.

4. The automated testing method based on the business scenario library according to claim 1, It is characterized in that The comparing the changed program to be tested with the original program to be tested, and generating a combined business scenario library according to the comparison result and the initial business scenario library, includes: Comparing the changed program to be tested with the original program to be tested to determine classes, objects and methods that are added or deleted; Modifying the test nodes in the initial business scenario library according to the newly added or deleted classes, objects and methods; Determine whether program keywords of classes, objects, and methods that are not newly added or deleted have changed; If yes, modify the test node in the initial business scenario library; A combined business scenario library is generated according to the test nodes in the modified initial business scenario library.

5. An automated testing device based on a business scenario library, It is characterized in that include: An initial scenario library generating unit, used for traversing the original program to be tested to generate an initial business scenario library corresponding to the original program to be tested; A combined scenario library generation unit is used to compare the changed program to be tested with the original program to be tested, and generate a combined business scenario library according to the comparison result and the initial business scenario library; wherein the changed program to be tested is obtained by modifying the original program to be tested; specifically, the number of lines of text code is counted, and the number of lines of code increased or decreased before and after the modification is compared to obtain the specific content of the program modification, including classes, objects or methods; before the modification, the classes, objects or methods of the original program to be tested are traversed and stored in library A; after the modification, the classes, objects or methods of the changed program to be tested are traversed and stored in library B; A is compared with B, and the classes, objects or methods that are increased or decreased are compared and stored in library C; the classes, objects or methods in library C are analyzed to obtain the test scenario; An automated testing unit, used to perform automated testing on the changed program to be tested according to the combined business scenario library; Among them, after comparing the combined business scenario library with the initial business scenario library, an incremental business scenario library corresponding to the interface, function or method is also obtained; wherein, the incremental business scenario library reflects the difference between the combined business scenario library and the initial business scenario library; wherein, the business scenarios corresponding to the program are sorted out and improved, and a relationship library is established, which is refined to the role of the class or method and the business scenarios involved; after each version modification program is submitted, it is automatically triggered to obtain the initial business scenario library and the incremental business scenario library, and generate the combined business scenario library corresponding to the modified program.

6. The automated testing device based on the business scenario library according to claim 5, It is characterized in that The initial scene library generating unit comprises: An acquisition module, used to acquire various types, objects and methods in the original program to be tested; A test node determination module, used to determine the test nodes in the original program to be tested according to the class, object and method; The initial scenario library generation module is used to generate an initial business scenario library of the original program to be tested according to the test node.

7. The automated testing device based on the business scenario library according to claim 5, It is characterized in that The combined scene library generating unit comprises: An addition and deletion determination module, used to compare the changed program to be tested with the original program to be tested, and determine the classes, objects and methods that are added or deleted; An initial scenario library modification module, used to modify the test nodes in the initial business scenario library according to the newly added or deleted classes, objects and methods; A program line number change determination module is used to determine whether the program line number of non-newly added or non-deleted classes, objects and methods has changed; The initial scenario library modification module is used to modify the test nodes in the initial business scenario library when the number of rows changes; The combined scenario library generation module is used to generate a combined business scenario library according to the test nodes in the modified initial business scenario library.

8. The automated testing device based on the business scenario library according to claim 7, It is characterized in that The combined scene library generating unit comprises: The addition and deletion determination module is used to compare the changed program to be tested with the original program to be tested to determine the classes, objects and methods that are added or deleted; The initial scenario library modification module is used to modify the test nodes in the initial business scenario library according to the newly added or deleted classes, objects and methods; A keyword change determination module is used to determine whether program keywords of non-newly added or non-deleted classes, objects, and methods have changed; The initial scenario library modification module is used to modify the test nodes in the initial business scenario library when the keywords change; The combined scenario library generation module is used to generate a combined business scenario library according to the test nodes in the modified initial business scenario library.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, It is characterized in that When the processor executes the program, the steps of the automated testing method based on the business scenario library described in any one of claims 1 to 4 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the automated testing method based on the business scenario library described in any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Source code change influence analyzing and testing method for software units and components with combination of phase

    CN102880547A

  • Automatic test case generation method and system based on scene method

    CN110597730A

  • Combined service test case set reduction method and device based on change history

    CN111858301A

  • Incremental code coverage rate testing method and device, storage medium and electronic equipment

    CN112799939A