Program testing system, program testing method, device and electronic equipment
By setting program tags and test scripts for the financial institution customer information system interface, scanning the code base by looping, determining and testing program branches, the problem that upstream applications cannot recognize the interface running branches, and improving the test accuracy.
Patent Information
- Application Number
- CN202210995057.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-18
- Publication Date
- 2025-08-29
- Estimated Expiration
- 2042-08-18
AI Technical Summary
When testing between customer information system interface applications of financial institutions, upstream applications cannot determine which program branches are running on the target information system interface, resulting in missed tests and low test accuracy.
By setting program tags and test scripts for multiple program branches running on each interface of the target information system, scanning the target code base itself, determining the program branches running on the interface, and calling the test script based on the program tag to generate test data, accessing the program branches to determine the test pass.
Ensure the integrity of the test, improve the test accuracy, clarify the specific program branches of the target information system interface, and avoid test omissions.
Smart Images

Figure CN115269436B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of financial technology, and specifically, to a program testing system and program testing method, device and electronic equipment. Background Art
[0002] Currently, the customer information system interfaces of financial institutions are frequently called by various upstream applications to implement various financial services. In order to ensure that the customer information system can be called normally, it is necessary to test the program branches running on the customer information system interfaces. However, in the existing technology, when joint testing is performed between customer information system interface applications, the upstream calling application cannot understand which program branches are running on the customer information system interface, which can easily lead to test omissions.
[0003] Regarding the problem in related technologies that when conducting joint testing between target information system interface applications, the upstream application cannot clearly know which program branches the target information system interface runs, which easily leads to test omissions and low test accuracy. No effective solution has been proposed yet. Summary of the Invention
[0004] The main purpose of this application is to provide a program testing system and a program testing method, device and electronic equipment to solve the problem in the related art that when conducting joint testing between target information system interface applications, the upstream application cannot clearly know which program branches are running on the target information system interface, which easily leads to test omissions and causes relatively low test accuracy.
[0005] To achieve the above-mentioned object, according to one aspect of the present application, a program testing system is provided. The system includes: a branch setting unit, configured to set program labels and a test script for each program branch running on each interface in a target information system, and transmit the program labels and the test script for each program branch to a branch detection unit; a branch input unit, configured to self-loop scan a target code library to obtain multiple target interfaces called by a target application in the target information system, and transmit the code information of the target interfaces to the branch detection unit to determine the multiple program branches running on the target interfaces and the program labels of each program branch; the branch input unit is further configured to transmit the program branch to be tested and the program labels corresponding to the program branch to be tested to the branch detection unit; the branch detection unit is configured to call the test script corresponding to the program branch to be tested based on the program label corresponding to the program branch to be tested, and generate test data corresponding to the program branch to be tested; the branch detection unit is further configured to access the program branch to be tested, obtain query data corresponding to the program branch to be tested, and determine that the test of the program branch to be tested has passed if the test data and the query data are the same.
[0006] Furthermore, the branch input unit includes: a code self-scanning module, which is used to self-loop scan the target code library to obtain multiple target interfaces called by the target application in the target information system, and send the code information of the target interface to the branch detection unit to determine the multiple program branches running by the target interface and the program label of each program branch; a branch input module, which is used to send the program branch to be tested and the program label corresponding to the program branch to be tested to the branch detection unit; an interface calling module, which is used to generate an access message of the program branch to be tested, and send the access message to the branch detection unit to access the program branch to be tested through the branch detection unit.
[0007] Furthermore, the branch setting unit includes: a label setting module for setting a program label for each program branch; and a script setting module for setting a test script for each program branch.
[0008] To achieve the above-mentioned objectives, according to one aspect of the present application, a program testing method is provided. The method comprises: based on a list of interfaces of a target information system, a self-looping scanning of a target code library is performed to obtain a target interface in the target information system that is called by a target application; determining a target program branch that is executed by the target interface, and based on a target program tag of the target program branch, calling an automated script to generate test data corresponding to the target program branch; accessing the target program branch corresponding to the target program tag to obtain query data for the target program branch; and determining whether the test data is identical to the query data. If the test data is identical to the query data, determining that the test of the target program branch has passed.
[0009] Furthermore, before determining the target program branch running on the target interface, the method also includes: determining the code information of the target interface; generating an interface query message based on the code information of the target interface, and sending the interface query message to the branch detection unit, wherein the branch detection unit obtains the target program label of the target program branch running on the target interface based on the interface query message; and receiving the target program label of the target program branch.
[0010] Furthermore, calling an automated script based on the target program tag of the target program branch to generate test data corresponding to the target program branch includes: generating a test message based on the target program tag of the target program branch; sending the test message to a branch detection unit, so as to call an automated script based on the target program tag through the branch detection unit to generate test data corresponding to the target program branch.
[0011] Furthermore, accessing the target program branch corresponding to the target program label to obtain query data of the target program branch includes: generating an access message based on the target program label of the target program branch; sending the access message to a branch detection unit to access the target program branch corresponding to the target program label through the branch detection unit to obtain query data of the target program branch.
[0012] To achieve the above-mentioned purpose, according to another aspect of the present application, a program testing device is provided. The device includes: a scanning unit for self-looping and scanning a target code library based on an interface list of a target information system to obtain a target interface called by a target application in the target information system; a first determining unit for determining a target program branch running on the target interface and, based on a target program label of the target program branch, calling an automated script to generate test data corresponding to the target program branch; an access unit for accessing a target program branch corresponding to the target program label to obtain query data of the target program branch; and a judgment unit for judging whether the test data is identical to the query data. If the test data is identical to the query data, then the test of the target program branch is determined to have passed.
[0013] Furthermore, the device also includes: a second determination unit, used to determine the code information of the target interface before determining the target program branch running on the target interface; a sending unit, used to generate an interface query message based on the code information of the target interface, and send the interface query message to the branch detection unit, wherein the branch detection unit obtains the target program label of the target program branch running on the target interface based on the interface query message; and a receiving unit, used to receive the target program label of the target program branch.
[0014] Furthermore, the first determination unit includes: a first generation module, used to generate a test message based on the target program label of the target program branch; a first sending module, used to send the test message to the branch detection unit, so that the branch detection unit calls the automation script based on the target program label to generate test data corresponding to the target program branch.
[0015] Furthermore, the access unit includes: a second generation module, used to generate an access message based on the target program label of the target program branch; a second sending module, used to send the access message to the branch detection unit, so as to access the target program branch corresponding to the target program label through the branch detection unit to obtain query data of the target program branch.
[0016] In order to achieve the above-mentioned object, according to one aspect of the present application, a processor is provided, which is used to run a program, wherein the program executes any one of the program testing methods described above when the program is running.
[0017] In order to achieve the above-mentioned purpose, according to one aspect of the present application, an electronic device is provided, which includes one or more processors and a memory, and the memory is used to store the program testing method described above implemented by one or more processors.
[0018] Through the present application, the following steps are adopted: a branch setting unit is used to set program labels for multiple program branches running on each interface in the target information system and set a test script for each program branch, and transmit the program label and the test script for each program branch to the branch detection unit; a branch input unit is used to self-loop scan the target code library to obtain multiple target interfaces called by the target application in the target information system, and send the code information of the target interface to the branch detection unit to determine the multiple program branches running on the target interface and the program label of each program branch. The branch input unit is also used to transmit the program branch to be tested and the program corresponding to the program branch to be tested. The sequence label is sent to the branch detection unit; the branch detection unit is used to call the test script corresponding to the program branch to be tested according to the program label corresponding to the program branch to be tested, and generate the test data corresponding to the program branch to be tested. The branch detection unit is also used to access the program branch to be tested and obtain the query data corresponding to the program branch to be tested. If the test data and the query data are the same, it is determined that the program branch to be tested has passed the test, which solves the problem in the related art that when performing joint testing between target information system interface applications, the upstream application cannot clearly know which program branches are running on the target information system interface, which easily causes test omissions and leads to relatively low test accuracy. Through the program testing system provided by this application, it is possible to determine which program branches are running on each interface of the target information system, and the branch detection unit in the program testing system will automatically call the test script to generate test data according to the label of the program branch, and access the corresponding program branch to generate query data. If the test data and the query data are the same, the program branch test has passed. The integrity of the test is guaranteed by the program testing system, thereby achieving the effect of improving the test accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The accompanying drawings, which constitute part of this application, are intended to provide a further understanding of this application. The exemplary embodiments and descriptions of this application are intended to explain this application and do not constitute an improper limitation on this application. In the accompanying drawings:
[0020] Figure 1 is a schematic diagram of a program testing system provided according to an embodiment of the present application;
[0021] Figure 2is a schematic diagram of a branch input unit provided according to an embodiment of the present application;
[0022] Figure 3 is a schematic diagram of a branch setting unit provided according to an embodiment of the present application;
[0023] Figure 4 is a flowchart of a program testing method provided according to an embodiment of the present application;
[0024] Figure 5 is a schematic diagram of a program testing device provided according to an embodiment of the present application;
[0025] Figure 6 is a schematic diagram of an electronic device provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0026] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in this application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0027] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.
[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0029] It should be noted that the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display and analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties. For example, an interface is set up between this system and the relevant user or organization. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain the relevant information after receiving the consent information fed back by the aforementioned user or organization.
[0030] In the existing technology, when inter-application joint testing is performed on the customer information system interface of a financial institution, the upstream calling application cannot understand which program branches are run by the customer information system interface, resulting in test omissions. Therefore, a program testing system is proposed. The following introduces the program testing system. Figure 1 As shown, the program test system includes the following:
[0031] A branch setting unit is used to set program labels for multiple program branches running on each interface in the target information system and set a test script for each program branch, and transmit the program labels and the test script for each program branch to the branch detection unit; a branch input unit is used to self-loop scan the target code library to obtain multiple target interfaces called by the target application in the target information system, and send the code information of the target interface to the branch detection unit to determine the multiple program branches running on the target interface and the program labels of each program branch. The branch input unit is also used to send the program branch to be tested and the program label corresponding to the program branch to be tested to the branch detection unit; the branch detection unit is used to call the test script corresponding to the program branch to be tested based on the program label corresponding to the program branch to be tested, and generate test data corresponding to the program branch to be tested. The branch detection unit is also used to access the program branch to be tested and obtain query data corresponding to the program branch to be tested. If the test data and the query data are the same, it is determined that the test of the program branch to be tested has passed.
[0032] The branch input unit includes: a code self-scanning module, which is used to self-loop scan the target code library to obtain multiple target interfaces called by the target application in the target information system, and send the code information of the target interface to the branch detection unit to determine the multiple program branches running on the target interface and the program label of each program branch; a branch input module, which is used to send the program branch to be tested and the program label corresponding to the program branch to be tested to the branch detection unit; an interface calling module, which is used to generate an access message of the program branch to be tested, and send the access message to the branch detection unit to access the program branch to be tested through the branch detection unit.
[0033] The branch setting unit includes: a label setting module for setting a program label for each program branch; and a script setting module for setting a test script for each program branch.
[0034] Specifically, the program testing system includes at least a branch setting unit 10, a branch input unit 20, and a branch detection unit 30. The branch setting unit 10 is used to set program labels for each program branch running on the target information system interface and to set a test script for each program branch. The branch setting unit 10 can also be used to set functional descriptions for each program branch, such as the query-reachable mobile phone interface of the target information system and the query-reachable mobile phone interface. The data structure of the branch labels and descriptions is shown in Table 1, and the specific setting values are shown in Table 2:
[0035] Table 1
[0036] Field Name type illustrate Program branching char(50) Labels and instructions char(500) Associated test scripts char(500)
[0037] Table 2
[0038]
[0039] The branch setting unit 10 can also be used to set the total number of branches for a certain interface operation. For example, to query the reachable mobile phone interface, the data structure of the total number of branches and their descriptions is shown in Table 3:
[0040] Table 3
[0041] Field Name type illustrate Main branch char(500)
[0042] The specific setting values are shown in Table 4:
[0043] Table 4
[0044]
[0045] When a program branch is modified, the branch label and description can be modified synchronously through the branch setting unit 10. The branch setting unit 10 transmits the set program label and test script to the branch detection unit 30.
[0046] The branch input unit 20 scans the target code library of the upstream application (i.e., the above-mentioned target application) to determine the multiple target interfaces called by the target application, and sends the code information of the target interface to the branch detection unit 30 to determine the multiple program branches running by the target interface and the program label of each program branch. The branch input unit 20 is also used to send the program branch to be tested and the program label corresponding to the program branch to be tested to the branch detection unit. The branch detection unit 30 is used to call the test script corresponding to the program branch to be tested based on the program label corresponding to the program branch to be tested, and generate test data corresponding to the program branch to be tested. The branch detection unit 30 is also used to access the program branch to be tested and obtain the query data corresponding to the program branch to be tested. If the test data and the query data are the same, it is determined that the test of the program branch to be tested has passed.
[0047] In an optional embodiment, the above-mentioned testing process may be implemented by taking the following steps:
[0048] Step 1: Set the double loop variables n and m. The target information system's interface list is [A1, A2, A3...As]. Variable n is initially set to A1, indicating that the first interface of the target information system is being scanned. m is initially set to null, indicating that the program is being called to detect branch input values. The loop begins. The outer loop scans the caller's code base for program code that calls the target information system's interfaces to determine whether interface A1 is being called. In the inner loop, if interface A1 is called, the branch detection unit 30 is invoked to determine the multiple program branches that interface A1 runs.
[0049] Step 2: Determine the current program branch to be tested from the multiple program branches running on interface A1, m=tag(m+1), call the branch detection unit 30, automatically call the test script of the current program branch to be tested, generate test data for the corresponding branch, and return the generated test data to the branch input unit 20. The branch input unit 20 then calls the branch detection unit 30 to access the current program branch to be tested to obtain query data, and completes the test assertion by comparing whether the query data is consistent with the test data.
[0050] Step 3: Determine whether the last branch of interface A1 has been tested. If so, exit the current loop; otherwise, enter the next inner loop of step 1.
[0051] Step 4: n=n+1, continue to detect the next called interface, if found, enter the inner loop of step 1, if not found, n=n+1, and judge whether all interface detections of the customer information system have been completed, if not, continue to the next detection of step 4, otherwise exit the program test.
[0052] In an optional embodiment, if Figure 2As shown, the branch input unit 20 comprises at least a code self-scanning module 21, a branch input module 22, and an interface calling module 23. The code self-scanning module 21 is configured to self-loop scan the target code library, obtain multiple target interfaces called by target applications in the target information system, and send the code information of the target interfaces to the branch detection unit 30 to determine the multiple program branches executed by the target interfaces and the program labels of each program branch. For example, the message sent by the target interface to the branch detection unit 30 is shown in Table 5.
[0053] To call the mobile phone query interface, you need to detect and query the trusted mobile phone branches that can reach the mobile phone. The message fields sent are shown in Table 5:
[0054] Table 5
[0055]
[0056] The branch detection unit 30 returns all program branches of the interface, as shown in Table 6:
[0057] Table 6
[0058]
[0059] The branch input module 22 is used to send the program branch to be tested and the program label corresponding to the program branch to be tested to the branch detection unit. The above message is shown in Table 7:
[0060] Table 7
[0061]
[0062] The branch detection unit 30 returns the test data of the program branch, as shown in Table 8:
[0063] Table 8
[0064] Field Name Return Value Phone number ***********
[0065] After obtaining the test data, the interface calling module 23 sends an access message of the program branch to be tested, so as to obtain the query data of the program branch to be tested through the branch detection unit 30 .
[0066] In an optional embodiment, if Figure 3 As shown, the branch setting unit 10 at least includes: a label setting module 11 and a script setting module 12. The label setting module 11 sets a program label for each program branch; the script setting module 12 sets a test script for each program branch.
[0067] In summary, the branch setting unit is used to set program labels for multiple program branches running on each interface in the target information system and to set a test script for each program branch, and transmit the program labels and the test script for each program branch to the branch detection unit; the branch input unit is used to self-loop scan the target code library to obtain multiple target interfaces called by the target application in the target information system, and send the code information of the target interface to the branch detection unit to determine the multiple program branches running on the target interface and the program label of each program branch. The branch input unit is also used to transmit the program branch to be tested and the program label corresponding to the program branch to be tested. Send to the branch detection unit; the branch detection unit is used to call the test script corresponding to the program branch to be tested according to the program label corresponding to the program branch to be tested, and generate test data corresponding to the program branch to be tested. The branch detection unit is also used to access the program branch to be tested and obtain the query data corresponding to the program branch to be tested. If the test data and the query data are the same, it is determined that the program branch to be tested has passed the test, which solves the problem in the related art that when performing joint testing between target information system interface applications, the upstream application cannot clearly know which program branches are running on the target information system interface, which easily causes test omissions and leads to relatively low test accuracy. Through the program testing system provided by this application, it is possible to determine which program branches are running on each interface of the target information system, and the branch detection unit in the program testing system will automatically call the test script to generate test data according to the label of the program branch, and access the corresponding program branch to generate query data. If the test data and the query data are the same, the program branch test has passed. The integrity of the test is guaranteed by the program testing system, thereby achieving the effect of improving the test accuracy.
[0068] The present invention will be described below in conjunction with preferred implementation steps. Figure 4 is a flowchart of a program testing method according to an embodiment of the present application. The program testing method can be applied to the above-mentioned program testing system, such as Figure 4 As shown, the method includes the following steps:
[0069] Step S401 : According to the interface list of the target information system, the target code library is scanned in a self-loop manner to obtain the target interface called by the target application in the target information system.
[0070] Specifically, according to the interface list of the target information system, the target code library of the upper-layer calling application (ie the above-mentioned target application) is cyclically scanned to determine which interfaces of the target information system are called by the target application, and obtain the target program interface.
[0071] It should be noted that the target interface can be one interface or multiple interfaces. By cyclically scanning the target code library, it is possible to accurately know which interfaces are called and avoid omissions in testing.
[0072] Step S402 : determining the target program branch of the target interface operation, and calling the automation script according to the target program label of the target program branch to generate test data corresponding to the target program branch.
[0073] Specifically, the code information of the target interface is sent to the branch detection unit 30, which determines the target program branch running on the target interface. A test message is then generated based on the target program branch and the corresponding target program label, and the test message is sent to the branch detection unit 30. The branch detection unit 30 calls the corresponding test script based on the target program label and runs the test script to obtain test data.
[0074] It should be noted that the target program branch may be one program branch or multiple program branches.
[0075] Step S403: access the target program branch corresponding to the target program tag to obtain query data of the target program branch.
[0076] Specifically, an access message is generated according to the target program branch and the corresponding target program label, and the access message is sent to the branch detection unit 30. The branch detection unit 30 accesses the target program branch to obtain query data corresponding to the target program branch.
[0077] Step S404 , determining whether the test data is identical to the query data; if the test data is identical to the query data, determining that the test of the target program branch has passed.
[0078] Specifically, the result of the test of the target program branch is determined by judging whether the test data is identical to the query data. If the test data is identical to the query data, it is determined that the test of the target program branch has passed.
[0079] In an optional embodiment, the caller code library is scanned to determine whether the interface A1 is called; if the interface A1 is called, the branch detection unit 30 is called to determine the multiple program branches run by the interface A1.
[0080] Determine the current program branch to be tested from the multiple program branches running on interface A1, call the branch detection unit 30, automatically call the test script of the current program branch to be tested, generate test data for the corresponding branch, and return the generated test data to the branch input unit 20. The branch input unit 20 then calls the branch detection unit 30 to access the current program branch to be tested to obtain query data, compare the query data with the test data to see if they are consistent, and complete the test assertion.
[0081] Determine whether the last branch of interface A1 has been tested. If so, exit the current loop; otherwise, enter the test of the next program branch.
[0082] Determine whether all interface tests of the customer information system have been completed. If not, continue testing the next interface. If not, exit the program test.
[0083] In summary, the above steps can determine which program branches are run by each interface of the target information system, and automatically call the test script to generate test data according to the program label of the program branch, and access the corresponding program branch to generate query data. If the test data and the query data are the same, the program branch test passes. The above steps ensure the integrity of the test and improve the test accuracy.
[0084] Optionally, in the program testing method provided in an embodiment of the present application, before determining the target program branch running on the target interface, the method also includes: determining the code information of the target interface; generating an interface query message based on the code information of the target interface, and sending the interface query message to the branch detection unit, wherein the branch detection unit obtains the target program label of the target program branch running on the target interface based on the interface query message; and receiving the target program label of the target program branch.
[0085] Specifically, before determining the target program branch running on the target interface, the code information of the target interface is clarified, and then an interface query message is generated based on the code information of the target interface, and the interface query message is sent to the branch detection unit 30, and the target program branch running on the target interface is determined by the branch detection unit 30.
[0086] Optionally, in the program testing method provided in an embodiment of the present application, calling an automated script based on the target program tag of the target program branch to generate test data corresponding to the target program branch includes: generating a test message based on the target program tag of the target program branch; sending the test message to a branch detection unit, so that the branch detection unit calls the automated script based on the target program tag to generate test data corresponding to the target program branch.
[0087] Specifically, a test message is generated according to the target program branch and the corresponding target program label, and the test message is sent to the branch detection unit 30. The branch detection unit 30 calls the corresponding test script according to the target program label and runs the test script to obtain test data.
[0088] Optionally, in the program testing method provided in an embodiment of the present application, accessing the target program branch corresponding to the target program label and obtaining query data of the target program branch includes: generating an access message based on the target program label of the target program branch; sending the access message to a branch detection unit to access the target program branch corresponding to the target program label through the branch detection unit to obtain query data of the target program branch.
[0089] Specifically, an access message is generated according to the target program branch and the corresponding target program label, and the access message is sent to the branch detection unit 30. The branch detection unit 30 accesses the target program branch to obtain query data corresponding to the target program branch.
[0090] In an optional embodiment, it is necessary to test the program branch of tag1 trusted mobile phone that is run by the target information system calling the mobile phone query interface, which specifically includes the following steps:
[0091] The branch setting unit 10 sends the program tag of the program branch to be detected, and the trusted mobile phone branch that needs to be detected and queried can be reached. The sent message fields are shown in Table 9:
[0092] Table 9
[0093] Detection Branch tag1 trusted mobile phone
[0094] The branch detection unit 30 then queries the reachable mobile phone A1 of customer 0200000001.
[0095] The branch detection unit 30 executes the test script corresponding to the program tag as shown in Table 10 according to the program tag sent to it:
[0096] Table 10
[0097]
[0098] Running the test script yields the following test data:
[0099] After the new customer script is executed, a new customer is added: B;
[0100] After the new trusted mobile phone script is executed, a new trusted mobile phone is added: B1.
[0101] After obtaining the test data, the branch setting unit 10 sends an access message of the trusted mobile phone branch. The branch detection unit 30 obtains the query data of the trusted mobile phone branch based on the sent access message. The expected return mobile phone is B1, which indicates that the verification of the tag1 trusted mobile phone program branch has passed.
[0102] The program testing method provided by the embodiment of the present application obtains the target interface called by the target application in the target information system by scanning the target code library in a self-loop according to the interface list of the target information system; determines the target program branch running on the target interface, and calls the automation script according to the target program label of the target program branch to generate test data corresponding to the target program branch; accesses the target program branch corresponding to the target program label to obtain the query data of the target program branch; judges whether the test data is the same as the query data, and if the test data is the same as the query data, determines that the test of the target program branch has passed, which solves the problem in the related art that when performing the joint test between the target information system interface application, the upstream application cannot clearly know which program branches are running on the target information system interface, which easily causes test omissions and leads to relatively low test accuracy. Through the program testing system provided by the present application, it is possible to determine which program branches are running on each interface of the target information system, and the branch detection unit in the program testing system will automatically call the test script to generate test data according to the label of the program branch, and access the corresponding program branch to generate query data. If the test data and the query data are the same, the program branch test has passed, and the integrity of the test is guaranteed by the program testing system, thereby achieving the effect of improving the test accuracy.
[0103] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0104] The present application also provides a program testing device. It should be noted that the program testing device of the present application can be used to execute the program testing method provided in the present application. The program testing device provided in the present application is introduced below.
[0105] Figure 5 Schematic diagram of a program testing device according to an embodiment of the present application. Figure 5 As shown, the device includes: a scanning unit 501 , a first determining unit 502 , an accessing unit 503 and a judging unit 504 .
[0106] The scanning unit 501 is used to self-circulate and scan the target code library according to the interface list of the target information system to obtain the target interface called by the target application in the target information system.
[0107] The first determining unit 502 is configured to determine a target program branch running on a target interface, and call an automation script according to a target program label of the target program branch to generate test data corresponding to the target program branch.
[0108] The access unit 503 is used to access the target program branch corresponding to the target program tag and obtain query data of the target program branch.
[0109] The judging unit 504 is configured to judge whether the test data is identical to the query data. If the test data is identical to the query data, it is determined that the test of the target program branch has passed.
[0110] The program testing device provided in the embodiment of the present application, through the scanning unit 501, self-loop scans the target code library according to the interface list of the target information system, and obtains the target interface called by the target application in the target information system. The first determination unit 502 determines the target program branch running on the target interface, and calls the automation script according to the target program label of the target program branch to generate test data corresponding to the target program branch. The access unit 503 accesses the target program branch corresponding to the target program label to obtain the query data of the target program branch. The judgment unit 504 judges whether the test data is the same as the query data. If the test data is the same as the query data, it is determined that the test of the target program branch has passed, which solves the problem in the related art that when performing joint testing between target information system interface applications, the upstream application cannot clearly know which program branches are running on the target information system interface, which easily causes test omissions and leads to relatively low test accuracy. Through the program testing system provided in this application, it is possible to determine which program branches are running on each interface of the target information system, and the branch detection unit in the program testing system will automatically call the test script to generate test data based on the label of the program branch, and access the corresponding program branch to generate query data. If the test data and the query data are the same, the program branch test passes. The integrity of the test is guaranteed through the program testing system, thereby achieving the effect of improving the test accuracy.
[0111] Optionally, in the program testing device provided in the embodiment of the present application, the device also includes: a second determination unit, used to determine the code information of the target interface before determining the target program branch running on the target interface; a sending unit, used to generate an interface query message based on the code information of the target interface, and send the interface query message to the branch detection unit, wherein the branch detection unit obtains the target program label of the target program branch running on the target interface based on the interface query message; and a receiving unit, used to receive the target program label of the target program branch.
[0112] Optionally, in the program testing device provided in an embodiment of the present application, the first determination unit 502 includes: a first generation module, used to generate a test message based on the target program label of the target program branch; a first sending module, used to send the test message to the branch detection unit, so as to call the automation script based on the target program label through the branch detection unit to generate test data corresponding to the target program branch.
[0113] Optionally, in the program testing device provided in an embodiment of the present application, the access unit 503 includes: a second generation module, used to generate an access message based on the target program label of the target program branch; a second sending module, used to send the access message to the branch detection unit, so as to access the target program branch corresponding to the target program label through the branch detection unit to obtain query data of the target program branch.
[0114] The program testing device includes a processor and a memory. The above-mentioned scanning unit 501, first determination unit 502, access unit 503 and judgment unit 504 are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize corresponding functions.
[0115] The processor contains a kernel, which calls the corresponding program unit from the memory. One or more kernels can be set, and program branch testing can be implemented by adjusting kernel parameters.
[0116] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0117] An embodiment of the present invention provides a processor, which is used to run a program, wherein a program testing method is executed when the program is running.
[0118] like Figure 6 As shown, an embodiment of the present invention provides an electronic device, which includes a processor, a memory, and a program stored in the memory and capable of running on the processor. When the processor executes the program, the following steps are implemented: based on the interface list of the target information system, the target code library is self-looped to obtain the target interface called by the target application in the target information system; the target program branch running on the target interface is determined, and based on the target program label of the target program branch, an automation script is called to generate test data corresponding to the target program branch; the target program branch corresponding to the target program label is accessed to obtain query data of the target program branch; and it is determined whether the test data is the same as the query data. If the test data is the same as the query data, it is determined that the test of the target program branch has passed.
[0119] Optionally, before determining the target program branch running on the target interface, the method also includes: determining the code information of the target interface; generating an interface query message based on the code information of the target interface, and sending the interface query message to the branch detection unit, wherein the branch detection unit obtains the target program label of the target program branch running on the target interface based on the interface query message; and receiving the target program label of the target program branch.
[0120] Optionally, calling an automated script based on the target program tag of the target program branch to generate test data corresponding to the target program branch includes: generating a test message based on the target program tag of the target program branch; sending the test message to a branch detection unit, so that the branch detection unit calls the automated script based on the target program tag to generate test data corresponding to the target program branch.
[0121] Optionally, accessing the target program branch corresponding to the target program label and obtaining query data of the target program branch includes: generating an access message based on the target program label of the target program branch; sending the access message to the branch detection unit to access the target program branch corresponding to the target program label through the branch detection unit to obtain query data of the target program branch.
[0122] The devices in this article can be servers, PCs, PADs, mobile phones, etc.
[0123] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program having the following method steps: based on the interface list of the target information system, self-loopingly scanning the target code library to obtain the target interface called by the target application in the target information system; determining the target program branch running on the target interface, and based on the target program label of the target program branch, calling the automation script to generate test data corresponding to the target program branch; accessing the target program branch corresponding to the target program label to obtain query data of the target program branch; judging whether the test data is the same as the query data, and if the test data is the same as the query data, determining that the test of the target program branch has passed.
[0124] Optionally, before determining the target program branch running on the target interface, the method also includes: determining the code information of the target interface; generating an interface query message based on the code information of the target interface, and sending the interface query message to the branch detection unit, wherein the branch detection unit obtains the target program label of the target program branch running on the target interface based on the interface query message; and receiving the target program label of the target program branch.
[0125] Optionally, calling an automated script based on the target program tag of the target program branch to generate test data corresponding to the target program branch includes: generating a test message based on the target program tag of the target program branch; sending the test message to a branch detection unit, so that the branch detection unit calls the automated script based on the target program tag to generate test data corresponding to the target program branch.
[0126] Optionally, accessing the target program branch corresponding to the target program label and obtaining query data of the target program branch includes: generating an access message based on the target program label of the target program branch; sending the access message to the branch detection unit to access the target program branch corresponding to the target program label through the branch detection unit to obtain query data of the target program branch.
[0127] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0128] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes 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 produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. 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.
[0129] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work 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 The function specified in one or more boxes.
[0130] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device 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.
[0131] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0132] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0133] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0134] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0135] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0136] The above are merely embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should all be included within the scope of the claims of the present application.
Claims
1. A program testing system, characterized in that: include: a branch setting unit, configured to set program labels for a plurality of program branches running on each interface in the target information system and set a test script for each program branch, and transmit the program labels and the test script for each program branch to the branch detection unit; a branch input unit configured to self-loop scan a target code library to obtain a plurality of target interfaces in the target information system that are called by a target application, and to send code information of the target interfaces to the branch detection unit to determine a plurality of program branches run by the target interfaces and a program label of each program branch; and further configured to send a program branch to be tested and a program label corresponding to the program branch to be tested to the branch detection unit; The branch detection unit is used to call the test script corresponding to the program branch to be tested based on the program label corresponding to the program branch to be tested, and generate test data corresponding to the program branch to be tested. The branch detection unit is also used to access the program branch to be tested and obtain query data corresponding to the program branch to be tested. If the test data and the query data are the same, it is determined that the test of the program branch to be tested has passed; Wherein, the branch input unit includes: a code self-scanning module, configured to self-loop scan a target code library to obtain a plurality of target interfaces called by a target application in the target information system, and to send code information of the target interfaces to the branch detection unit to determine a plurality of program branches run by the target interfaces and a program label of each program branch; A branch input module, configured to send a program branch to be tested and a program label corresponding to the program branch to be tested to the branch detection unit; The interface calling module is used to generate an access message of the program branch to be tested, and send the access message to the branch detection unit to access the program branch to be tested through the branch detection unit.
2. The program testing system according to claim 1, wherein: The branch setting unit includes: The label setting module is used to set the program label for each program branch; The script setting module is used to set the test script for each program branch.
3. A program testing method, characterized in that: The method is applied to the program testing system according to any one of claims 1 to 2, comprising: According to the interface list of the target information system, the target code library is scanned in a self-loop manner to obtain the target interface called by the target application in the target information system; Determine the target program branch run by the target interface, and call the automation script according to the target program label of the target program branch to generate test data corresponding to the target program branch; Accessing a target program branch corresponding to the target program tag to obtain query data of the target program branch; It is determined whether the test data is identical to the query data; if the test data is identical to the query data, it is determined that the test of the target program branch has passed.
4. The program testing method according to claim 3, wherein: Before determining the target program branch to be run by the target interface, the method further includes: Determining code information of the target interface; Generate an interface query message according to the code information of the target interface, and send the interface query message to a branch detection unit, wherein the branch detection unit obtains a target program label of a target program branch running on the target interface according to the interface query message; A target program label of the target program branch is received.
5. The program testing method according to claim 3, wherein: According to the target program label of the target program branch, calling the automation script to generate test data corresponding to the target program branch includes: generating a test message according to the target program label of the target program branch; The test message is sent to a branch detection unit, so that the branch detection unit calls an automation script according to the target program label to generate test data corresponding to the target program branch.
6. The program testing method according to claim 3, wherein: Accessing the target program branch corresponding to the target program tag and obtaining query data of the target program branch includes: generating an access message according to a target program label of the target program branch; The access message is sent to a branch detection unit, so that the target program branch corresponding to the target program label is accessed through the branch detection unit to obtain query data of the target program branch.
7. A program testing device for implementing a program testing method according to claim 3, characterized in that: include: A scanning unit, configured to self-loop scan a target code library based on an interface list of a target information system, and obtain a target interface called by a target application in the target information system; A first determining unit is configured to determine a target program branch run by the target interface, and call an automation script based on a target program label of the target program branch to generate test data corresponding to the target program branch; An access unit, configured to access a target program branch corresponding to the target program tag and obtain query data of the target program branch; The judging unit is configured to judge whether the test data is identical to the query data, and if so, determine that the test of the target program branch has passed.
8. A processor, characterized in that: The processor is configured to run a program, wherein the program testing method according to any one of claims 3 to 6 is executed when the program is run.
9. An electronic device, characterized in that: It includes one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the program testing method described in any one of claims 3 to 6.
Citation Information
Patent Citations
Code branch coverage condition determination method and device, computer system and medium
CN111831573A
Interface testing method and device and electronic equipment
CN112948234A