CN117493188A - Interface testing method and device, electronic equipment and storage medium - Google Patents
Interface testing method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN117493188A CN117493188A CN202311474937.8A CN202311474937A CN117493188A CN 117493188 A CN117493188 A CN 117493188A CN 202311474937 A CN202311474937 A CN 202311474937A CN 117493188 A CN117493188 A CN 117493188A
- Authority
- CN
- China
- Prior art keywords
- test
- interface
- version
- information
- test case
- 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
- 238000012360 testing method Methods 0.000 title claims abstract description 478
- 230000008859 change Effects 0.000 claims abstract description 98
- 238000011161 development Methods 0.000 claims description 24
- 230000002159 abnormal effect Effects 0.000 claims description 21
- 238000012544 monitoring process Methods 0.000 claims description 21
- 238000013101 initial test Methods 0.000 claims description 15
- 238000004458 analytical method Methods 0.000 claims description 13
- 238000004590 computer program Methods 0.000 claims description 7
- 238000012549 training Methods 0.000 claims description 7
- 238000010998 test method Methods 0.000 claims description 6
- 238000005516 engineering process Methods 0.000 abstract description 10
- 238000000034 method Methods 0.000 description 20
- 230000006870 function Effects 0.000 description 17
- 238000011056 performance test Methods 0.000 description 10
- 238000012545 processing Methods 0.000 description 8
- 230000006399 behavior Effects 0.000 description 6
- 238000010586 diagram Methods 0.000 description 6
- 230000008569 process Effects 0.000 description 6
- 230000003993 interaction Effects 0.000 description 5
- 230000004044 response Effects 0.000 description 5
- 230000001960 triggered effect Effects 0.000 description 5
- 238000004891 communication Methods 0.000 description 4
- 206010063385 Intellectualisation Diseases 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000004140 cleaning Methods 0.000 description 2
- 230000008878 coupling Effects 0.000 description 2
- 238000010168 coupling process Methods 0.000 description 2
- 238000005859 coupling reaction Methods 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000007613 environmental effect Effects 0.000 description 2
- 238000012827 research and development Methods 0.000 description 2
- 238000012356 Product development Methods 0.000 description 1
- 230000006978 adaptation Effects 0.000 description 1
- 238000013475 authorization Methods 0.000 description 1
- 238000012512 characterization method Methods 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000012216 screening Methods 0.000 description 1
- 238000012956 testing procedure Methods 0.000 description 1
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/3684—Test management for test design, e.g. generating new test cases
-
- 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/368—Test management for test version control, e.g. updating test cases to a new software version
-
- 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/3688—Test management for test execution, e.g. scheduling of test suites
-
- 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/3692—Test management for test results 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 invention discloses an interface testing method and device, electronic equipment and storage medium, and relates to the technical field of computers, wherein the interface testing method comprises the following steps: responding to the version test request to obtain version change information; determining an interface to be tested based on the version change information to obtain interface information; inputting interface information into a test case model and outputting a test case, wherein the test case model is a model which is built in advance and used for generating the test case; generating test data based on the test cases, and constructing an interface test script based on the test cases and the test data; executing an interface test script to perform interface test on the interface to be tested. The invention solves the technical problems of low timeliness, large consumption of manpower and time and limited test coverage rate and accuracy of the interface test mode by manually writing the test script by a developer in a regression stage when the interface test is carried out in the related technology.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to an interface testing method and apparatus, an electronic device, and a storage medium.
Background
Today, the rapid popularization and development of internet technology often provides project environment through comprehensive research and development test platform for 24 hours a day, and on the basis, high-efficiency research and development and test of project products are performed to accelerate product release.
Version updating of a system or an application and the like can be involved in the product development process, namely, the software is updated from one version to another version, new functions can be introduced through the version updating, existing functions can be improved, vulnerabilities can be repaired, system performance can be improved, the version updating can provide better user experience, the functions and safety of the software can be enhanced, and the changing requirements of users can be met, in the version updating process, the interface can be changed, such as new addition or changing, and the like, can be the specification of communication and interaction between different modules in the software, and can influence the calling and normal use of other modules if the interface in the software is changed.
With the interface change caused by the update of the version and the release of the new version, the performance of the interface needs to be verified in a test environment through interface test, so that the updated version can be guaranteed to normally run.
In view of the above problems, no effective solution has been proposed at present.
Disclosure of Invention
The embodiment of the invention provides an interface testing method and device, electronic equipment and storage medium, which at least solve the technical problems of low timeliness, large consumption of manpower and time and limited test coverage rate and accuracy in the related art by manually writing a test script by a developer in a regression stage when the interface test is performed.
According to an aspect of an embodiment of the present invention, there is provided an interface testing method, including: responding to a version test request, and acquiring version change information, wherein the version change information is used for recording change of a changed version; determining an interface to be tested based on the version change information to obtain interface information; inputting the interface information into a test case model, and outputting a test case, wherein the test case model is a model which is built in advance and used for generating the test case; generating test data based on the test cases, and constructing an interface test script based on the test cases and the test data; and executing the interface test script to perform interface test on the interface to be tested.
Further, before the version change information is acquired, the method further includes: monitoring version release operation of a development terminal, and obtaining a monitoring result under the condition that the development terminal executes the version release operation; and determining a version to be tested based on the monitoring result, triggering an automatic version test, and generating a version test request.
Further, the step of obtaining version change information includes: inquiring a code warehouse based on the version test request to obtain version nodes corresponding to the versions to be tested, wherein the code warehouse displays the relation among the versions in the form of a base line and nodes; determining a comparison node based on the version node, wherein the comparison node is a version node corresponding to a historical version which needs to be compared with a version to be tested; and acquiring the version change information based on the version node and the comparison node.
Further, the step of acquiring the version change information based on the version node and the comparison node includes: based on the version node and the comparison node, reading a data warehouse, and acquiring version information corresponding to the version node and version information corresponding to the comparison node; and analyzing and comparing the version information to obtain the version change information.
Further, the test case model is pre-constructed, and the step of constructing the test case model includes: collecting historical version information, interface information corresponding to the historical version and historical test cases to obtain a historical data set; characterizing and vectorizing the historical data set to obtain a sample data set; dividing the sample data set into a sample set and a test set based on a preset dividing ratio; training an initial model based on the sample set to obtain an initial test case model; and testing the initial test case model based on the test set to obtain a test result, and obtaining the test case model under the condition that the test result indicates that the accuracy rate of the output test case of the initial test case model is greater than a preset threshold value.
Further, after performing the interface test on the interface to be tested, the method further includes: obtaining a test result of the interface to be tested; and acquiring a test report template based on the interface to be tested, and generating an interface test report based on a test result and the test report template.
Further, after generating an interface test report based on the test result and the test report template, the method further comprises: analyzing the interface test report to obtain an analysis result, and marking the abnormal interface when the analysis result shows that the abnormal interface exists; and sending the marked interface information of the abnormal interface to a development terminal.
According to another aspect of the embodiment of the present invention, there is also provided an interface testing apparatus, including: the system comprises an acquisition unit, a version test unit and a version change unit, wherein the acquisition unit is used for responding to a version test request and acquiring version change information, and the version change information is used for recording change of a changed version; the determining unit is used for determining an interface to be tested based on the version change information to obtain interface information; the input unit is used for inputting the interface information into a test case model and outputting a test case, wherein the test case model is a model which is built in advance and used for generating the test case; the generating unit is used for generating test data based on the test case and constructing an interface test script based on the test case and the test data; and the test unit is used for executing the interface test script so as to perform interface test on the interface to be tested.
Further, the interface test device further includes: the first monitoring module is used for monitoring version release operation of the development terminal, and obtaining a monitoring result under the condition that the development terminal executes the version release operation; the first determining module is used for determining the version to be tested based on the monitoring result, triggering an automatic version test and generating a version test request.
Further, the acquisition unit includes: the first query module is used for querying a code warehouse based on the version test request to obtain version nodes corresponding to the versions to be tested, wherein the code warehouse displays the relation among the versions in the form of a base line and nodes; the second determining module is used for determining a comparison node based on the version node, wherein the comparison node is a version node corresponding to a historical version which needs to be compared with the version to be tested; the first acquisition module is used for acquiring the version change information based on the version node and the comparison node.
Further, the first acquisition module includes: the first reading sub-module is used for reading a data warehouse based on the version node and the comparison node and acquiring version information corresponding to the version node and version information corresponding to the comparison node; and the first comparison sub-module is used for analyzing and comparing the version information to acquire the version change information.
Further, the interface test device further includes: the first acquisition module is used for acquiring historical version information, historical version corresponding interface information and historical test cases to obtain a historical data set; the first processing module is used for carrying out characterization and vectorization on the historical data set to obtain a sample data set; the first dividing module is used for dividing the sample data set into a sample set and a test set based on a preset dividing proportion; the first training module is used for training the initial model based on the sample set to obtain an initial test case model; the first test module is used for testing the initial test case model based on the test set to obtain a test result, and the test case model is obtained under the condition that the test result indicates that the accuracy rate of the output test case of the initial test case model is greater than a preset threshold value.
Further, the interface test device further includes: the second acquisition module is used for acquiring a test result of the interface to be tested; the first generation module is used for acquiring a test report template based on the interface to be tested and generating an interface test report based on the test result and the test report template.
Further, the interface test device further includes: the first analysis module is used for analyzing the interface test report to obtain an analysis result, and marking the abnormal interface under the condition that the analysis result shows that the abnormal interface exists; and the first sending module is used for sending the marked interface information of the abnormal interface to the development terminal.
According to another aspect of the embodiment of the present invention, there is also provided a computer readable storage medium, where the computer readable storage medium includes a stored computer program, and when the computer program runs, the device in which the computer readable storage medium is controlled to execute any one of the interface testing methods described above.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device including one or more processors and a memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement any one of the interface testing methods described above.
In the present disclosure, the method comprises the following steps: firstly responding to a version test request, acquiring version change information, wherein the version change information is used for recording change of a changed version, determining an interface to be tested based on the version change information to obtain interface information, inputting the interface information into a test case model, and outputting a test case, wherein the test case model is a model which is built in advance and is used for generating the test case, generating test data based on the test case, and constructing an interface test script based on the test case and the test data; and finally executing an interface test script to perform interface test on the interface to be tested.
In the method, the interface to be tested can be automatically positioned through version change information, so that the interface can be rapidly and accurately tested, when the interface is tested, the interface information is input into the test case model, the test case can be directly output, the intellectualization of the test case acquisition flow is realized, an interface test script is generated according to the test case and test data, the interface test is carried out by executing the script, the manual writing task amount is reduced, the interface test efficiency is improved, the technical problems that in the related technology, when the interface test is carried out, the interface test is carried out by manually writing the test script in a regression stage by a developer, the timeliness is low, a large amount of manpower and time are consumed, and the test coverage rate and accuracy are limited are solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiments of the invention and together with the description serve to explain the invention and do not constitute a limitation on the invention. In the drawings:
FIG. 1 is a flow chart of an alternative interface testing method according to an embodiment of the invention;
FIG. 2 is a schematic diagram of an alternative interface test flow according to an embodiment of the invention;
FIG. 3 is a schematic diagram of an alternative interface testing apparatus according to an embodiment of the invention;
fig. 4 is a block diagram of a hardware structure of an electronic device (or mobile device) of an interface test method according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that, the interface test method and the device thereof in the present disclosure may be used in the computer technical field to automatically generate a test case based on a test case model, and further, in any field other than the computer technical field to automatically generate a test case based on a test case model, and further, in the case of testing an interface, the application field of the interface test method and the device thereof in the present disclosure is not limited.
It should be noted that, related information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present disclosure are information and data authorized by a user or sufficiently authorized by each party, and the collection, use and processing of related data need to comply with related laws and regulations and standards of related areas, and are provided with corresponding operation entries for the user to select authorization or rejection. For example, an interface is provided between the system and the relevant user or institution, before acquiring the relevant information, the system needs to send an acquisition request to the user or institution through the interface, and acquire the relevant information after receiving the consent information fed back by the user or institution.
The following embodiments of the present invention are applicable to a variety of interface test systems/applications/devices. According to the invention, version change information is obtained by reading the code warehouse and the data warehouse, and then the interface to be tested is accurately positioned according to the version change information, the interface information is obtained, the test case is automatically generated based on the interface information, the test script is generated based on the test case and the test data, the interface test is performed, the manual writing workload of the test script is reduced, the script test flow is simplified, and the script test efficiency is improved.
The present invention will be described in detail with reference to the following examples.
Example 1
In accordance with an embodiment of the present invention, there is provided an embodiment of an interface testing method, it being noted that the steps shown in the flowcharts of the figures may be performed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowcharts, in some cases the steps shown or described may be performed in an order other than that shown or described herein.
FIG. 1 is a flow chart of an alternative interface testing method according to an embodiment of the invention, as shown in FIG. 1, comprising the steps of:
step S101, responding to a version test request, and acquiring version change information, wherein the version change information is used for recording change of a changed version;
step S102, determining an interface to be tested based on version change information to obtain interface information;
step S103, inputting interface information into a test case model and outputting a test case, wherein the test case model is a model which is built in advance and used for generating the test case;
step S104, generating test data based on the test cases, and constructing an interface test script based on the test cases and the test data;
Step S105, executing an interface test script to perform interface test on the interface to be tested.
Firstly responding to a version test request to obtain version change information, wherein the version change information is used for recording change of a changed version, determining an interface to be tested based on the version change information to obtain interface information, inputting the interface information into a test case model, and outputting a test case, wherein the test case model is a model which is built in advance and is used for generating the test case, generating test data based on the test case, and building an interface test script based on the test case and the test data; and finally executing an interface test script to perform interface test on the interface to be tested.
In the embodiment, the interface to be tested can be automatically positioned through version change information, so that the interface can be rapidly and accurately tested, when the interface is tested, the interface information is input into the test case model, the test case can be directly output, the intellectualization of the test case acquisition flow is realized, the interface test script is generated according to the test case and the test data, the interface test is performed by executing the script, the manual writing task amount is reduced, the interface test efficiency is improved, and the technical problems that in the related technology, when the interface test is performed, the interface test is performed by manually writing the test script through a developer in a regression stage are solved, the timeliness is low, a large amount of manpower and time are consumed, and the test coverage rate and the accuracy are limited are solved.
Embodiments of the present invention will be described in detail with reference to the following steps.
It should be noted that, in the field of computer technology, with the change of a project, the update of a version, the new addition and the change of an interface and the like are often accompanied, after the update of the version, performance test is often required for the version, the most common performance test is interface test, and the interface test can confirm that the communication between different components and services in a software system is normal, ensure the correctness, reliability, performance and safety of the interface, and is beneficial to improving the stability of the system, reducing potential errors and risks and providing reliable user experience.
It should be noted that the interface test may be divided into the following aspects: firstly, verifying functions, namely verifying whether functions and use cases defined by an interface work normally according to design requirements by an interface test, wherein the functions and use cases comprise checking whether input and output of the interface are correct, whether response accords with expectations, whether abnormal conditions are processed correctly and the like; second, performance and load testing, interface testing may also be used to evaluate the performance and load capabilities of the interface, including testing the response time, concurrent processing capability, throughput, and resource consumption of the interface, etc., to ensure reliability and efficiency under practical use conditions; thirdly, security testing, wherein the security and vulnerability of the interface can be verified through interface testing, including checking whether security holes exist, whether the possibility of unauthorized access to the interface exists or not, and the like; fourth, the consistency test, interface test can also verify the consistency of the interface, ensure the consistency of different versions or different realization interfaces in behavior and results.
Optionally, before the version change information is acquired, the method further includes: monitoring version release operation of the development terminal, and obtaining a monitoring result under the condition that the development terminal executes the version release operation; and determining the version to be tested based on the monitoring result, triggering an automatic version test, and generating a version test request.
It should be noted that, in the embodiment of the present invention, a monitoring tool is configured to monitor a release operation of a development terminal, and when the development terminal releases a new version, a test task is created according to a monitoring result, an automatic version test is triggered, a version test request is generated, the version test request is sent to an interface test system, and the automatic triggering test system performs a performance test on an interface, so that a developer does not need to wait until a regression stage to manually perform a test, thereby accelerating a test flow and improving test quality.
Step S101, responding to a version test request, and acquiring version change information, wherein the version change information is used for recording change of a changed version.
It should be noted that, the implementation main body of the embodiment of the present invention is an interface test system, after receiving an automatically triggered version test request, the system locates an interface to be tested by acquiring version change information, so as to perform performance test on the interface, where the version change information records changes between the latest version and the previous version or other versions, and when there is a function change between the newly added version and the previous version, a module interaction change and the like, the change of the interaction interface is caused, so that the newly added or changed interface needs to be tested, and the new version is ensured to be able to be normally used.
Optionally, the step of obtaining version change information includes: inquiring a code warehouse based on the version test request, and acquiring version nodes corresponding to the versions to be tested, wherein the code warehouse displays the relation among the versions in the form of a base line and nodes; determining a comparison node based on the version node, wherein the comparison node is a version node corresponding to a historical version which needs to be compared with the version to be tested; version change information is acquired based on the version nodes and the comparison nodes.
In the process of developing, updating, maintaining, etc., a project task is generally divided into a plurality of branches based on the same backbone, and after source codes corresponding to the backbone are determined, the source codes of the branches are developed or changed in parallel, so that the working efficiency can be improved. In the embodiment of the application, before interface test is performed, a code warehouse is queried according to a version query request, all versions in the code warehouse are recorded through a main branch, a sub-branch and branch nodes, version nodes of a version to be tested and a version to be compared can be determined through querying the code warehouse, version information can be extracted from a data warehouse according to the version nodes, and version information is traversed and compared to obtain version change information of the version to be tested.
Optionally, the step of acquiring version change information based on the version node and the comparison node includes: reading a data warehouse based on the version node and the comparison node, and acquiring version information corresponding to the version node and version information corresponding to the comparison node; and analyzing and comparing the version information to obtain version change information.
After the query code repository obtains the version nodes of the versions to be tested and the comparison nodes to be compared, the query data repository can obtain the version information corresponding to each node, and the version information is analyzed and compared to obtain the version change information.
Step S102, determining an interface to be tested based on the version change information to obtain interface information.
After version change information is obtained, the version change information is analyzed, and information related to the interface is particularly focused, for example, an interface is added, modified or deleted, the interface parameter is changed, the interface return value is changed, and the corresponding interface name and related information are recorded for each change item.
Step S103, inputting interface information into a test case model and outputting a test case, wherein the test case model is a model which is built in advance and used for generating the test case.
It should be noted that, the interface test is written independently of the test case, the test case is a specific test scenario or test condition, the purpose of verifying the correctness of the application software system or the specific function is to be taken as a detailed guide of the test, and the test data, the expected result and the execution steps are specified so that the tester can develop the test activity according to the predetermined plan, and the test case may include the following elements: the test target definitely designates a software system, a function or a module to be tested; input data for performing a test; expected results, which may be determined values, states, or specific behaviors, describe the expected output or behavior of each test case; an execution step of providing a specific step or an operation guide to be followed by a tester when executing the test case; preconditions, designating preconditions and environmental settings required to run test cases; a post condition for providing a cleaning or restoring operation after the test case is executed; priority and severity, and test cases are assigned priority and severity levels.
Optionally, the test case model is pre-built, and the step of building the test case model includes: collecting historical version information, interface information corresponding to the historical version and historical test cases to obtain a historical data set; characterizing and vectorizing the historical data set to obtain a sample data set; dividing a sample data set into a sample set and a test set based on a preset dividing ratio; training an initial model based on a sample set to obtain an initial test case model; and testing the initial test case model based on the test set to obtain a test result, and obtaining the test case model under the condition that the test result indicates that the accuracy rate of the output test case of the initial test case model is greater than a preset threshold value.
It should be noted that, the embodiment of the invention adopts an intelligent test mode, and combines the AI technology to construct a test case model, so that the system can automatically generate test cases according to the interface information of the interface to be tested, configure different test environments and test conditions for different interfaces, reduce the workload of manual configuration of developers, and improve the test efficiency of the interfaces.
Step S104, generating test data based on the test cases, and constructing an interface test script based on the test cases and the test data.
After the test cases are obtained, test data are configured for the interface test, an automatic test case is generated based on the test cases and the test data, and an interface test script is generated according to the automatic test case.
Step S105, executing an interface test script to perform interface test on the interface to be tested.
Optionally, after performing the interface test on the interface to be tested, the method further includes: obtaining a test result of an interface to be tested; and acquiring a test report template based on the interface to be tested, and generating an interface test report based on a test result and the test report template.
It should be noted that, executing the interface test script can complete the performance test of the interface, and according to the test result output by the script, the test report template is called, and according to the template, the interface test report is generated.
Optionally, after generating the interface test report based on the test result and the test report template, the method further comprises: analyzing the interface test report to obtain an analysis result, and marking the abnormal interface under the condition that the analysis result shows that the abnormal interface exists; and sending the marked interface information of the abnormal interface to the development terminal.
After the interface test report is obtained, the interface test report is analyzed, when an abnormal interface exists, the interface is marked, interface information and abnormal information are sent to the development terminal, and the development terminal adjusts and improves the interface.
The following detailed description is directed to alternative embodiments.
FIG. 2 is a schematic diagram of an alternative interface testing procedure according to an embodiment of the present invention, as shown in FIG. 2, the procedure of the interface testing includes:
step one, starting;
step two, version change information is obtained;
step three, obtaining relevant interface information through version change information;
step four, screening and filtering to obtain an interface to be tested;
inputting interface information of an interface to be tested into a test case model, and outputting a test case;
Step six, generating test data according to the test cases;
step seven, combining the test case and the test data to obtain an automatic test case;
step eight, generating a test script and executing the script to test the interface;
step nine, generating a test report according to a report template;
and step ten, ending.
In the embodiment of the invention, the version change information is obtained by reading the code warehouse and the data warehouse, the interface to be tested is accurately positioned according to the version change information, the interface information is obtained, the test case is automatically generated based on the interface information, the test script is generated based on the test case and the test data, the interface test is carried out, the manual writing workload of the test script is reduced, the script test flow is simplified, and the script test efficiency is improved.
The following describes in detail another embodiment.
Example two
An interface testing apparatus provided in this embodiment includes a plurality of implementation units, each implementation unit corresponding to each implementation step in the first embodiment.
FIG. 3 is a schematic diagram of an alternative interface testing apparatus, as shown in FIG. 3, according to an embodiment of the present invention, comprising: an acquisition unit 31, a determination unit 32, an input unit 33, a generation unit 34, a test unit 35, wherein,
An obtaining unit 31, configured to obtain version change information in response to a version test request, where the version change information is used to record a change of a changed version;
a determining unit 32, configured to determine an interface to be tested based on the version change information, and obtain interface information;
an input unit 33, configured to input interface information into a test case model, and output a test case, where the test case model is a model that is built in advance and is used to generate the test case;
a generating unit 34, configured to generate test data based on the test case, and construct an interface test script based on the test case and the test data;
and the test unit 35 is used for executing an interface test script to perform interface test on the interface to be tested.
In the interface test device, the obtaining unit 31 responds to the version test request to obtain version change information, wherein the version change information is used for recording the change of the changed version; determining an interface to be tested based on the version change information by the determining unit 32 to obtain interface information; inputting interface information into a test case model through an input unit 33, and outputting a test case, wherein the test case model is a model which is built in advance and used for generating the test case; generating test data based on the test cases by the generating unit 34, and constructing an interface test script based on the test cases and the test data; the interface test script is executed by the test unit 35 to perform an interface test on the interface to be tested.
In the embodiment, the interface to be tested can be automatically positioned through version change information, so that the interface can be rapidly and accurately tested, when the interface is tested, the interface information is input into the test case model, the test case can be directly output, the intellectualization of the test case acquisition flow is realized, the interface test script is generated according to the test case and the test data, the interface test is performed by executing the script, the manual writing task amount is reduced, the interface test efficiency is improved, and the technical problems that in the related technology, when the interface test is performed, the interface test is performed by manually writing the test script through a developer in a regression stage are solved, the timeliness is low, a large amount of manpower and time are consumed, and the test coverage rate and the accuracy are limited are solved.
It should be noted that, in the field of computer technology, with the change of a project, the update of a version, the new addition and the change of an interface and the like are often accompanied, after the update of the version, performance test is often required for the version, the most common performance test is interface test, and the interface test can confirm that the communication between different components and services in a software system is normal, ensure the correctness, reliability, performance and safety of the interface, and is beneficial to improving the stability of the system, reducing potential errors and risks and providing reliable user experience.
It should be noted that the interface test may be divided into the following aspects: firstly, verifying functions, namely verifying whether functions and use cases defined by an interface work normally according to design requirements by an interface test, wherein the functions and use cases comprise checking whether input and output of the interface are correct, whether response accords with expectations, whether abnormal conditions are processed correctly and the like; second, performance and load testing, interface testing may also be used to evaluate the performance and load capabilities of the interface, including testing the response time, concurrent processing capability, throughput, and resource consumption of the interface, etc., to ensure reliability and efficiency under practical use conditions; thirdly, security testing, wherein the security and vulnerability of the interface can be verified through interface testing, including checking whether security holes exist, whether the possibility of unauthorized access to the interface exists or not, and the like; fourth, the consistency test, interface test can also verify the consistency of the interface, ensure the consistency of different versions or different realization interfaces in behavior and results.
Optionally, the interface test device further includes: the first monitoring module is used for monitoring version release operation of the development terminal, and obtaining a monitoring result under the condition that the development terminal executes the version release operation; the first determining module is used for determining the version to be tested based on the monitoring result, triggering the automatic version test and generating a version test request.
It should be noted that, in the embodiment of the present invention, a monitoring tool is configured to monitor a release operation of a development terminal, and when the development terminal releases a new version, a test task is created according to a monitoring result, an automatic version test is triggered, a version test request is generated, the version test request is sent to an interface test system, and the test system is automatically triggered to perform a performance test on an interface, so that a developer does not need to wait until a regression stage to manually perform a test, thereby accelerating a test flow and improving test quality.
It should be noted that, the implementation main body of the embodiment of the present invention is an interface test system, after receiving an automatically triggered version test request, the system locates an interface to be tested by acquiring version change information, so as to perform performance test on the interface, where the version change information records changes between the latest version and the previous version or other versions, and when there is a function change between the newly added version and the previous version, a module interaction change and the like, the change of the interaction interface is caused, so that the newly added or changed interface needs to be tested, and the new version is ensured to be able to be normally used.
Optionally, the acquiring unit includes: the first query module is used for querying a code warehouse based on the version test request to obtain version nodes corresponding to the versions to be tested, wherein the code warehouse displays the relation among the versions in the form of a base line and the nodes; the second determining module is used for determining a comparison node based on the version node, wherein the comparison node is a version node corresponding to a historical version which needs to be compared with the version to be tested; the first acquisition module is used for acquiring version change information based on the version node and the comparison node.
In the process of developing, updating, maintaining, etc., a project task is generally divided into a plurality of branches based on the same backbone, and after source codes corresponding to the backbone are determined, the source codes of the branches are developed or changed in parallel, so that the working efficiency can be improved. In the embodiment of the application, before interface test is performed, a code warehouse is queried according to a version query request, all versions in the code warehouse are recorded through a main branch, a sub-branch and branch nodes, version nodes of a version to be tested and a version to be compared can be determined through querying the code warehouse, version information can be extracted from a data warehouse according to the version nodes, and version information is traversed and compared to obtain version change information of the version to be tested.
Optionally, the first acquisition module includes: the first reading sub-module is used for reading the data warehouse based on the version node and the comparison node and obtaining version information corresponding to the version node and version information corresponding to the comparison node; the first comparison sub-module is used for analyzing and comparing the version information to obtain version change information.
After the query code repository obtains the version nodes of the versions to be tested and the comparison nodes to be compared, the query data repository can obtain the version information corresponding to each node, and the version information is analyzed and compared to obtain the version change information.
Optionally, the interface test device further includes: the first acquisition module is used for acquiring historical version information, historical version corresponding interface information and historical test cases to obtain a historical data set; the first processing module is used for characterizing and vectorizing the historical data set to obtain a sample data set; the first dividing module is used for dividing the sample data set into a sample set and a test set based on a preset dividing proportion; the first training module is used for training the initial model based on the sample set to obtain an initial test case model; the first test module is used for testing the initial test case model based on the test set to obtain a test result, and the test case model is obtained under the condition that the test result indicates that the accuracy rate of the output test case of the initial test case model is greater than a preset threshold value.
It should be noted that, the interface test is written independently of the test case, the test case is a specific test scenario or test condition, the purpose of verifying the correctness of the application software system or the specific function is to be taken as a detailed guide of the test, and the test data, the expected result and the execution steps are specified so that the tester can develop the test activity according to the predetermined plan, and the test case may include the following elements: the test target definitely designates a software system, a function or a module to be tested; input data for performing a test; expected results, which may be determined values, states, or specific behaviors, describe the expected output or behavior of each test case; an execution step of providing a specific step or an operation guide to be followed by a tester when executing the test case; preconditions, designating preconditions and environmental settings required to run test cases; a post condition for providing a cleaning or restoring operation after the test case is executed; priority and severity, and test cases are assigned priority and severity levels.
Optionally, the interface test device further includes: the second acquisition module is used for acquiring a test result of the interface to be tested; the first generation module is used for acquiring a test report template based on the interface to be tested and generating an interface test report based on the test result and the test report template.
It should be noted that, executing the interface test script can complete the performance test of the interface, and according to the test result output by the script, the test report template is called, and according to the template, the interface test report is generated.
Optionally, the interface test device further includes: the first analysis module is used for analyzing the interface test report to obtain an analysis result, and marking the abnormal interface under the condition that the analysis result shows that the abnormal interface exists; and the first sending module is used for sending the marked interface information of the abnormal interface to the development terminal.
After the interface test report is obtained, the interface test report is analyzed, when an abnormal interface exists, the interface is marked, interface information and abnormal information are sent to the development terminal, and the development terminal adjusts and improves the interface.
The interface test device may further include a processor and a memory, where the acquisition unit 31, the determination unit 32, the input unit 33, the generation unit 34, the test unit 35, and the like are stored as program units, and the processor executes the program units stored in the memory to implement corresponding functions.
The processor includes a kernel, and the kernel fetches a corresponding program unit from the memory. The kernel may be provided with one or more interfaces to be tested by adjusting kernel parameters.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM), which includes at least one memory chip.
According to another aspect of the embodiment of the present invention, there is also provided a computer readable storage medium, where the computer readable storage medium includes a stored computer program, and when the computer program is executed, the device on which the computer readable storage medium is located is controlled to execute any one of the interface testing methods described above.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device including one or more processors and a memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement any one of the interface testing methods described above.
The present application also provides a computer program product adapted to perform, when executed on a data processing device, a program initialized with the method steps of: responding to the version test request, and acquiring version change information, wherein the version change information is used for recording the change of a changed version; determining an interface to be tested based on the version change information to obtain interface information; inputting interface information into a test case model and outputting a test case, wherein the test case model is a model which is built in advance and used for generating the test case; generating test data based on the test cases, and constructing an interface test script based on the test cases and the test data; executing an interface test script to perform interface test on the interface to be tested.
Fig. 4 is a block diagram of a hardware structure of an electronic device (or mobile device) of an interface test method according to an embodiment of the present invention. As shown in fig. 4, the electronic device may include one or more (shown in fig. 4 as 402a, 402b, … …,402 n) processors 402 (the processors 402 may include, but are not limited to, a microprocessor MCU, a programmable logic device FPGA, etc. processing means), a memory 404 for storing data. In addition, the method may further include: a display, an input/output interface (I/O interface), a Universal Serial Bus (USB) port (which may be included as one of the ports of the I/O interface), a network interface, a keyboard, a power supply, and/or a camera. It will be appreciated by those of ordinary skill in the art that the configuration shown in fig. 4 is merely illustrative and is not intended to limit the configuration of the electronic device described above. For example, the electronic device may also include more or fewer components than shown in FIG. 4, or have a different configuration than shown in FIG. 4.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
In the foregoing embodiments of the present invention, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed technology content may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and the division of the units, for example, may be a logic function division, and may be implemented in another manner, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium, including instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely a preferred embodiment of the present invention and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present invention, which are intended to be comprehended within the scope of the present invention.
Claims (10)
1. An interface testing method, comprising:
responding to a version test request, and acquiring version change information, wherein the version change information is used for recording change of a changed version;
determining an interface to be tested based on the version change information to obtain interface information;
inputting the interface information into a test case model, and outputting a test case, wherein the test case model is a model which is built in advance and used for generating the test case;
generating test data based on the test cases, and constructing an interface test script based on the test cases and the test data;
and executing the interface test script to perform interface test on the interface to be tested.
2. The interface testing method according to claim 1, further comprising, before acquiring the version change information:
monitoring version release operation of a development terminal, and obtaining a monitoring result under the condition that the development terminal executes the version release operation;
and determining a version to be tested based on the monitoring result, triggering an automatic version test, and generating a version test request.
3. The interface test method according to claim 2, wherein the step of acquiring version change information includes:
Inquiring a code warehouse based on the version test request to obtain version nodes corresponding to the versions to be tested, wherein the code warehouse displays the relation among the versions in the form of a base line and nodes;
determining a comparison node based on the version node, wherein the comparison node is a version node corresponding to a historical version which needs to be compared with a version to be tested;
and acquiring the version change information based on the version node and the comparison node.
4. The interface testing method according to claim 3, wherein the step of acquiring the version change information based on the version node and the comparison node comprises:
based on the version node and the comparison node, reading a data warehouse, and acquiring version information corresponding to the version node and version information corresponding to the comparison node;
and analyzing and comparing the version information to obtain the version change information.
5. The interface testing method according to claim 1, wherein the test case model is pre-built, and the step of building the test case model includes:
collecting historical version information, interface information corresponding to the historical version and historical test cases to obtain a historical data set;
Characterizing and vectorizing the historical data set to obtain a sample data set;
dividing the sample data set into a sample set and a test set based on a preset dividing ratio;
training an initial model based on the sample set to obtain an initial test case model;
and testing the initial test case model based on the test set to obtain a test result, and obtaining the test case model under the condition that the test result indicates that the accuracy rate of the output test case of the initial test case model is greater than a preset threshold value.
6. The interface testing method according to claim 1, further comprising, after performing the interface test on the interface to be tested:
obtaining a test result of the interface to be tested;
and acquiring a test report template based on the interface to be tested, and generating an interface test report based on the test result and the test report template.
7. The interface test method of claim 6, further comprising, after generating an interface test report based on the test result and a test report template:
analyzing the interface test report to obtain an analysis result, and marking the abnormal interface when the analysis result shows that the abnormal interface exists;
And sending the marked interface information of the abnormal interface to a development terminal.
8. An interface testing apparatus, comprising:
the system comprises an acquisition unit, a version test unit and a version change unit, wherein the acquisition unit is used for responding to a version test request and acquiring version change information, and the version change information is used for recording change of a changed version;
the determining unit is used for determining an interface to be tested based on the version change information to obtain interface information;
the input unit is used for inputting the interface information into a test case model and outputting a test case, wherein the test case model is a model which is built in advance and used for generating the test case;
the generating unit is used for generating test data based on the test case and constructing an interface test script based on the test case and the test data;
and the test unit is used for executing the interface test script so as to perform interface test on the interface to be tested.
9. A computer readable storage medium, characterized in that the computer readable storage medium comprises a stored computer program, wherein the computer program, when run, controls a device in which the computer readable storage medium is located to perform the interface testing method of any one of claims 1 to 7.
10. An electronic device comprising one or more processors and a memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the interface testing method of any of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311474937.8A CN117493188A (en) | 2023-11-07 | 2023-11-07 | Interface testing method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311474937.8A CN117493188A (en) | 2023-11-07 | 2023-11-07 | Interface testing method and device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117493188A true CN117493188A (en) | 2024-02-02 |
Family
ID=89673960
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311474937.8A Pending CN117493188A (en) | 2023-11-07 | 2023-11-07 | Interface testing method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117493188A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117724989A (en) * | 2024-02-18 | 2024-03-19 | 粤港澳大湾区数字经济研究院(福田) | Regression testing method and device for interface, terminal and storage medium |
-
2023
- 2023-11-07 CN CN202311474937.8A patent/CN117493188A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117724989A (en) * | 2024-02-18 | 2024-03-19 | 粤港澳大湾区数字经济研究院(福田) | Regression testing method and device for interface, terminal and storage medium |
CN117724989B (en) * | 2024-02-18 | 2024-06-11 | 粤港澳大湾区数字经济研究院(福田) | Regression testing method and device for interface, terminal and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109582301B (en) | Service processing method, device, equipment and medium based on task scheduling system | |
CN108984389B (en) | Application program testing method and terminal equipment | |
CN109543417B (en) | Vulnerability mining method and device based on Qemu platform | |
CN112241360A (en) | Test case generation method, device, equipment and storage medium | |
CN112650688A (en) | Automated regression testing method, associated device and computer program product | |
CN114546738A (en) | Server general test method, system, terminal and storage medium | |
CN112052172A (en) | Rapid testing method and device for third-party channel and electronic equipment | |
CN112540924A (en) | Interface automation test method, device, equipment and storage medium | |
CN113590454A (en) | Test method, test device, computer equipment and storage medium | |
CN113377667A (en) | Scene-based testing method and device, computer equipment and storage medium | |
CN111708712A (en) | User behavior test case generation method, flow playback method and electronic equipment | |
CN117493188A (en) | Interface testing method and device, electronic equipment and storage medium | |
CN114676066A (en) | Security testing method and device for target application, electronic equipment and storage medium | |
CN112084108A (en) | Test script generation method and device and related components | |
CN107102938B (en) | Test script updating method and device | |
CN113742211A (en) | Test method, Appium client and computer storage medium | |
CN117455401A (en) | Verification method and device for emergency plan, electronic equipment and storage medium | |
CN116955193A (en) | Interface testing method, device, equipment and storage medium | |
CN113238901B (en) | Multi-device automatic testing method and device, storage medium and computer device | |
CN115934559A (en) | Testing method of intelligent form testing system | |
CN113791980A (en) | Test case conversion analysis method, device, equipment and storage medium | |
CN114218073A (en) | Interface testing method, device, server and medium | |
CN114416596A (en) | Application testing method and device, computer equipment and storage medium | |
CN113986263A (en) | Code automation test method, device, electronic equipment and storage medium | |
CN113282504A (en) | Incremental code coverage rate detection method and service development method and device |
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 |