CN115454851A - Interface regression testing method and device, storage medium and electronic device - Google Patents

Interface regression testing method and device, storage medium and electronic device Download PDF

Info

Publication number
CN115454851A
CN115454851A CN202211116990.6A CN202211116990A CN115454851A CN 115454851 A CN115454851 A CN 115454851A CN 202211116990 A CN202211116990 A CN 202211116990A CN 115454851 A CN115454851 A CN 115454851A
Authority
CN
China
Prior art keywords
interface
tested
test
regression
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211116990.6A
Other languages
Chinese (zh)
Inventor
付丽莉
马丹
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Qingdao Haier Technology Co Ltd
Haier Smart Home Co Ltd
Haier Uplus Intelligent Technology Beijing Co Ltd
Original Assignee
Qingdao Haier Technology Co Ltd
Haier Smart Home Co Ltd
Haier Uplus Intelligent Technology Beijing Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Qingdao Haier Technology Co Ltd, Haier Smart Home Co Ltd, Haier Uplus Intelligent Technology Beijing Co Ltd filed Critical Qingdao Haier Technology Co Ltd
Priority to CN202211116990.6A priority Critical patent/CN115454851A/en
Publication of CN115454851A publication Critical patent/CN115454851A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis

Abstract

The application discloses an interface regression testing method, device, storage medium and electronic device, relating to the technical field of smart home/smart home, wherein the method comprises the following steps: acquiring a test case corresponding to an interface to be tested; sending a regression test request to the interface to be tested based on the test case, and receiving an interface return value sent by the interface to be tested based on the regression test request; carrying out correctness check on the interface return value based on a preset assertion value, and determining a check result of the interface to be tested; and determining a regression test result of the interface to be tested based on the verification result of the interface to be tested. The method and the device provided by the application realize the automation of the interface regression test, do not need to manually perform the repetitive regression test, reduce the test time, improve the test efficiency, ensure the timely online of the software project and improve the use experience of the user.

Description

Interface regression testing method and device, storage medium and electronic device
Technical Field
The application relates to the technical field of smart home/smart home, in particular to an interface regression testing method and device, a storage medium and an electronic device.
Background
In the development process of software, after a new function requirement appears or an existing function requirement is subjected to iterative optimization, an original scene logic is covered to perform interface regression testing.
The conventional interface regression testing method adopts manual function testing to perform regression testing work before online requirement, occupies a large amount of testing resources, has a large amount of repeated work, consumes a large amount of testing time and has low testing efficiency.
Therefore, how to improve the testing efficiency of the interface regression testing is an urgent technical problem to be solved in the industry.
Disclosure of Invention
The interface regression testing method, the interface regression testing device, the storage medium and the electronic device are used for solving the technical problem of how to improve the testing efficiency of the interface regression testing.
The application provides an interface regression testing method, which comprises the following steps:
acquiring a test case corresponding to an interface to be tested;
sending a regression test request to the interface to be tested based on the test case, and receiving an interface return value sent by the interface to be tested based on the regression test request;
carrying out correctness check on the interface return value based on a preset assertion value, and determining a check result of the interface to be tested; the preset assertion value is a preset expected value for assertion;
and determining a regression test result of the interface to be tested based on the verification result of the interface to be tested.
According to the interface regression testing method provided by the application, the correctness verification is carried out on the interface return value based on the preset assertion value, and the verification result of the interface to be tested is determined, wherein the method comprises the following steps:
under the condition that the function of the interface to be tested in the test case is data updating or data insertion, carrying out correctness verification on a returned value of the interface based on a first preset assertion value, and determining a verification result of the interface to be tested;
the first preset assertion value is obtained by inquiring in a database based on the entry and exit of the interface to be tested in the test case.
According to the interface regression testing method provided by the application, the correctness verification is carried out on the interface return value based on the preset assertion value, and the verification result of the interface to be tested is determined, wherein the method comprises the following steps:
under the condition that the function of the interface to be tested in the test case is data query, carrying out correctness verification on the interface return value based on a second preset assertion value, and determining a verification result of the interface to be tested;
wherein the second predetermined predicate value is a static value.
According to the interface regression testing method provided by the application, the correctness verification is performed on the interface return value based on the preset assertion value, and the verification result of the interface to be tested is determined, wherein the method comprises the following steps:
determining that the verification result of the interface to be tested is correct under the condition that the preset assertion value is matched with the interface return value;
and under the condition that the preset assertion value is not matched with the interface return value, determining that the check result of the interface to be tested is an error.
According to the interface regression testing method provided by the application, after the regression testing result of the interface to be tested is determined based on the verification result of the interface to be tested, the method comprises the following steps:
and generating a test report of the interface to be tested based on the interface address, the access parameter, the exit parameter, the assertion content and the database query statement of the interface to be tested, and sending the test report of the interface to be tested to a specified mailbox address.
According to the interface regression testing method provided by the application, the obtaining of the test case corresponding to the interface to be tested comprises the following steps:
determining a plurality of test scenes corresponding to the interfaces to be tested;
determining a test case of the interface to be tested in each test scene based on scene configuration information of each test scene;
the scene configuration information comprises an interface address, an entry parameter mode, assertion content and a database query statement.
According to the interface regression testing method provided by the application, after the test cases of the interface to be tested in each test scene are determined, the method comprises the following steps:
receiving the change information of the interface to be tested in any test scene;
under the condition that any test scene is a known test scene, updating the test case of the interface to be tested in any test scene based on the change information;
and under the condition that any test scene is an unknown test scene, constructing a test case of the interface to be tested in any test scene based on the change information.
The application provides an interface regression testing arrangement, includes:
the acquisition unit is used for acquiring a test case corresponding to the interface to be tested;
the testing unit is used for sending a regression testing request to the interface to be tested based on the testing case and receiving an interface return value sent by the interface to be tested based on the regression testing request;
the checking unit is used for checking the correctness of the interface return value based on a preset assertion value and determining a checking result of the interface to be tested; the preset assertion value is a preset expected value for assertion;
and the determining unit is used for determining a regression test result of the interface to be tested based on the verification result of the interface to be tested.
The present application provides a computer-readable storage medium comprising a stored program, wherein the program executes the interface regression test method when running.
The application provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the interface regression testing method through the computer program.
The interface regression testing method, the interface regression testing device, the storage medium and the electronic device obtain a test case corresponding to an interface to be tested; sending a regression test request to the interface to be tested according to the test case, and receiving an interface return value sent by the interface to be tested according to the regression test request; checking the correctness of the interface return value according to a preset assertion value, and determining a checking result of the interface to be tested; the regression testing result of the interface to be tested is determined according to the verification result of the interface to be tested, so that the automation of the regression testing of the interface is realized, the repeated regression testing is not required to be carried out manually, the testing time is reduced, the testing efficiency is improved, the timely online of a software project is ensured, and the use experience of a user is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
In order to more clearly illustrate the technical solutions in the present application or prior art, the drawings required for the embodiments or the prior art descriptions will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a schematic flow chart of an interface regression testing method provided herein;
FIG. 2 is a second schematic flowchart of the interface regression testing method provided in the present application;
FIG. 3 is a schematic structural diagram of an interface regression testing apparatus provided in the present application;
FIG. 4 is a schematic diagram of a hardware environment of the interface regression testing method provided in the present application;
fig. 5 is a schematic structural diagram of an electronic device provided in the present application.
Reference numerals:
401: a terminal device; 402: and (4) a server.
Detailed Description
In order to make the technical solutions of the present application better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only some embodiments of the present application, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in this application are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. Moreover, 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.
Fig. 1 is a schematic flowchart of an interface regression testing method provided in the present application, and as shown in fig. 1, the method includes step 110, step 120, step 130, and step 140.
And 110, obtaining a test case corresponding to the interface to be tested.
Specifically, an execution subject of the interface regression testing method provided in the embodiment of the present application is an interface regression testing apparatus. The device can be software written by a programming language, run in a test server or a computer, or be a hardware module in the test server.
Regression testing refers to re-testing after old code has been modified to confirm that the modification did not introduce new errors or cause errors in other code. The regression test is used as a component of the software life cycle, and occupies a great workload proportion in the whole software test process, and multiple regression tests can be carried out at each stage of software development. The interface regression test is a test for testing interfaces between software components, and is used for testing interaction points between external systems and between subsystems. Compared with other tests, the interface regression test has the advantages of higher profit, easiness in implementation and low maintenance cost.
An Interface (API) is a convention for providing specific service output capabilities to connect different systems. This includes the point of interaction between an external system and a system providing a service or a different system in the background. The system comprises an external interface and an internal interface, wherein the internal interface comprises an upper layer service interface, a lower layer service interface and a peer interface.
The interface to be tested is the interface needing regression testing. The test case is used for describing a test task of the interface to be tested, and the content of the test case comprises a test target, a test environment, input data, a test step, an expected result, a test script and the like, and the test case is used for verifying whether the interface to be tested meets the requirement or not.
And 120, sending a regression test request to the interface to be tested based on the test case, and receiving an interface return value sent by the interface to be tested based on the regression test request.
Specifically, the regression test request is a test request which needs to be sent and is described in the test case, for example, the regression test request may include a request target network address, a request access path, a request mode, a request parameter, and the like.
The interface regression testing device sends a regression testing request to the interface to be tested according to the testing case. After receiving the regression test request, the interface to be tested executes the corresponding interface function according to the regression test request, and generates a regression test response corresponding to the regression test request. The regression test response includes an interface return value.
And step 130, checking the correctness of the interface return value based on the preset assertion value, and determining the checking result of the interface to be tested.
In particular, assertions are judgment logic applied in software programs for the purpose of representing and verifying results expected by software developers. When a program executes to the location of a predicate, the corresponding predicate should be true. If the assertion is not true, the program will abort execution and give an error message.
The interface return value may be the actual value returned by the interface to be tested for assertion. The preset assertion value is a preset expected value for assertion.
And checking the correctness of the interface return value according to the preset assertion value. For example, if the interface return value is the same as the preset assertion value, it indicates that the interface return value sent by the interface to be tested conforms to the expectation, and it may be determined that the verification result of the interface to be tested is correct.
And 140, determining a regression test result of the interface to be tested based on the verification result of the interface to be tested.
Specifically, if the verification result of the interface to be tested is correct, the interface regression testing device may determine that the regression testing result of the interface to be tested passes, that is, the interface to be tested does not have a functional defect; if the verification result of the interface to be tested is wrong, the interface regression testing device can determine that the regression testing result of the interface to be tested does not pass, namely the interface to be tested has a functional defect.
The interface regression testing method provided by the embodiment of the application obtains a test case corresponding to an interface to be tested; sending a regression test request to an interface to be tested according to the test case, and receiving an interface return value sent by the interface to be tested according to the regression test request; carrying out correctness verification on the interface return value according to a preset assertion value, and determining a verification result of the interface to be tested; the regression testing result of the interface to be tested is determined according to the verification result of the interface to be tested, so that the automation of the regression testing of the interface is realized, the repeated regression testing is not required to be carried out manually, the testing time is reduced, the testing efficiency is improved, the timely online of a software project is ensured, and the use experience of a user is improved.
Based on the above embodiment, step 130 includes:
under the condition that the function of the interface to be tested in the test case is data updating or data insertion, carrying out correctness verification on an interface return value based on a first preset assertion value, and determining a verification result of the interface to be tested;
the first preset assertion value is obtained by inquiring in a database based on the input parameter and the output parameter of the interface to be tested in the test case.
Specifically, the interface regression testing apparatus may adopt different assertion modes according to different interface functions. If the function of the interface to be tested in the test case is data updating or data inserting, it indicates that the interface to be tested needs to perform an updating operation or an inserting operation on the data.
If the interface to be tested performs the data updating or data inserting function each time, the data updated or inserted each time is different because the parameters are different. In the case of performing the same function, the data to be updated or inserted corresponding to the same parameter should have uniqueness. Thus, a first preset predicate value that dynamically changes may be employed. The first preset assertion value has a corresponding relation with the input parameter and the output parameter of the interface to be tested in the test case. That is, different entries and exits correspond to different first predetermined predicate values.
The input parameter is an input parameter, and the output parameter is an output parameter. The first preset predicate values corresponding to different entries and exits may be pre-stored in a database. When the regression test is carried out on the interface to be tested, the interface to be tested can send a corresponding interface return value for any parameter input and parameter output when the function is executed every time. At this time, the interface regression testing device may be connected to the database, and obtain the first preset assertion value according to the entry and exit query of the interface to be tested in the test case. The interface regression testing device matches the first preset assertion value with the interface return value, so that whether the verification result of the interface to be tested is correct or not is determined. And under the condition that the first preset assertion value is matched with the interface return value, the verification result of the interface to be tested is correct. Matching here is to be understood as data identity or logical association between data.
For example, for an interface having an update function or an insert function, dynamic value checking may be employed. Maintaining an interface address url as insertOrder, a method as post, an entry mode as body and an assertion content as data: "D1234567" }, reference params is { "ch":1, "playlist" [ { "name": null, "id": null, "proId": 123"," num ":1," exclusitopriceId ":" "," case ID ":" }, "street":123456, "isoOrderRight": 1"," v ":2," origin Source ":" "," source ":" "," isExclusive ": false," ground pId 0}. The interface is requested through request (method, url, params = params, heads = head). Json () and receives a return value, because the interface needs to insert data into the database, the data inserted into the database has uniqueness under the condition that the parameters of the interface are the same each time the interface is executed, so that different values need to be checked each time the interface is asserted, and in order to ensure the accuracy of the interface, the corresponding data needs to be taken from the database each time and checked with the return value of the interface, so that the accuracy of the interface can be ensured.
Based on any of the above embodiments, step 130 includes:
under the condition that the function of the interface to be tested in the test case is data query, carrying out correctness verification on an interface return value based on a second preset assertion value, and determining a verification result of the interface to be tested;
wherein the second predetermined predicate value is a static value.
Specifically, if the function of the interface to be tested in the test case is data query, it indicates that the interface to be tested needs to perform no update operation or insert operation on the data in the data. At this time, the second preset predicate value may be set to a static value. In this case, the interface regression testing apparatus may not be connected to the database.
For example, for an interface with select function, static value checking may be employed. The interface is maintained to be getOrderList, the method is get, the entry parameter data is { "pageIndex": 0"," pageSize ": 5", "orderStatus": 0", the entry parameter way-QueryString, the assertion content is {" success ": true" }, the interface is requested through request (method, url, data = params, heads = head). Json (), and the return value is received, because the interface function is data which is needed by simple query, data processing is not involved, and updating or inserting into a database can be satisfied by using the static assertion value.
Based on any of the above embodiments, step 130 includes:
under the condition that the preset assertion value is matched with the interface return value, determining that the verification result of the interface to be tested is correct;
and under the condition that the preset assertion value is not matched with the interface return value, determining that the verification result of the interface to be tested is an error.
Specifically, if the preset assertion value is matched with the interface return value, the interface regression testing device can determine that the verification result of the interface to be tested is correct; if the preset assertion value does not match the interface return value, the interface regression testing device may determine that the verification result of the interface to be tested is an error.
Based on any of the above embodiments, step 140 then includes:
and generating a test report of the interface to be tested based on the interface address, the entry, the exit and the assertion content of the interface to be tested and the database query statement, and sending the test report of the interface to be tested to the specified mailbox address.
Specifically, the interface regression testing method provided in the embodiment of the present application may be executed at a specified time, or may be executed at any time according to daily requirements. For example, the interface regression testing device may perform regression testing on all interfaces on a fixed day of each month according to the setting, or may monitor the entry and exit of each interface in the software project and the number of interfaces, and automatically trigger execution of the interface regression testing method when it is monitored that the entry or exit of any interface changes or the number of interfaces increases.
After the interface regression testing device conducts regression testing on the interface, the interface regression testing device can record interface addresses, input parameters, output parameters, assertion contents and database query statements of the interface to be tested, and a test report of the interface to be tested is generated. The assertion content includes data that needs to be asserted, and the like.
After the test report is generated, the interface regression test device can also send the test report to a designated mailbox address for operation and maintenance personnel to review.
For the test report, the operation and maintenance personnel can set the sending time and the sending mode in the interface regression testing device. For example, for an interface automated regression test executed at a fixed time, a test report may be sent after the test is completed; for regression testing performed on a daily basis, no test report may be sent.
Based on any of the above embodiments, step 110 includes:
determining a plurality of test scenes corresponding to the interfaces to be tested;
determining a test case of the interface to be tested in each test scene based on the scene configuration information of each test scene;
the scene configuration information comprises an interface address, an entry parameter mode, assertion content and a database query statement.
Specifically, the interface regression testing apparatus may design a plurality of different test scenarios for the interface to be tested. Through different test scenes, corresponding test cases are constructed to test the interface to be tested, and the automatic test of the same interface in different test scenes can be realized.
When the test case is determined, the setting can be performed according to the scene configuration information of the interface to be tested in the test scene, wherein the scene configuration information mainly comprises an interface address, a parameter entering mode, an assertion content and a database query statement.
The method comprises the steps of constructing a test case according to a test scene, mainly testing the service flow and service logic of an interface to be tested, and mainly testing whether the interface to be tested can realize related functions when a user operates correctly or not and can have exception handling capacity when the user operates incorrectly.
Based on any embodiment, after determining the test cases of the interfaces to be tested in each test scenario, the method includes:
receiving change information of an interface to be tested in any test scene;
under the condition that any test scene is a known test scene, updating a test case of the interface to be tested in any test scene based on the change information;
and under the condition that any test scene is an unknown test scene, constructing a test case of the interface to be tested in any test scene based on the change information.
Specifically, the interface regression testing device may be connected to the interface management platform, and is configured to receive change information of the interface to be tested in any testing scenario. The change information includes interface address change, entry mode change, assertion content change, and the like.
If the test scene is a known test scene, the test case in the test scene exists, and at the moment, the interface regression test device can update the test case in the test scene according to the change information.
If the test scene is an unknown test scene, the test case under the test scene does not exist, and at the moment, the interface regression test device can establish the test case of the interface to be tested under the test scene according to the change information, store the test case and divide the test scene into the known test scene.
Based on any of the above embodiments, fig. 2 is a second flowchart of the interface regression testing method provided in the present application, and as shown in fig. 2, the method may be implemented by using a script language, and includes:
step 210, unifying code variable formats and error handling modes for related software projects where interfaces to be tested are located, and facilitating public interface and function building;
step 220, maintaining data of an interface in different scenes, including interface addresses, methods, access parameters, access parameter modes, assertion contents, and Structured Query Language (SQL) statements required by dynamic value verification, and realizing interface automation of the same interface in different scenes; and linking the interface management platform, if the change of the interface input and output parameters is identified in the automatic case in time in daily requirements, prompting the person to whom the case belongs, and updating and adding a new test case in time; if the interface is newly added, informing the module owner in time according to the module to which the newly added interface belongs, and newly adding a corresponding test case;
step 230, according to the interface function, different assertion modes and interfaces with a select function are realized, and because the database is not changed, only a specific value is simply read from the database, and the assertion can be realized through a static value; the update function interface and the insert function interface need to update data in the database, the assertion value of the interface is different each time, a dynamic value needs to be asserted, the database is linked, the corresponding data in the database is inquired according to the input and output of the interface, and then the correctness of the interface is asserted;
step 240, a fixed execution time can be designated, and the execution can be performed at any time according to daily requirements;
step 250, after each execution is completed, recording an interface address, an input parameter, an output parameter, data needing to be predicated and related SQL statements to form a test report, inquiring logs according to the traceid in the output parameter, positioning problems and solving the problems;
step 260, after the test report is generated, sending the test report of the mail version according to the requirement, wherein the automatic test executed in fixed time needs to send the test report; the test cases which are executed at any time according to daily requirements do not need to send test reports.
The conventional manual regression testing method has the defects of various repetitive work and extremely low efficiency; test scene omission easily occurs during manual function test data verification; the interface regression testing method provided by the embodiment of the application can greatly reduce the repeated and mechanical testing work by combining an automatic testing method, effectively improve the testing efficiency and shorten the testing period; meanwhile, the automatic script has reusability, so that the regression test verification work of the system is quicker and more efficient.
Based on any of the above embodiments, fig. 3 is a schematic structural diagram of an interface regression testing apparatus provided in the present application, and as shown in fig. 3, the apparatus includes:
an obtaining unit 310, configured to obtain a test case corresponding to an interface to be tested;
the testing unit 320 is configured to send a regression testing request to the interface to be tested based on the test case, and receive an interface return value sent by the interface to be tested based on the regression testing request;
the checking unit 330 is configured to check correctness of the interface return value based on the preset assertion value, and determine a checking result of the interface to be tested; presetting an assertion value as a preset expected value for assertion;
the determining unit 340 is configured to determine a regression test result of the interface to be tested based on the verification result of the interface to be tested.
The interface regression testing device provided by the embodiment of the application acquires a test case corresponding to an interface to be tested; sending a regression test request to the interface to be tested according to the test case, and receiving an interface return value sent by the interface to be tested according to the regression test request; checking the correctness of the interface return value according to a preset assertion value, and determining a checking result of the interface to be tested; the regression testing result of the interface to be tested is determined according to the verification result of the interface to be tested, so that the automation of the regression testing of the interface is realized, the repeated regression testing is not required to be carried out manually, the testing time is reduced, the testing efficiency is improved, the timely online of a software project is ensured, and the use experience of a user is improved.
Based on any of the above embodiments, the verification unit is specifically configured to:
under the condition that the function of the interface to be tested in the test case is data updating or data insertion, carrying out correctness verification on an interface return value based on a first preset assertion value, and determining a verification result of the interface to be tested;
the first preset assertion value is obtained by inquiring in a database based on the entry and exit of the interface to be tested in the test case.
Based on any of the above embodiments, the verification unit is specifically configured to:
under the condition that the function of the interface to be tested in the test case is data query, carrying out correctness verification on an interface return value based on a second preset assertion value, and determining a verification result of the interface to be tested;
and the second preset assertion value is a static value.
Based on any of the above embodiments, the verification unit is specifically configured to:
under the condition that the preset assertion value is matched with the interface return value, determining that the verification result of the interface to be tested is correct;
and under the condition that the preset assertion value is not matched with the interface return value, determining that the verification result of the interface to be tested is an error.
Based on any embodiment above, the apparatus further comprises:
and the report unit is used for generating a test report of the interface to be tested based on the interface address, the input parameter, the output parameter and the assertion content of the interface to be tested and the database query statement, and sending the test report of the interface to be tested to the specified mailbox address.
Based on any of the embodiments, the obtaining unit is specifically configured to:
determining a plurality of test scenes corresponding to the interfaces to be tested;
determining a test case of the interface to be tested in each test scene based on the scene configuration information of each test scene;
the scene configuration information comprises interface addresses, access parameters, access modes, assertion contents and database query statements.
Based on any of the above embodiments, the obtaining unit is further specifically configured to:
receiving change information of an interface to be tested in any test scene;
under the condition that any test scene is a known test scene, updating a test case of the interface to be tested in any test scene based on the change information;
and under the condition that any test scene is an unknown test scene, constructing a test case of the interface to be tested in any test scene based on the change information.
Based on any of the above embodiments, the present application further provides an interface regression testing method. The interface regression testing method is widely applied to full-House intelligent digital control application scenes such as intelligent homes (Smart Home), intelligent homes, intelligent Home equipment ecology, intelligent House (Intelligent House) ecology and the like. In this embodiment, fig. 4 is a schematic diagram of a hardware environment of an interface regression testing method provided in this application, and the interface regression testing method can be applied to the hardware environment formed by the terminal device 401 and the server 402 shown in fig. 4. The server 402 is connected to the terminal device 401 through a network, and may be configured to provide services (such as application services) for the terminal or a client installed on the terminal, provide a database on the server or independent of the server, provide a data storage service for the server 402, and configure a cloud computing and/or edge computing service on the server or independent of the server, and provide a data operation service for the server 402.
The network may include, but is not limited to, at least one of: wired network, wireless network. The wired network may include, but is not limited to, at least one of: wide area networks, metropolitan area networks, local area networks, which may include, but are not limited to, at least one of the following: WIFI (Wireless Fidelity ), bluetooth. Terminal equipment 401 can be but not limited to be PC, the cell-phone, the panel computer, intelligent air conditioner, intelligent cigarette machine, intelligent refrigerator, intelligent oven, intelligent kitchen range, intelligent washing machine, intelligent water heater, intelligent washing equipment, intelligent dish washer, intelligent projection equipment, intelligent TV, intelligent clothes hanger, intelligent (window) curtain, intelligence audio-visual, smart jack, intelligent stereo set, intelligent audio amplifier, intelligent new trend equipment, intelligent kitchen guarding equipment, intelligent bathroom equipment, intelligence robot of sweeping the floor, intelligence robot of wiping the window, intelligence robot of mopping the ground, intelligent air purification equipment, intelligent steam ager, intelligent microwave oven, intelligent kitchen treasure, intelligent clarifier, intelligent water dispenser, intelligent lock etc..
Based on any one of the above embodiments, fig. 5 is a schematic structural diagram of an electronic device provided by the present application, and as shown in fig. 5, the electronic device may include: a Processor (Processor) 510, a communication Interface (Communications Interface) 520, a Memory (Memory) 530, and a communication Bus (Communications Bus) 540, wherein the Processor 510, the communication Interface 520, and the Memory 530 communicate with each other via the communication Bus 540. Processor 510 may call logical commands in memory 530 to perform the following method:
acquiring a test case corresponding to an interface to be tested; sending a regression test request to the interface to be tested based on the test case, and receiving an interface return value sent by the interface to be tested based on the regression test request; checking the correctness of the interface return value based on a preset assertion value, and determining a checking result of the interface to be tested; presetting an assertion value as a preset expected value for assertion; and determining a regression test result of the interface to be tested based on the verification result of the interface to be tested.
In addition, the logic commands in the memory 530 may be implemented in the form of software functional units and stored in a computer readable storage medium when the logic commands are sold or used as independent products. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including commands for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk, and various media capable of storing program codes.
The processor in the electronic device provided in the embodiment of the present application may call a logic instruction in the memory to implement the method, and a specific implementation manner of the method is consistent with the implementation manner of the method, and the same beneficial effects may be achieved, which is not described herein again.
The embodiments of the present application also provide a computer-readable storage medium, on which a computer program is stored, where the computer program is implemented by a processor to execute the methods provided by the above embodiments.
The specific implementation manner is the same as the implementation manner of the method, and the same beneficial effects can be achieved, which is not described herein again.
Embodiments of the present application provide a computer program product, which includes a computer program, and when the computer program is executed by a processor, the method is implemented as described above.
The above-described embodiments of the apparatus are merely illustrative, and 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 position, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: 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; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (10)

1. An interface regression testing method, comprising:
acquiring a test case corresponding to an interface to be tested;
sending a regression test request to the interface to be tested based on the test case, and receiving an interface return value sent by the interface to be tested based on the regression test request;
carrying out correctness check on the interface return value based on a preset assertion value, and determining a check result of the interface to be tested; the preset assertion value is a preset expected value for assertion;
and determining a regression test result of the interface to be tested based on the verification result of the interface to be tested.
2. The interface regression test method of claim 1, wherein the checking the correctness of the interface return value based on the preset predicate value and determining the check result of the interface to be tested comprises:
under the condition that the function of the interface to be tested in the test case is data updating or data insertion, carrying out correctness verification on a returned value of the interface based on a first preset assertion value, and determining a verification result of the interface to be tested;
the first preset assertion value is obtained by inquiring in a database based on the entry and exit of the interface to be tested in the test case.
3. The interface regression test method of claim 1, wherein the checking the correctness of the interface return value based on the preset predicate value and determining the check result of the interface to be tested comprises:
under the condition that the function of the interface to be tested in the test case is data query, carrying out correctness verification on the interface return value based on a second preset assertion value, and determining a verification result of the interface to be tested;
wherein the second predetermined predicate value is a static value.
4. The interface regression testing method according to claim 1, wherein said checking the correctness of the interface return value based on the preset predicate value and determining the checking result of the interface to be tested comprises:
under the condition that the preset assertion value is matched with the interface return value, determining that the verification result of the interface to be tested is correct;
and under the condition that the preset assertion value is not matched with the interface return value, determining that the verification result of the interface to be tested is an error.
5. The interface regression test method according to any one of claims 1 to 4, wherein after determining the regression test result of the interface to be tested based on the verification result of the interface to be tested, the method comprises:
and generating a test report of the interface to be tested based on the interface address, the access parameter, the exit parameter, the assertion content and the database query statement of the interface to be tested, and sending the test report of the interface to be tested to a specified mailbox address.
6. The interface regression testing method according to any one of claims 1 to 4, wherein the obtaining of the test case corresponding to the interface to be tested includes:
determining a plurality of test scenes corresponding to the interfaces to be tested;
determining a test case of the interface to be tested in each test scene based on the scene configuration information of each test scene;
the scene configuration information comprises interface addresses, access parameters, access modes, assertion contents and database query statements.
7. The interface regression test method of claim 6, wherein after determining the test cases of the interface to be tested in each test scenario, the method comprises:
receiving the change information of the interface to be tested in any test scene;
under the condition that any test scene is a known test scene, updating the test case of the interface to be tested in any test scene based on the change information;
and under the condition that any test scene is an unknown test scene, constructing a test case of the interface to be tested in any test scene based on the change information.
8. An interface regression test apparatus, comprising:
the acquisition unit is used for acquiring a test case corresponding to the interface to be tested;
the testing unit is used for sending a regression testing request to the interface to be tested based on the testing case and receiving an interface return value sent by the interface to be tested based on the regression testing request;
the checking unit is used for checking the correctness of the interface return value based on a preset assertion value and determining a checking result of the interface to be tested; the preset assertion value is a preset expected value for assertion;
and the determining unit is used for determining a regression test result of the interface to be tested based on the verification result of the interface to be tested.
9. A computer-readable storage medium comprising a stored program, wherein the program when executed performs the interface regression test method of any one of claims 1 to 7.
10. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, and the processor is configured to execute the interface regression test method of any one of claims 1 to 7 by the computer program.
CN202211116990.6A 2022-09-14 2022-09-14 Interface regression testing method and device, storage medium and electronic device Pending CN115454851A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211116990.6A CN115454851A (en) 2022-09-14 2022-09-14 Interface regression testing method and device, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211116990.6A CN115454851A (en) 2022-09-14 2022-09-14 Interface regression testing method and device, storage medium and electronic device

Publications (1)

Publication Number Publication Date
CN115454851A true CN115454851A (en) 2022-12-09

Family

ID=84302702

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211116990.6A Pending CN115454851A (en) 2022-09-14 2022-09-14 Interface regression testing method and device, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN115454851A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116662210A (en) * 2023-07-28 2023-08-29 杭州罗莱迪思科技股份有限公司 Interface regression testing method, device and application

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116662210A (en) * 2023-07-28 2023-08-29 杭州罗莱迪思科技股份有限公司 Interface regression testing method, device and application
CN116662210B (en) * 2023-07-28 2023-09-29 杭州罗莱迪思科技股份有限公司 Interface regression testing method, device and application

Similar Documents

Publication Publication Date Title
CN111371638B (en) Intelligent equipment testing method and device, server and storage medium
CN109361562B (en) Automatic testing method based on associated network equipment access
US9419884B1 (en) Intelligent automated testing method for restful web services
CN107302476B (en) Automatic testing method and system for testing asynchronous interactive system
CN110598280A (en) Equipment simulation system and method and computer readable storage medium
CN110933095A (en) Message parsing method and device
CN110058998B (en) Software testing method and device
CN109995614B (en) Alpha testing method and device
WO2021227690A1 (en) Automatic testing system and method for robot, and build server and storage medium
CN112835802A (en) Equipment testing method, device, equipment and storage medium
CN104899134A (en) Automatic domain name registration server testing system and method
CN110063042A (en) A kind of response method and its terminal of database failure
CN111966738A (en) System for automatically realizing back-end programming by selecting front-end configuration
CN115454851A (en) Interface regression testing method and device, storage medium and electronic device
CN113672441A (en) Method and device for testing intelligent equipment
CN111078424A (en) Information interaction method and device, computer equipment and storage medium
CN114116801A (en) Data list checking method and device
CN111651342A (en) HTTP interface automation testing framework based on Charles recording session
CN117493188A (en) Interface testing method and device, electronic equipment and storage medium
CN113238901B (en) Multi-device automatic testing method and device, storage medium and computer device
CN115878448A (en) Database test method, distributed database and storage medium
CN110618943B (en) Security service test method and device, electronic equipment and readable storage medium
CN114143236A (en) Business system testing method and device, electronic equipment and readable storage medium
CN111159988A (en) Model processing method and device, computer equipment and storage medium
CN113094281B (en) Test method and device for hybrid App

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