CN114090456A - Interface test coverage rate calculation method and device, terminal equipment and storage medium - Google Patents
Interface test coverage rate calculation method and device, terminal equipment and storage medium Download PDFInfo
- Publication number
- CN114090456A CN114090456A CN202111435613.4A CN202111435613A CN114090456A CN 114090456 A CN114090456 A CN 114090456A CN 202111435613 A CN202111435613 A CN 202111435613A CN 114090456 A CN114090456 A CN 114090456A
- Authority
- CN
- China
- Prior art keywords
- target
- application
- interface
- test
- interfaces
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3676—Test management for coverage analysis
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The embodiment of the application is suitable for the technical field of research and development management, and provides an interface test coverage rate calculation method, an interface test coverage rate calculation device, terminal equipment and a storage medium, wherein the method comprises the following steps: acquiring an application interface correspondingly used by each application in a target system, and the number of test cases and the calling amount of each application interface; determining the testing number of tested application interfaces from the plurality of application interfaces based on the number of testing cases; determining target application interfaces and the target number of the target application interfaces based on the calling amount; the target application interface is an actually used interface of the target system; adjusting a preset correction coefficient according to the ratio of the target number to the total number of the application interfaces to obtain an adjusted target correction coefficient; and calculating the ratio of the test quantity to the target quantity and the target correction coefficient to obtain the actual interface test coverage rate of the target system. By adopting the method, the accuracy of calculating the interface test coverage rate of the target system can be improved.
Description
Technical Field
The application belongs to the technical field of research and development management, and particularly relates to an interface test coverage rate calculation method and device, terminal equipment and a storage medium.
Background
The interface test is a test for testing each interface between system components, and is mainly used for testing the accuracy, integrity, safety and quality of the interfaces between the system and other external systems and the interfaces between each functional module in the system.
The interface test coverage rate can enable a tester to know which interfaces are replaced and which interfaces still have services to be called in the system, so that the tester can conveniently know the offline interfaces, the automatic test of the part of interfaces can be abandoned in time, and the maintenance cost is reduced.
However, in the process of calculating the interface test coverage, when the system counts the number of tested interfaces, the system only performs statistics according to whether the interface is tested by the test case. However, some interfaces are tested while their full functionality is not fully tested. That is, although the application interface is tested by the test case, the application interface should not participate in the above calculation as a tested interface. Meanwhile, when the interface test coverage rate is calculated, the ratio of the number of the tested interfaces to the number of all the interfaces of the system is only calculated, and whether all the interfaces in the system need to participate in the calculation is not respectively calculated, so that the accuracy of the finally calculated interface test coverage rate is low.
Disclosure of Invention
The embodiment of the application provides a method and a device for calculating interface test coverage, terminal equipment and a storage medium, and can solve the problem of low accuracy in calculating the interface test coverage of a test system.
In a first aspect, an embodiment of the present application provides an interface test coverage calculation method, where the method includes:
the method comprises the steps that group data contained in a target system are obtained, the target system comprises a plurality of applications, the group data at least comprise application interfaces correspondingly used by the applications, and the number of test cases and the calling amount of each application interface;
determining the testing number of tested application interfaces from the plurality of application interfaces based on the number of testing cases; determining target application interfaces and the target number of the target application interfaces based on the calling amount; the target application interface is an actually used interface of the target system;
adjusting a preset correction coefficient according to the ratio of the target number to the total number of the application interfaces to obtain an adjusted target correction coefficient;
and calculating the ratio of the test quantity to the target quantity and the target correction coefficient to obtain the actual interface test coverage rate of the target system.
In a second aspect, an embodiment of the present application provides an interface test coverage calculation apparatus, including:
the system comprises an acquisition module, a storage module and a display module, wherein the acquisition module is used for acquiring group data contained in a target system, the target system comprises a plurality of applications, the group data at least comprises application interfaces correspondingly used by each application, and the number of test cases and the calling amount of each application interface;
the number determining module is used for determining the testing number of the tested application interfaces from the plurality of application interfaces based on the number of the testing cases; determining target application interfaces and the target number of the target application interfaces based on the calling amount; the target application interface is an actually used interface of the target system;
the correction module is used for adjusting a preset correction coefficient according to the ratio of the target number to the total number of the application interfaces to obtain an adjusted target correction coefficient;
and the calculating module is used for calculating the ratio of the test quantity to the target quantity and the target correction coefficient to obtain the actual interface test coverage rate of the target system.
In a third aspect, an embodiment of the present application provides a terminal device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the method according to the first aspect is implemented.
In a fourth aspect, the present application provides a computer-readable storage medium, in which a computer program is stored, where the computer program is implemented to implement the method of the first aspect as described above when executed by a processor.
In a fifth aspect, embodiments of the present application provide a computer program product, which, when run on a terminal device, causes the terminal device to execute the method of the first aspect.
Compared with the prior art, the embodiment of the application has the advantages that: in this embodiment, after obtaining the application interfaces correspondingly used by each application in the target system, and the number of test cases and the call amount of each application interface, the terminal device may accurately determine the test number of the actually tested application interfaces from the plurality of application interfaces based on the number of test cases; and further distinguishing the application interfaces used by all the applications according to the calling quantity so as to accurately obtain the target application interface which is actually used in the target system. And then, the fixed preset correction coefficient can be finely adjusted according to the ratio of the target number to the total number of the target application interfaces which are actually used, so that the terminal equipment can accurately calculate the interface test coverage rate in the target system according to the processed test number, the target number and the finely adjusted target correction coefficient.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
Fig. 1 is a flowchart illustrating an implementation of a method for calculating an interface test coverage according to an embodiment of the present application;
fig. 2 is a schematic diagram illustrating an implementation manner of S102 of a method for calculating interface test coverage according to an embodiment of the present application;
fig. 3 is a flowchart illustrating an implementation of a method for calculating interface test coverage according to another embodiment of the present application;
fig. 4 is a flowchart illustrating an implementation of a method for calculating interface test coverage according to another embodiment of the present application;
fig. 5 is a schematic structural diagram of an interface test coverage calculation apparatus according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a terminal device according to an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
Furthermore, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used for distinguishing between descriptions and not necessarily for describing or implying relative importance.
The interface test coverage calculation method provided by the embodiment of the present application can be applied to terminal devices such as a tablet computer, a notebook computer, and an ultra-mobile personal computer (UMPC), and the embodiment of the present application does not limit the specific types of the terminal devices. The terminal device may be installed with the target system, or have data connection with the target system to process the target system.
Referring to fig. 1, fig. 1 is a flowchart illustrating an implementation of a method for calculating an interface test coverage provided by an embodiment of the present application, where the method includes the following steps:
s101, the terminal equipment obtains group data contained in a target system, the target system comprises a plurality of applications, the group data at least comprises application interfaces correspondingly used by each application, and the number of test cases and the calling amount of each application interface.
In an embodiment, the target system includes, but is not limited to, a system for bank transactions or a system for logistics information management, and the function used by the target system is not limited in this embodiment. Specifically, the target system may be composed of three subsystems, wherein the three subsystems are respectively: athena subsystem, seiya subsystem, cat subsystem. Wherein the Athena subsystem includes a plurality of applications for executing a daemon. Each Application typically communicates with the Application or external device at runtime through one or more Application Programming Interfaces (APIs).
The seiya subsystem may be configured to perform data interaction with the athena subsystem to maintain interface data of an application interface used by each application in the athena subsystem.
The cat subsystem is used for recording the call quantity of each application interface called when each application in the Athena subsystem runs. For example, for an application interface of any application, the cat subsystem may monitor the number of times the application interface is called by the application in a day as the call volume.
It can be understood that the athena subsystem, the seiya subsystem, and the cat subsystem may be systems respectively used for processing, such as recording and storing, interface data generated by each application interface that needs to be called when the same type of service runs.
In an embodiment, the group data includes, but is not limited to, a traffic type and an application identifier corresponding to each application, and may further include all application information of each application in the athena subsystem. For example, application names, various interfaces included in the application, and the like may also be included. The traffic types may be distinguished specifically according to application names. For example, if the application is a microblog, the corresponding traffic type may be regarded as a microblog traffic type, which is not limited to this.
When the target system comprises a plurality of applications, the terminal device may obtain the group data included in the target system in the following manner: the terminal equipment can obtain the grouping relation among all applications under the Athena subsystem by logging in the Athena subsystem and adopting a crawler technology. For example, the terminal device may first obtain a plurality of small groups belonging to the a group in the athena subsystem; then, aiming at any small packet, recycling and acquiring the rest sub-packets under the small packet; and finally, determining the application under the sub-packet and the flow type corresponding to the application according to the application identifier contained in the sub-packet. Then, the terminal equipment can inquire the interface data maintained by the target system according to the application identifier and the flow type; the interface data at least comprises an application interface correspondingly used by each application, the number of test cases of each application interface and the calling quantity.
In a specific embodiment, the interface data maintained by the target system may specifically be automation interface data maintained by the seiya subsystem, where the automation interface data includes an application interface correspondingly used by each application in the athena subsystem, a number of test cases used when performing an automation test on each monthly interface, and a call volume of each application interface in a preset time period.
It should be noted that, when performing a functionality test on an application interface of an application, a plurality of test cases are generally required to be used for the test, so as to sufficiently ensure the security and stability of the application interface. Furthermore, for any application interface in the athena subsystem, when the tester tests the application interface, the final interface data (number of test cases, application identifier, application interface) can be stored in the seiya subsystem. When all the maintained application interfaces included in the Athena subsystem are acquired, the terminal equipment can directly inquire the maintained interface data from the seiya subsystem according to the application identification and the flow type.
It should be added that the application interfaces are all interfaces correspondingly used by the application. That is, for any application, the application generally has multiple application interfaces, and each application interface is used for transmitting one service data.
It should be noted that, when the terminal device acquires the group data of the target system, a crawler technology may be specifically adopted for acquisition. Illustratively, if the database storing the grouping relationships in the target system is a requests database, the terminal device may perform data acquisition using a requests. In particular, it may be implemented by variable request. Where variable represents the name of the variable and the parameter url in parenthesis is the address of the required group data.
S102, determining the testing number of tested application interfaces from a plurality of application interfaces by the terminal equipment based on the number of the testing cases; determining target application interfaces and the target number of the target application interfaces based on the calling amount; the target application interface is the interface actually used by the target system.
In one embodiment, the number of test cases is described in S101, and will not be explained. The determining of the tested application interface from the plurality of application interfaces may be: and aiming at any one application interface, the application interface is tested by the test case corresponding to the application interface. Although the application interface is already tested by the corresponding test cases, the number of the test cases cannot meet the requirement. That is, the application interface is tested, but not all functions thereof are tested. Based on this, the terminal device may consider the application interface as not being a tested application interface.
In this embodiment, referring to fig. 2, the terminal device may determine the test number of the tested application interfaces and the target number of the target application interfaces from the plurality of application interfaces through the following steps S1021 to S1022:
s1021, aiming at any application interface of the application, the terminal equipment judges whether the number of test cases of the application interface is larger than the preset number of cases; if the number of the test cases is larger than the preset number of cases, determining the application interface as a tested application interface; and counting the number of the tested application interfaces to obtain the test number.
In an embodiment, the number of the preset cases may be set by a tester according to an actual situation, which is not limited herein. Specifically, the number of test cases of a plurality of existing tested application interfaces can be obtained; and then, calculating the average value of the number of the plurality of test cases as the preset number of cases.
It can be understood that, for any application interface, if the number of test cases used by the application interface during testing is greater than the preset number of cases, and the application interface is still used by the application, it indicates that the application interface is a safe and stable interface. I.e. the application interface is considered to belong to the tested application interface.
If the number of test cases used by the application interface during testing is less than or equal to the preset number of cases, the application interface cannot be directly determined as a safe and stable interface even if the application interface is still used by the application. I.e. the application interface is considered to belong to an untested application interface.
It should be added that the terminal device may count the number of tests of all tested application interfaces and store the number. Specifically, the terminal device can store the test quantity and the tested application interface into an oracle database through a cx-oracle technology.
S1022, the terminal equipment judges whether the call volume of the application interface is larger than a preset call volume; if the call quantity is larger than the preset call quantity, determining the application interface as a target application interface; and counting the number of the target application interfaces to obtain the target number.
In one embodiment, the above-mentioned calling amount is already described in S101, and will not be explained again. The target application interface is an interface actually used by the target system. For example, determining the target number of target application interfaces from the plurality of application interfaces may be: for any application interface, the application interface is called within a target preset time period, and the application interface can be regarded as a target application interface. And then counting the number of all target application interfaces to obtain the target number.
In an embodiment, the preset calling amount may be a preset calling amount that is preset by a tester for each application interface, or may also be a preset unique preset calling amount. That is, each application interface corresponds to a common preset call amount. Then, for any application interface, when the call volume of the application interface is judged to be larger than the preset call volume, the application interface is determined as the target application interface. The preset value of the call amount may be specifically set to 100, which is not limited.
It is understood that the application has all application interfaces that can be classified into: tested application interfaces, untested application interfaces. It should be noted that, for untested application interfaces, there may be a small number of times per day that the interface is called. That is, the application includes the untested application interface, but the application interface is not frequently used and does not belong to the target application interface. Therefore, when the interface test coverage of a plurality of applications is calculated, untested application interfaces with less calling quantity can be excluded, so that the calculated test coverage is more accurate.
It should be added that, when the call volume of each application interface is counted, it is to count the call volume called by each application interface in the target time period. Specifically, the target time period may be within one day before the current time. The test can be carried out by a tester. In addition, the preset call amount may also be set according to the duration of the target time period, for example, the preset call amount for one day may be 100, the preset call amount for two days may not be 200, and so on, which is not limited herein. That is, the preset call amount is not an already fixed value.
In addition, in a specific embodiment, referring to fig. 3, after determining the target application interface and the target number of the target application interfaces based on the call amount in S102, the target application interface may be checked for the second time through the following steps S121 to S122 to determine the target application interface accurately:
and S121, the terminal equipment acquires the service data from the target application interface, and the service data is acquired from the database of the target system when the service data is called by the target application interface.
S122, if the service data comprises preset key information, the terminal equipment deletes the target application interface; and the key information is used for identifying that the target application interface corresponding to the business data containing the key information is an application interface to be offline.
In an embodiment, the service data is data pre-stored in a database in the target system, wherein the application generally needs to call a corresponding application interface to obtain the service data from the database when running, so as to implement a certain application function of the application.
Specifically, the application interface is usually predefined with a function. For example, the function may be a query language that accesses a database to enable data sharing between applications through the database. Therefore, for any application interface, the corresponding service data can be obtained from the database for processing.
Based on this, the tester may set one or more pieces of key information in the database for each service data in advance, where the one or more pieces of key information are used when the service data is acquired by the application interface, and may enable the terminal device to determine, based on the key information, whether the current application interface is an application interface that is not frequently used (i.e., a non-target application interface), or an application interface that is going to be offline.
It will be appreciated that for an application interface that is going offline, that portion of the interface may not be involved in testing. Therefore, when the target application interface is counted, the part of the application interface may not participate in the counting.
Based on this, when the terminal device determines that the service data includes the preset key information, the terminal device may delete the target application interface called at this time; otherwise, the target application interface is retained. And then counting the number of the residual target application interfaces as a target number.
S103, the terminal equipment adjusts the preset correction coefficient according to the ratio of the target number to the total number of the application interfaces to obtain the adjusted target correction coefficient.
And S104, the terminal equipment calculates the ratio of the test quantity to the target quantity and the target correction coefficient to obtain the actual interface test coverage rate of the target system.
In an embodiment, after obtaining the test quantity and the target quantity, the terminal device may calculate the interface test coverage according to a preset calculation formula. Specifically, the calculation formula may be:
Lcoverage=Mtest/Ntarget*Kcorrection
wherein M istestTo test the quantity, NtargetTo a target number, KcorrectionIs a preset correction coefficient; wherein the correction factor is used for adjusting according to the ratio of the target number to the total number of the application interfaces.
Wherein the correction coefficient KcorrectionThe adjustment can be specifically carried out in the following way: when the ratio is in a first preset range, reducing the preset correction coefficient to a first preset value; and when the ratio is in a second preset range, increasing the preset correction coefficient to a second preset value. The first preset range, the first preset value, the second preset range and the second preset value can be set by a tester according to actual conditions.
It is added that the purpose of adjusting the correction coefficient by the ratio is to: when the target application interface is determined, the accuracy of the determination mode may not be high, so that the terminal device may count the number of the target application interfaces too much or too little; or, when counting the application interfaces to be offline, although the service data called by the application interfaces includes preset key information, the target system may have service adjustment, so that the application interfaces are not offline in practice.
Therefore, in order to avoid determining the target application interfaces too much or too little by the terminal device, when the ratio is in the first preset range with a higher value, it may be considered that the number of the target application interfaces is counted too much, so that the target number of the non-target application interfaces is counted too little. Further, the calculated interface test coverage is low. Based on this, in order to further correct the interface test coverage, the corresponding first preset value may be set to a higher value. That is, the preset correction coefficient is increased to the first preset value. Conversely, when the ratio is in the second preset range with a lower value, it may be considered that the target number of the target application interfaces is counted too little. Further, the calculated interface test coverage is high. Furthermore, the corresponding second preset value can be set to a lower value. I.e. the preset correction factor is reduced to a second preset value. Wherein the first preset value is larger than the second preset value.
Based on this, in this embodiment, after obtaining the application interfaces correspondingly used by each application in the target system, and the number of test cases and the call amount of each application interface, the terminal device may accurately determine the test number of the actually tested application interfaces from the plurality of application interfaces based on the number of test cases; and further distinguishing the application interfaces used by all the applications according to the calling quantity so as to accurately obtain the target application interface which is actually used in the target system. And then, the fixed preset correction coefficient can be finely adjusted according to the ratio of the target number to the total number of the target application interfaces which are actually used, so that the terminal equipment can accurately calculate the interface test coverage rate in the target system according to the processed test number, the target number and the finely adjusted target correction coefficient.
In an embodiment, referring to fig. 4, after calculating the ratio of the test quantity to the target quantity and the target correction coefficient in S104 to obtain the actual interface test coverage of the target system, the method further includes the following steps S141 to S143:
and S141, if the interface test coverage rate is lower than the preset coverage rate, the terminal equipment acquires untested application interfaces of which the number of test cases is less than or equal to the preset number of cases.
And S142, the terminal equipment deletes the application interface to be off-line from the untested application interface.
And S143, the terminal equipment tests the rest untested application interfaces.
In an embodiment, as described in the above S1022, when the number of the test cases is greater than the preset number of cases, the application interface is determined to be the tested application interface; based on this, it can be determined that the application interface is an untested application interface when the number of test cases is less than or equal to the preset number of cases. The preset coverage rate can be set by a tester according to actual conditions, and is not limited.
It can be understood that when the interface test coverage rate is lower than the preset coverage rate, a large number of unsafe and unstable untested application interfaces exist in the application interfaces used by the target system. When the untested application interface is in operation, normal operation of the service may be affected, so that the operation of the target system is unstable.
Based on this, in order to improve the operation stability of the target system and improve the testing efficiency of the terminal device on the untested application interfaces, the application interfaces which are not required to be tested and are going off-line can be deleted from the untested application interfaces.
It will be appreciated that for an application interface that is going offline, it may be assumed that the application interface may not be called by the target system at subsequent runtime. Therefore, the application interface can not affect the stability of the operation of the target system even if the application interface does not carry out interface test on the application interface. Based on this, the terminal device may only test the remaining untested application interfaces.
In an embodiment, after the interface test coverage of the target system is obtained, the terminal device may generate a test report of the interface test coverage, so that a tester can know each application interface in the target system in detail. The test report includes, but is not limited to, the tested application interfaces, the number of tests, the untested application interfaces, and the number of untested application interfaces, which is not limited to this.
In the step S143, during the test of the remaining untested application interfaces, the following steps may be specifically performed: the terminal equipment classifies the untested application interfaces according to the interface types of the untested application interfaces, and uses the untested application interfaces with the same interface types as a group of untested application interfaces; the terminal equipment acquires the number of test cases of all test cases in a group of untested application interfaces; and if the number of the test cases of all the test cases is larger than the preset number of the cases, the terminal equipment respectively uses all the test cases as the test cases of each untested application interface with the same interface type.
In an application, the interface types include, but are not limited to, a function type of an untested application interface, a data type called, and the like. Taking the interface type as the function type, the function type may be classified into a registration function type, a login function type, a logout function type, and the like. Therefore, for a plurality of untested application interfaces with the same function type, the number of test cases of each untested application interface is less than the preset number of cases. Thus, the terminal device may borrow each untested application of all of the same functional types as a set of untested application interfaces. Meanwhile, when the number of the test cases of all the test cases is greater than the preset number of cases, the number of all the test cases can be respectively used as the test case of each untested application interface of the same interface type.
It can be understood that, since the test cases corresponding to the untested application interfaces of the same function type are generally the same or similar, for any untested application interface, it may also use the test cases of other untested application interfaces of the same function type to perform interface test on the untested application interface. Therefore, the terminal equipment can realize the test of each untested application interface without compiling a new test case for each untested application interface again by a tester, and the test efficiency of the untested application interface is improved.
Referring to fig. 5, fig. 5 is a block diagram illustrating an interface test coverage calculation apparatus according to an embodiment of the present disclosure. The interface test coverage calculation apparatus in this embodiment includes modules for executing the steps in the embodiments corresponding to fig. 1 to 4. Please refer to fig. 1 to 4 and fig. 1 to 4 for the corresponding embodiments. For convenience of explanation, only the portions related to the present embodiment are shown. Referring to fig. 6, the interface test coverage calculation means 500 may include: an obtaining module 510, a quantity determining module 520, a correcting module 530, and a calculating module 540, wherein:
the obtaining module 510 is configured to obtain group data included in a target system, where the target system includes a plurality of applications, and the group data at least includes an application interface correspondingly used by each application, a number of test cases of each application interface, and a call amount.
A number determination module 520, configured to determine a test number of tested application interfaces from the plurality of application interfaces based on the number of test cases; determining target application interfaces and the target number of the target application interfaces based on the calling amount; the target application interface is the interface actually used by the target system.
The correcting module 530 is configured to adjust a preset correction coefficient according to a ratio of the target number to the total number of the application interfaces, so as to obtain an adjusted target correction coefficient.
And the calculating module 540 is configured to calculate a ratio of the test quantity to the target quantity and the target correction coefficient to obtain an actual interface test coverage of the target system.
In one embodiment, the test quantity determination module 520 is further configured to:
judging whether the number of test cases of the application interface is larger than the preset number of cases or not aiming at the application interface of any application; if the number of the test cases is larger than the preset number of cases, determining the application interface as a tested application interface; counting the number of the tested application interfaces to obtain the test number; judging whether the call volume of the application interface is larger than a preset call volume or not; if the call quantity is larger than the preset call quantity, determining the application interface as a target application interface; and counting the number of the target application interfaces to obtain the target number.
In an embodiment, the interface test coverage calculation apparatus 500 further includes:
and the service data acquisition module is used for acquiring service data from the target application interface, and acquiring the data from the database of the target system when the service data is called by the target application interface.
The target application interface deleting module is used for deleting the target application interface if the service data comprises preset key information; and the key information is used for identifying that the target application interface corresponding to the business data containing the key information is an application interface to be offline.
In one embodiment, the modification module 530 is further configured to:
when the ratio is in a first preset range, increasing the preset correction coefficient to a first preset value; and when the ratio is in a second preset range, reducing the preset correction coefficient to a second preset value.
In an embodiment, the interface test coverage calculation apparatus 500 further includes:
and the untested application interface acquisition module is used for acquiring untested application interfaces of which the number of test cases is less than or equal to the number of preset cases if the interface test coverage rate is lower than the preset coverage rate.
And the offline application interface deleting module is used for deleting the application interface to be offline from the untested application interface.
And the testing module is used for testing the rest untested application interfaces.
In one embodiment, the test module is further configured to:
classifying the untested application interfaces according to the interface types of the untested application interfaces, and taking the untested application interfaces with the same interface types as a group of untested application interfaces; acquiring the number of test cases of all test cases in a group of untested application interfaces; and if the number of the test cases of all the test cases is larger than the preset number of the cases, respectively using all the test cases as the test cases of each untested application interface with the same interface type.
In an embodiment, the interface test coverage calculation apparatus 500 further includes:
and the generating module is used for generating a test report of the interface test coverage rate, wherein the test report comprises the tested application interfaces, the test quantity, the untested application interfaces and the quantity of the untested application interfaces.
It should be understood that, in the structural block diagram of the interface test coverage calculating device shown in fig. 5, each module is used to execute each step in the embodiment corresponding to fig. 1 to 4, and each step in the embodiment corresponding to fig. 1 to 4 has been explained in detail in the above embodiment, and specific reference is made to the relevant description in the embodiment corresponding to fig. 1 to 4 and fig. 1 to 4, which is not repeated herein.
Fig. 6 is a block diagram of a terminal device according to an embodiment of the present application. As shown in fig. 6, the terminal device 600 of this embodiment includes: a processor 610, a memory 620, and a computer program 630, such as a program of an interface test coverage calculation method, stored in the memory 620 and executable at the processor 610. The processor 610 executes the computer program 630 to implement the steps in the embodiments of the interface test coverage calculation methods, such as S101 to S104 shown in fig. 1. Alternatively, the processor 610 executes the computer program 630 to implement the functions of the modules in the embodiment corresponding to fig. 6, for example, the functions of the modules 510 to 540 shown in fig. 6, and refer to the related description in the embodiment corresponding to fig. 5.
Illustratively, the computer program 630 may be divided into one or more modules, and the one or more modules are stored in the memory 620 and executed by the processor 610 to implement the interface test coverage calculation method provided by the embodiments of the present application. One or more of the modules may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution of the computer program 630 in the terminal device 600. For example, the computer program 630 may implement the interface test coverage calculation method provided in the embodiment of the present application.
The terminal device 600 may include, but is not limited to, a processor 610, a memory 620. Those skilled in the art will appreciate that fig. 6 is merely an example of a terminal device 600 and does not constitute a limitation of terminal device 600 and may include more or less components than those shown, or combine certain components, or different components, e.g., the terminal device may also include input output devices, network access devices, buses, etc.
The processor 610 may be a central processing unit, but may also be other general purpose processors, digital signal processors, application specific integrated circuits, off-the-shelf programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The storage 620 may be an internal storage unit of the terminal device 600, such as a hard disk or a memory of the terminal device 600. The memory 620 may also be an external storage device of the terminal device 600, such as a plug-in hard disk, a smart memory card, a flash memory card, etc. provided on the terminal device 600. Further, the memory 620 may also include both an internal storage unit of the terminal apparatus 600 and an external storage device.
The embodiment of the present application provides a terminal device, which includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor, and when the processor executes the computer program, the interface test coverage calculation method in the above embodiments is implemented.
The embodiment of the present application provides a computer-readable storage medium, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor executes the computer program to implement the interface test coverage calculation method in the above embodiments.
The embodiment of the present application provides a computer program product, which, when running on a terminal device, enables the terminal device to execute the interface test coverage calculation method in the foregoing embodiments.
The above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.
Claims (10)
1. An interface test coverage calculation method is characterized by comprising the following steps:
the method comprises the steps that group data contained in a target system are obtained, wherein the target system comprises a plurality of applications, the group data at least comprise application interfaces correspondingly used by the applications, and the number of test cases and the calling amount of the application interfaces;
determining a test number of tested application interfaces from a plurality of the application interfaces based on the number of test cases; determining a target application interface and a target number of the target application interface based on the calling amount; the target application interface is an interface actually used by the target system;
adjusting a preset correction coefficient according to the ratio of the target number to the total number of the application interfaces to obtain an adjusted target correction coefficient;
and calculating the ratio of the test quantity to the target quantity and the target correction coefficient to obtain the actual interface test coverage rate of the target system.
2. The method of claim 1, wherein the determining the number of tests of the tested application interfaces from the plurality of application interfaces based on the number of test cases; and determining a target application interface based on the call amount and a target number of the target application interface, including:
judging whether the number of test cases of the application interface is larger than the number of preset cases or not aiming at the application interface of any application; if the number of the test cases is larger than the preset number of cases, determining the application interface as the tested application interface; counting the number of the tested application interfaces to obtain the test number; and the number of the first and second groups,
judging whether the call volume of the application interface is larger than a preset call volume or not; if the call quantity is larger than the preset call quantity, determining that the application interface is a target application interface; and counting the number of the target application interfaces to obtain the target number.
3. The interface test coverage calculation method according to claim 1 or 2, further comprising, after the determining a target application interface based on the call amount and a target number of the target application interface:
acquiring service data from the target application interface, wherein the service data is acquired from a database of the target system when the service data is called by the target application interface;
if the service data comprises preset key information, deleting the target application interface; the key information is used for identifying that the target application interface corresponding to the business data containing the key information is an application interface to be offline.
4. The method for calculating interface test coverage according to claim 1, wherein the adjusting a preset correction coefficient according to a ratio of the target number to the total number of the application interfaces to obtain an adjusted target correction coefficient includes:
when the ratio is in a first preset range, increasing the preset correction coefficient to a first preset value;
and when the ratio is in a second preset range, reducing the preset correction coefficient to a second preset value.
5. The method according to claim 2, wherein after the calculating the ratio of the test quantity to the target quantity and the target correction coefficient to obtain the actual interface test coverage of the target system, the method further comprises:
if the interface testing coverage rate is lower than a preset coverage rate, obtaining untested application interfaces of which the number of the testing cases is less than or equal to the preset number of cases;
deleting the application interfaces to be off-line from the untested application interfaces;
and testing the rest untested application interfaces.
6. The method of claim 5, wherein the testing the remaining untested application interfaces comprises:
classifying the untested application interfaces according to the interface types of the untested application interfaces, and taking the untested application interfaces with the same interface types as a group of untested application interfaces;
acquiring the number of test cases of all test cases in the group of untested application interfaces;
and if the number of the test cases of all the test cases is larger than the preset number of the cases, respectively using all the test cases as the test cases of each untested application interface with the same interface type.
7. The method of calculating interface test coverage according to any one of claims 1, 2, 4-6, further comprising, after said calculating interface test coverage of said target system according to said test quantity and said target quantity:
and generating a test report of the interface test coverage rate, wherein the test report comprises the tested application interfaces, the test quantity, the untested application interfaces and the quantity of the untested application interfaces.
8. An interface test coverage calculation apparatus, comprising:
the system comprises an acquisition module, a storage module and a control module, wherein the acquisition module is used for acquiring group data contained in a target system, the target system comprises a plurality of applications, the group data at least comprises application interfaces correspondingly used by each application, and the number of test cases and the calling amount of each application interface;
the number determining module is used for determining the testing number of the tested application interfaces from the plurality of application interfaces based on the testing case number; determining a target application interface and a target number of the target application interface based on the calling amount; the target application interface is an interface actually used by the target system;
the correction module is used for adjusting a preset correction coefficient according to the ratio of the target number to the total number of the application interfaces to obtain an adjusted target correction coefficient;
and the calculating module is used for calculating the ratio of the test quantity to the target quantity and the target correction coefficient to obtain the actual interface test coverage rate of the target system.
9. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111435613.4A CN114090456A (en) | 2021-11-29 | 2021-11-29 | Interface test coverage rate calculation method and device, terminal equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111435613.4A CN114090456A (en) | 2021-11-29 | 2021-11-29 | Interface test coverage rate calculation method and device, terminal equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114090456A true CN114090456A (en) | 2022-02-25 |
Family
ID=80305486
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111435613.4A Pending CN114090456A (en) | 2021-11-29 | 2021-11-29 | Interface test coverage rate calculation method and device, terminal equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114090456A (en) |
-
2021
- 2021-11-29 CN CN202111435613.4A patent/CN114090456A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110535777B (en) | Access request control method and device, electronic equipment and readable storage medium | |
CN109474578A (en) | Message method of calibration, device, computer equipment and storage medium | |
CN116611797B (en) | Service tracking and monitoring method, system and storage medium | |
CN112486535A (en) | Remote upgrading method and system for NB-IoT (NB-IoT) equipment | |
CN115879748A (en) | Enterprise informatization management integration platform based on big data | |
CN111182479B (en) | Information sending control method and device | |
CN110084476B (en) | Case adjustment method, device, computer equipment and storage medium | |
CN108280024B (en) | Flow distribution strategy testing method and device and electronic equipment | |
CN114528201A (en) | Abnormal code positioning method, device, equipment and medium | |
CN116955198B (en) | Rule set determining method and device | |
WO2021040852A1 (en) | Assigning a severity level to a computing service using tenant telemetry data | |
CN114090456A (en) | Interface test coverage rate calculation method and device, terminal equipment and storage medium | |
CN110020166B (en) | Data analysis method and related equipment | |
CN116151631A (en) | Service decision processing system, service decision processing method and device | |
CN115220714A (en) | Development method and device of application programming interface | |
CN113452533B (en) | Charging self-inspection and self-healing method and device, computer equipment and storage medium | |
CN113127358A (en) | Test method, test device, electronic equipment and medium | |
CN113297053A (en) | Method and device for determining test coverage rate and storage medium | |
CN105989021A (en) | Document processing method and device | |
CN111163088B (en) | Message processing method, system and device and electronic equipment | |
CN117313856B (en) | Reliability test planning system and method | |
CN113225332B (en) | User login management method, device, terminal equipment and storage medium | |
CN117234929A (en) | Method and device for generating test scene, electronic equipment and storage medium | |
CN113763023B (en) | User identification method, device, electronic equipment and storage medium | |
CN111614749B (en) | Data transmission method, data transmission device, computer equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |