CN116881119A - Login-free method, device, equipment and storage medium for interface test - Google Patents

Login-free method, device, equipment and storage medium for interface test Download PDF

Info

Publication number
CN116881119A
CN116881119A CN202310665442.7A CN202310665442A CN116881119A CN 116881119 A CN116881119 A CN 116881119A CN 202310665442 A CN202310665442 A CN 202310665442A CN 116881119 A CN116881119 A CN 116881119A
Authority
CN
China
Prior art keywords
target
login
interface
login information
target application
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
CN202310665442.7A
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.)
China United Network Communications Group Co Ltd
Original Assignee
China United Network Communications Group 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 China United Network Communications Group Co Ltd filed Critical China United Network Communications Group Co Ltd
Priority to CN202310665442.7A priority Critical patent/CN116881119A/en
Publication of CN116881119A publication Critical patent/CN116881119A/en
Pending legal-status Critical Current

Links

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
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/31User authentication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/45Structures or tools for the administration of authentication
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Quality & Reliability (AREA)
  • Software Systems (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application discloses a login-free method, a login-free device, login-free equipment and a storage medium for interface test, relates to the technical field of computers, and is used for improving efficiency of testing interfaces and reducing workload. Comprising the following steps: based on basic information corresponding to a target application input by a user on a preset interface, monitoring the target application, wherein the basic information comprises at least one of the following: application name, interface packet path, login function name; based on at least one operation of logging in a target application triggered by a user at a terminal device, at least one piece of login information corresponding to at least one login is recorded to obtain a target list, and the login information comprises at least one of the following items: account information, session number; and testing the interface of the target application based on any one piece of login information in at least one piece of login information, wherein the interface of the target application can be successfully invoked without carrying a login state when the interface of the target application is invoked, and the login state is information for identifying the identity of a user. The method and the device are applied to the scene of testing the interface.

Description

Login-free method, device, equipment and storage medium for interface test
Technical Field
The present application relates to the field of computer technologies, and in particular, to a login-free method, device, equipment, and storage medium for interface test.
Background
When an interface request is made, the interface is successfully accepted and executed only by an application, which usually needs to carry login state information (i.e. a small text file (cookie, a technology for reading data from a hard disk of a client)), otherwise, the application returns an unregistered response after receiving the request. In order for an interface request to succeed, a login interface needs to be requested before a target interface request is made, and then after the login interface request returns a cookie successfully, the cookie is transferred to the target interface so that the target interface carries a correct cookie.
In the above method, since many test cases are to be executed when the interface automation test is performed, many interface requests are to be executed. In order to enable the test cases to be executed successfully (the target interfaces are executed successfully), each test case also needs to request a login interface first to realize login logic. Therefore, in each use case, the login interface is required to obtain the cookie, and then the cookie is transferred to the target interface and then the target interface is required to be requested, so that the request can be successfully executed. Therefore, repeated workload is great, workload of test case development is increased, redundant codes and redundant workload are great (each case needs to be logged in for one time), error reporting can occur on a login interface, and the risk of test case execution failure is increased. Therefore, the current testing of interfaces is relatively high in workload and relatively low in efficiency.
Disclosure of Invention
The application provides a login-free method, a login-free device, login-free equipment and a storage medium for interface test, which are used for improving the efficiency of testing interfaces and reducing the workload.
In order to achieve the above purpose, the application adopts the following technical scheme:
in a first aspect, there is provided a login-free method for interface testing, the method comprising: based on basic information corresponding to a target application input by a user on a preset interface, monitoring the target application, wherein the basic information comprises at least one of the following: application name, interface packet path, login function name; based on at least one operation of logging in a target application triggered by a user at a terminal device, recording at least one piece of logging information corresponding to at least one time of logging in to obtain a target list, wherein the logging information corresponds to one piece of logging information, and the logging information comprises at least one of the following items: account information, session number; and testing the interface of the target application based on any one piece of login information in at least one piece of login information, wherein the interface of the target application can be successfully invoked without carrying a login state when the interface of the target application is invoked, and the login state is information for identifying the identity of a user.
In one possible implementation manner, monitoring the target application based on basic information corresponding to the target application input by a user at a preset interface includes: based on basic information corresponding to a target application input by a user on a preset interface, mounting a target command on a process of the target application, wherein the target command comprises at least one of the following information: the method comprises the steps of processing numbers of target applications and identifiers of target modules in the target applications, wherein the target modules comprise preset monitoring logic processing packages, and the preset monitoring logic processing packages are used for monitoring interfaces of the target applications; and returning a response message to the terminal equipment, and sending a target list comprising at least one piece of login information to the terminal equipment so as to display the at least one piece of login information in an interface of the terminal equipment.
In one possible implementation, the method further includes: processing a plurality of functions corresponding to interfaces of the packet monitoring target application based on preset monitoring logic; before any function in the functions is monitored to be called by the terminal equipment and executed, judging whether any function is a login function of the target application; when any function is determined to be a login function of the target application, executing any function, and acquiring target login information corresponding to a target request object for calling any function before any function is executed and response content is returned to the terminal equipment; and storing the target login information corresponding to the target request object in a target list.
In one possible implementation, the method further includes: when any function is determined not to be the login function of the target application, judging whether the selected login information exists in the target list; when it is determined that the selected login information exists in the target list, a target cookie object is created, and the target cookie object is added to the target request object, wherein the target cookie object comprises a session number included in the selected login information.
In one possible implementation, determining whether the selected login information exists in the target list includes: acquiring a state field value corresponding to each piece of login information in at least one piece of login information included in the target list, wherein the state field value is any one of the following: a first status field value for indicating that the corresponding login information is selected, and a second status field value for indicating that the corresponding login information is not selected; when the state field value corresponding to any one of the at least one piece of login information is determined to be the first state field value, determining that the selected login information exists in the target list.
In a second aspect, there is provided an interface test log-in-free device, the interface test log-in-free device comprising: the device comprises a processing unit, a recording unit and a testing unit; the processing unit is used for monitoring the target application based on basic information corresponding to the target application input by a user on a preset interface, wherein the basic information comprises at least one of the following items: application name, interface packet path, login function name; the recording unit is used for recording at least one piece of login information corresponding to at least one login to obtain a target list based on at least one operation of logging in the target application triggered by the user at the terminal equipment, wherein the one piece of login information corresponds to one piece of login information, and the login information comprises at least one of the following items: account information, session number; the test unit is used for testing the interface of the target application based on any one piece of login information in at least one piece of login information, and can be successfully invoked without carrying a login state when the interface of the target application is invoked, wherein the login state is information for identifying the identity of a user.
In one possible implementation, the interface test login-free device further includes: a transmission unit: the processing unit is specifically configured to mount a target command on a process of the target application based on basic information corresponding to the target application input by a user on a preset interface, where the target command includes at least one of the following information: the method comprises the steps of processing numbers of target applications and identifiers of target modules in the target applications, wherein the target modules comprise preset monitoring logic processing packages, and the preset monitoring logic processing packages are used for monitoring interfaces of the target applications; and the transmission unit is used for returning a response message to the terminal equipment and sending a target list comprising at least one piece of login information to the terminal equipment so as to display the at least one piece of login information in an interface of the terminal equipment.
In one possible implementation manner, the processing unit is further configured to process a plurality of functions corresponding to the interfaces of the packet monitoring target application based on a preset monitoring logic; the processing unit is further used for judging whether any function is a login function of the target application before any function in the plurality of functions is monitored to be called by the terminal equipment and executed; the processing unit is also used for executing any function when determining that any function is a login function of the target application, and acquiring target login information corresponding to a target request object for calling any function before the execution of any function is finished and response content is returned to the terminal equipment; and the processing unit is also used for storing the target login information corresponding to the target request object in a target list.
In a possible implementation manner, the processing unit is further configured to, when determining that any function is not a login function of the target application, determine whether the selected login information exists in the target list; and the processing unit is also used for creating a target cookie object when the selected login information exists in the target list, and adding the target cookie object into the target request object, wherein the target cookie object comprises a session number included in the selected login information.
In a possible implementation manner, the processing unit is further configured to obtain a status field value corresponding to each piece of login information in at least one piece of login information included in the target list, where the status field value is any one of the following: a first status field value for indicating that the corresponding login information is selected, and a second status field value for indicating that the corresponding login information is not selected; and the processing unit is also used for determining that the selected login information exists in the target list when the state field value corresponding to any one piece of login information in the at least one piece of login information is determined to be the first state field value.
In a third aspect, an electronic device, comprising: a processor and a memory; wherein the memory is configured to store one or more programs, the one or more programs comprising computer-executable instructions that, when executed by the electronic device, cause the electronic device to perform an interface test log-free method as in the first aspect.
In a fourth aspect, there is provided a computer readable storage medium storing one or more programs, the one or more programs comprising instructions, which when executed by a computer, cause the computer to perform an interface test log-free method as in the first aspect.
The application provides a login-free method, a login-free device, login-free equipment and a storage medium for interface test, which are applied to a scene of testing an interface. When the interface of the target application needs to be tested, a user can input basic information which corresponds to the target application and comprises at least one of an application name, an interface packet path and a login function name in a preset interface of the terminal equipment so as to trigger the monitoring of the target application. And then, based on at least one operation of logging in the target application triggered by the user at the terminal equipment, recording at least one piece of login information corresponding to the at least one login to obtain a target list. Therefore, the interface of the target application can be tested based on any one piece of login information in the at least one piece of login information, so that when the interface of the target application is called, the call can be successfully carried out without carrying a login state. By the method, the login information corresponding to the login target application triggered by the user at the terminal equipment can be obtained in the process of monitoring the target application, so that the interface of the target application can be tested based on the obtained login information; the call can be successfully performed when the interface of the target application is called without carrying a login state. Therefore, the efficiency of testing the interface can be improved, and the workload is reduced.
Drawings
FIG. 1 is a schematic diagram of an interface test login-free system according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating a login-free method for interface testing according to an embodiment of the present application;
FIG. 3 is a schematic illustration of an interface according to an embodiment of the present application;
FIG. 4 is a flowchart illustrating a login-free method for interface testing according to an embodiment of the present application;
FIG. 5 is a second interface diagram according to an embodiment of the present application;
FIG. 6 is a flowchart of a login-free method for interface testing according to an embodiment of the present application;
FIG. 7 is a flowchart of a login-free method for interface testing according to an embodiment of the present application;
FIG. 8 is a flowchart of a login-free method for interface testing according to an embodiment of the present application;
FIG. 9 is a schematic diagram of an interface test login-free device according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings in the embodiments of the present application.
In the description of the present application, "/" means "or" unless otherwise indicated, for example, A/B may mean A or B. "and/or" herein is merely an association relationship describing an association object, and means that three relationships may exist, for example, a and/or B may mean: a exists alone, A and B exist together, and B exists alone. Further, "at least one", "a plurality" means two or more. The terms "first," "second," and the like do not limit the number and order of execution, and the terms "first," "second," and the like do not necessarily differ.
The login-free method for the interface test provided by the embodiment of the application can be applied to a login-free system for the interface test. Fig. 1 shows a schematic structural diagram of the interface test login-free system. As shown in fig. 1, the interface test login-free system 20 includes: terminal equipment 21, interface test login-free server 22, target application server 23.
The terminal device 21 is respectively connected with the interface test login-free server 22 and the target application server 23 to realize a data communication function, the terminal device 21 includes a target application, and a function page corresponding to the interface test login-free server can be displayed in a webpage form.
The interface test login-free server 22 is used for implementing an interface test login-free method, and monitors a target application based on basic information corresponding to the target application input by a user in a preset interface in the terminal device 21.
The interface test login-free server 22 is further configured to record at least one piece of login information corresponding to at least one login to obtain a target list based on at least one operation of logging in the target application triggered by the user at the terminal device; and testing the interface of the target application based on any one piece of login information in at least one piece of login information, and calling successfully without carrying a login state when calling the interface of the target application.
The target application server 23 is a server of a target application, and is configured to interact with the terminal device 21 to implement a function related to the target application.
The following describes a login-free method for interface test according to an embodiment of the present application with reference to the accompanying drawings. As shown in fig. 2, the method for testing the login-free interface provided by the embodiment of the application can be applied to a server for testing the login-free interface, and includes S201-S203:
s201, monitoring the target application based on basic information corresponding to the target application input by a user on a preset interface.
Wherein the base information includes at least one of: application name, interface package path, login function name.
In one implementation manner, a tester (user) may input information such as an application name, an interface packet path, a login function name, and the like corresponding to the target application in a preset interface associated with the interface test login-free server, which is displayed by the terminal device.
Optionally, the preset interface may be an interface in the form of a web page, and the terminal device is an electronic device capable of displaying the web page, for example, a mobile phone, a computer, and other devices.
For example, as shown in fig. 3, the user may input information such as an application name (kcard-ecs), an interface packet path (com.java.kcard.controller), a login function name (user.login ()) and the like corresponding to the target application in the interface shown in fig. 3. And then clicking an injection monitoring button to trigger the interface test login-free server to monitor the target application.
S202, based on at least one operation of logging in a target application triggered by a user in terminal equipment, at least one piece of login information corresponding to at least one login is recorded to obtain a target list.
Wherein, one login corresponds to one piece of login information, and the login information comprises at least one of the following: account information, session number.
Optionally, after the target application is injected into the monitor, the tester can complete a user login by executing normal service operation on the target application on the terminal device, so that the interface test login-free server records login information corresponding to the login.
Optionally, the tester may perform multiple login operations on the target application on the terminal device, so that the interface test login-free server records login information corresponding to each login, and obtains a target list including at least one piece of login information.
It should be noted that, the test personnel needs to complete a user login through normal service operation, so as to generate login information and store the login information in the login information list (i.e. the target list) cache of the target application for subsequent selection and use.
It should be noted that, because the logging function is invoked every time the tester triggers the terminal device to execute the logging operation, every logging information is added into the logging information list corresponding to the target application. Therefore, the testers can store login information under different user information according to the needs so as to meet different test scene requirements.
S203, testing the interface of the target application based on any one of the at least one piece of login information.
When the interface of the target application is called, the interface can be successfully called without carrying a login state, and the login state is information for identifying the identity of the user.
Optionally, the tester may select any one of the at least one piece of login information included in the target list to trigger the interface test login-free server to start the interface test or execute the interface test case.
It should be noted that, at this time, the call of any interface of the target application can be successfully executed without carrying the login state, and the user information logged in the target application is the user information in the selected login information.
Optionally, the at least one piece of login information included in the target list may be selected only for one piece of login information (limited by the page, at most only one line may be selected).
According to the embodiment of the application, when the interface test is executed or the interface automation case is executed, the login logic does not need to be repeatedly realized (namely, the login interface of the target application does not need to be called first), the workload of the interface test and the development of the automation test case is reduced, and the error risk is reduced.
In one design, as shown in fig. 4, the method in step S201 may specifically include S301 to S302:
s301, based on basic information corresponding to a target application input by a user on a preset interface, a target command is mounted on a process of the target application.
Wherein the target command includes at least one of the following information: the method comprises the steps of processing numbers of target applications and identification of target modules in the target applications, wherein the target modules comprise preset monitoring logic processing packages, and the preset monitoring logic processing packages are used for monitoring interfaces of the target applications.
Optionally, after the tester triggers the interface test login-free server to monitor the target application through the preset interface injection monitoring button, the interface test login-free server may execute the remote command and mount the target command onto the process of the target application.
Specifically, the target command may be jvm-sadbox, the command being: pandbox-p 4995-dmonitor/begin, where 4995 is the process number of the target application (obtainable by ps aux|grep target application name), monitor/begin is the module name where the preset monitoring logic processing package is located. After a predetermined supervisory logic processing package (xxx. Jar) is placed under the module directory of jvm-sadbox, jvm-sadbox parses the package and validates the package's program logic.
S302, a response message is returned to the terminal equipment, and a target list comprising at least one piece of login information is sent to the terminal equipment so as to display the at least one piece of login information in an interface of the terminal equipment.
Optionally, after the target command is mounted on the process of the target application, the interface test login-free server returns a request response message to the terminal device, and at this time, a target list including at least one piece of login information may be displayed in a display screen of the terminal device.
For example, as shown in fig. 5, a target list including at least one piece of login information, each piece of login information including login information, session number (Session Id), selection control, and deletion control, may be displayed in a display screen of the terminal device.
Optionally, a query request can be initiated to the interface test login-free server based on the target list displayed in the page, so as to query the login information list cache data of the current target application, and render and display each piece of login information in the page.
Optionally, the tester may input a delete button displayed in the page to trigger the interface test login-free server to delete useless login information. The tester clicks the delete button to trigger a request to the interface test login-free server, which deletes the specified login information from the login information list cache of the target application.
According to the embodiment of the application, the interface test login-free server can mount the target command comprising the process number of the target application and the identification of the target module in the target application on the process of the target application based on the basic information corresponding to the target application input by the user on the preset interface of the terminal equipment, so that the interface test login-free server returns a response message to the terminal equipment and sends a target list comprising at least one piece of login information to the terminal equipment, and at least one piece of login information is displayed in the interface of the terminal equipment for the user to check.
In one design, as shown in fig. 6, the method for testing an interface without logging in according to the embodiment of the present application may further include steps S401 to S404:
s401, processing a plurality of functions corresponding to interfaces of the packet monitoring target application based on preset monitoring logic.
S402, before any function in the functions is monitored to be called by the terminal equipment and executed, judging whether any function is a login function of the target application.
Optionally, the interface test login-free server may process all functions under the interface packet path of the target application based on a preset monitoring logic, so as to determine, when a certain function is called, whether the function is a login function of the target application before the function is executed.
And S403, executing any function when determining that any function is a login function of the target application, and acquiring target login information corresponding to a target request object for calling any function before the execution of any function is finished and response content is returned to the terminal equipment.
Optionally, when any function is determined to be the login function of the target application, normal execution of the function may be continued, but before the login function is executed, response content is returned to the terminal device, target login information corresponding to the target request object for calling any function is acquired.
S404, storing target login information corresponding to the target request object in a target list.
Optionally, the interface test login-free server may acquire a session (session) member object of the target request object (HttpServletRequest req) of any function currently called, acquire a value of session Id and information content of a registrar from the session object, store the value and the information content of the registrar in a login information list (target list) cache corresponding to the target application, and after the storage is successful, continue to return the response content of the login function to the terminal device.
In the embodiment of the application, the interface test login-free server can process a plurality of functions corresponding to the interface of the target application based on the preset monitoring logic to judge whether any function is a login function of the target application before any function in the plurality of functions is monitored to be called by the terminal equipment and any function is executed; when any function is determined to be a login function of the target application, executing any function, and acquiring target login information corresponding to a target request object for calling any function before any function is executed and response content is returned to the terminal equipment; and the target login information corresponding to the target request object is stored in the target list, so that the accuracy of acquiring the login information can be improved.
In one design, as shown in fig. 7, in the method for testing an interface without logging in provided by the embodiment of the present application, the method may further include steps S501 to S502:
s501, when any function is determined not to be the login function of the target application, judging whether the selected login information exists in the target list.
Optionally, when it is determined that any function is not a login function of the target application, it is indicated that the currently called function is a non-login function (i.e., a business function), and it is required to determine whether login information in a login information list (i.e., a target list) corresponding to the target application is selected.
S502, when the selected login information exists in the target list, creating a target cookie object, and adding the target cookie object to the target request object.
Wherein the target cookie object includes a session number included in the selected login information.
Optionally, when it is determined that the selected login information exists in the target list, a cookie object needs to be created, and the target cookie object is added to the target request object to be used as a cookie of the current request, so that the login state is injected into the current request, and after the injection is successful, the current function can be continuously executed normally.
It should be noted that the value of the constructor of the target cookie object is ("jsesionid", session Id), and the code is: cookie = new Cookie ("jsesionid", session Id); addcookie (cookie). Wherein the value of the Session Id variable is the value of the Session Id field in the login information in the selected login information list; the meaning of the code here is that the current request is added with a cookie of jsesionid=xxxx, so that it carries a login cookie, and xxxx is the value of Session Id, which is a valid login cookie because it is saved from the previous login.
In the embodiment of the application, when any function is determined not to be the login function of the target application, whether the selected login information exists in the target list is required to be judged, so that when the selected login information exists in the target list, the target cookie object is created, and the target cookie object is added into the target request object to be used as the cookie of the current request, so that the valid login state cookie of the current request is determined, the efficiency of testing the interface is improved, and the workload is reduced.
In one design, as shown in fig. 8, in the method for testing an interface without logging in provided by the embodiment of the present application, the method in step S501 may specifically include steps S601 to S602:
S601, acquiring a state field value corresponding to each piece of login information in at least one piece of login information included in the target list.
Wherein the status field value is any one of: a first status field value for indicating that the corresponding login information is selected, and a second status field value for indicating that the corresponding login information is not selected.
S602, when the state field value corresponding to any one piece of login information in at least one piece of login information is determined to be the first state field value, determining that the selected login information exists in the target list.
Optionally, whether the login information is selected may be determined based on a status field value corresponding to the login information, and when it is determined that the selected login information does not exist in the target list, it is indicated that the login is not required to be simulated, and then the current function is directly and normally executed without any intervention (at this time, the interface function does not carry the login status information and fails to execute).
In the embodiment of the application, whether the selected login information exists in the target list can be determined by acquiring the state field value corresponding to each piece of login information in at least one piece of login information included in the target list, so that the efficiency and the accuracy for determining whether the selected login information exists in the target list are improved.
The application provides an interface test login-free method, when an interface of a target application needs to be tested, a user can input basic information which corresponds to the target application and comprises at least one of an application name, an interface packet path and a login function name in a preset interface of terminal equipment so as to trigger the monitoring of the target application. And then, based on at least one operation of logging in the target application triggered by the user at the terminal equipment, recording at least one piece of login information corresponding to the at least one login to obtain a target list. Therefore, the interface of the target application can be tested based on any one piece of login information in the at least one piece of login information, so that when the interface of the target application is called, the call can be successfully carried out without carrying a login state. By the method, the login information corresponding to the login target application triggered by the user at the terminal equipment can be obtained in the process of monitoring the target application, so that the interface of the target application can be tested based on the obtained login information; the call can be successfully performed when the interface of the target application is called without carrying a login state. Therefore, the efficiency of testing the interface can be improved, and the workload is reduced.
The foregoing description of the solution provided by the embodiments of the present application has been mainly presented in terms of a method. To achieve the above functions, it includes corresponding hardware structures and/or software modules that perform the respective functions. Those of skill in the art will readily appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as hardware or combinations of hardware and computer software. Whether a function is implemented as hardware or computer software driven hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
According to the embodiment of the application, the function modules of the interface test login-free device can be divided according to the method example, for example, each function module can be divided corresponding to each function, and two or more functions can be integrated in one processing module. The integrated modules may be implemented in hardware or in software functional modules. Optionally, the division of the modules in the embodiment of the present application is schematic, which is merely a logic function division, and other division manners may be implemented in practice.
Fig. 9 is a schematic structural diagram of an interface test login-free device according to an embodiment of the present application. As shown in fig. 9, an interface test login-free apparatus 100 is used to improve the efficiency of testing interfaces and reduce the workload, for example, to perform an interface test login-free method shown in fig. 2. The interface test login-free device 100 includes: a processing unit 1001, a recording unit 1002, a testing unit 1003, and a transmission unit 1004;
the processing unit 1001 is configured to monitor a target application based on basic information corresponding to the target application input by a user at a preset interface, where the basic information includes at least one of the following: application name, interface packet path, login function name;
the recording unit 1002 is configured to record, based on an operation of at least one login target application triggered by a user at a terminal device, at least one piece of login information corresponding to at least one login to obtain a target list, where one piece of login information corresponds to one piece of login information, and the login information includes at least one of the following: account information, session number;
the test unit 1003 is configured to test the interface of the target application based on any one of the at least one piece of login information, and call the interface of the target application successfully without carrying a login state, where the login state is information for identifying the identity of the user.
In a possible implementation manner, in the login-free device 100 for interface test provided by the embodiment of the present application, the processing unit 1001 is specifically configured to mount, based on basic information corresponding to a target application input by a user at a preset interface, a target command onto a process of the target application, where the target command includes at least one of the following information: the method comprises the steps of processing numbers of target applications and identifiers of target modules in the target applications, wherein the target modules comprise preset monitoring logic processing packages, and the preset monitoring logic processing packages are used for monitoring interfaces of the target applications;
and a transmission unit 1004, configured to return a response message to the terminal device, and send a target list including at least one piece of login information to the terminal device, so as to display the at least one piece of login information in an interface of the terminal device.
In a possible implementation manner, in the interface test login-free device 100 provided by the embodiment of the present application, the processing unit 1001 is further configured to process a plurality of functions corresponding to the interface of the packet monitoring target application based on a preset monitoring logic;
the processing unit 1001 is further configured to determine, before any one of the functions is monitored to be invoked by the terminal device and any one of the functions is executed, whether any one of the functions is a login function of the target application;
The processing unit 1001 is further configured to execute any function when determining that any function is a login function of the target application, and obtain target login information corresponding to a target request object for calling any function before any function is executed and response content is returned to the terminal device;
the processing unit 1001 is further configured to store target login information corresponding to the target request object in a target list.
In a possible implementation manner, in the interface test login-free device 100 provided by the embodiment of the present application, the processing unit 1001 is further configured to determine whether the selected login information exists in the target list when it is determined that any function is not a login function of the target application;
the processing unit 1001 is further configured to create a target cookie object when it is determined that the selected login information exists in the target list, and add the target cookie object to the target request object, where the target cookie object includes a session number included in the selected login information.
In a possible implementation manner, in the interface test login-free device 100 provided by the embodiment of the present application, the processing unit 1001 is further configured to obtain a status field value corresponding to each piece of login information in at least one piece of login information included in the target list, where the status field value is any one of the following: a first status field value for indicating that the corresponding login information is selected, and a second status field value for indicating that the corresponding login information is not selected;
The processing unit 1001 is further configured to determine that the selected login information exists in the target list when determining that a status field value corresponding to any one of the at least one piece of login information is the first status field value.
In the case of implementing the functions of the integrated modules in the form of hardware, another possible structural schematic diagram of the electronic device involved in the above embodiment is provided in the embodiment of the present application. As shown in fig. 10, an electronic device 90 is provided for improving the efficiency of testing interfaces and reducing the effort, for example, for performing an interface test log-in-free method as shown in fig. 2. The electronic device 90 comprises a processor 901, a memory 902 and a bus 903. The processor 901 and the memory 902 may be connected by a bus 903.
The processor 901 is a control center of the communication device, and may be one processor or a collective term of a plurality of processing elements. For example, the processor 901 may be a general-purpose central processing unit (central processing unit, CPU), or may be another general-purpose processor. Wherein the general purpose processor may be a microprocessor or any conventional processor or the like.
As one example, processor 901 may include one or more CPUs, such as CPU 0 and CPU 1 shown in fig. 10.
The memory 902 may be, but is not limited to, read-only memory (ROM) or other type of static storage device that can store static information and instructions, random access memory (random access memory, RAM) or other type of dynamic storage device that can store information and instructions, as well as electrically erasable programmable read-only memory (EEPROM), magnetic disk storage or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer.
As a possible implementation, the memory 902 may exist separately from the processor 901, and the memory 902 may be connected to the processor 901 by a bus 903 for storing instructions or program code. When the processor 901 calls and executes the instructions or the program codes stored in the memory 902, the method for testing the interface without logging in provided by the embodiment of the application can be realized.
In another possible implementation, the memory 902 may also be integrated with the processor 901.
Bus 903 may be an industry standard architecture (Industry Standard Architecture, ISA) bus, a peripheral component interconnect (Peripheral Component Interconnect, PCI) bus, or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, among others. The bus may be classified as an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in fig. 10, but not only one bus or one type of bus.
It should be noted that the structure shown in fig. 10 does not constitute a limitation of the electronic device 90. The electronic device 90 may include more or fewer components than shown in fig. 10, or may combine certain components or a different arrangement of components.
As an example, in connection with fig. 9, the processing unit 1001, the recording unit 1002, the testing unit 1003, and the transmission unit 1004 in the interface test log-free device 100 realize the same functions as those of the processor 901 in fig. 10.
Optionally, as shown in fig. 10, the electronic device 90 provided in the embodiment of the present application may further include a communication interface 904.
A communication interface 904 for connecting with other devices via a communication network. The communication network may be an ethernet, a radio access network, a wireless local area network (wireless local area networks, WLAN), etc. The communication interface 904 may include a receiving unit for receiving data and a transmitting unit for transmitting data.
In one design, the electronic device provided in the embodiment of the present application may further include a communication interface integrated in the processor.
From the above description of embodiments, it will be apparent to those skilled in the art that the foregoing functional unit divisions are merely illustrative for convenience and brevity of description. In practical applications, the above-mentioned function allocation may be performed by different functional units, i.e. the internal structure of the device is divided into different functional units, as needed, to perform all or part of the functions described above. The specific working processes of the above-described systems, devices and units may refer to the corresponding processes in the foregoing method embodiments, which are not described herein.
The embodiment of the application also provides a computer readable storage medium, wherein the computer readable storage medium stores instructions, when the computer executes the instructions, the computer executes each step in the method flow shown in the method embodiment.
Embodiments of the present application provide a computer program product comprising instructions which, when executed on a computer, cause the computer to perform an interface test log-free method as in the method embodiments described above.
The computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: electrical connections having one or more wires, portable computer diskette, hard disk. Random access Memory (Random Access Memory, RAM), read-Only Memory (ROM), erasable programmable Read-Only Memory (Erasable Programmable Read Only Memory, EPROM), registers, hard disk, optical fiber, portable compact disc Read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any other form of computer-readable storage medium suitable for use by a person or persons of skill in the art.
An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an application specific integrated circuit (Application Specific Integrated Circuit, ASIC).
In embodiments of the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
Since the electronic device, the computer readable storage medium, and the computer program product in the embodiments of the present application can be applied to the above-mentioned method, the technical effects that can be obtained by the method can also refer to the above-mentioned method embodiments, and the embodiments of the present application are not described herein again.
The present application is not limited to the above embodiments, and any changes or substitutions within the technical scope of the present application should be covered by the scope of the present application.

Claims (12)

1. A login-free method for interface testing, the method comprising:
Based on basic information corresponding to a target application input by a user on a preset interface, monitoring the target application, wherein the basic information comprises at least one of the following: application name, interface packet path, login function name;
based on at least one operation of logging in the target application triggered by a user at the terminal equipment, recording at least one piece of login information corresponding to the at least one login to obtain a target list, wherein the one piece of login information corresponds to one piece of login information, and the login information comprises at least one of the following items: account information, session number;
and testing the interface of the target application based on any one piece of login information in the at least one piece of login information, wherein the interface of the target application can be successfully called without carrying a login state when the interface of the target application is called, and the login state is information for identifying the identity of a user.
2. The method of claim 1, wherein the monitoring the target application based on the basic information corresponding to the target application input by the user at the preset interface includes:
based on basic information corresponding to a target application input by a user on a preset interface, mounting a target command on a process of the target application, wherein the target command comprises at least one of the following information: the method comprises the steps that the process number of a target application and the identification of a target module in the target application are adopted, wherein the target module comprises a preset monitoring logic processing package, and the preset monitoring logic processing package is used for monitoring an interface of the target application;
And returning a response message to the terminal equipment, and sending the target list comprising the at least one piece of login information to the terminal equipment so as to display the at least one piece of login information in an interface of the terminal equipment.
3. The method according to claim 1 or 2, characterized in that the method further comprises:
monitoring a plurality of functions corresponding to the interfaces of the target application based on a preset monitoring logic processing packet;
before any function in the functions is monitored to be called by the terminal equipment and executed, judging whether any function is a login function of the target application;
when determining that any function is a login function of the target application, executing the any function, and acquiring target login information corresponding to a target request object for calling the any function before the execution of the any function is finished and response content is returned to the terminal equipment;
and storing target login information corresponding to the target request object in the target list.
4. A method according to claim 3, characterized in that the method further comprises:
when determining that any function is not the login function of the target application, judging whether the selected login information exists in the target list;
When it is determined that the selected login information exists in the target list, a target cookie object is created, and the target cookie object is added to the target request object, wherein the target cookie object comprises a session number included in the selected login information.
5. The method of claim 4, wherein said determining whether the selected login information exists in the target list comprises:
acquiring a state field value corresponding to each piece of login information in the at least one piece of login information included in the target list, wherein the state field value is any one of the following: a first status field value for indicating that the corresponding login information is selected, and a second status field value for indicating that the corresponding login information is not selected;
and when the state field value corresponding to any one piece of login information in the at least one piece of login information is determined to be the first state field value, determining that the selected login information exists in the target list.
6. An interface test log-in-free device, comprising: the device comprises a processing unit, a recording unit and a testing unit;
The processing unit is used for monitoring the target application based on basic information corresponding to the target application input by a user on a preset interface, and the basic information comprises at least one of the following items: application name, interface packet path, login function name;
the recording unit is configured to record, based on at least one operation of logging in the target application triggered by the user at the terminal device, at least one piece of login information corresponding to the at least one login to obtain a target list, where the at least one piece of login information corresponds to one piece of login information, and the login information includes at least one of the following: account information, session number;
the test unit is used for testing the interface of the target application based on any one piece of login information in the at least one piece of login information, and calling is successful without carrying a login state when the interface of the target application is called, wherein the login state is information for identifying the identity of a user.
7. The interface test login-free device of claim 6, further comprising: a transmission unit:
the processing unit is specifically configured to mount a target command on a process of a target application based on basic information corresponding to the target application input by a user on a preset interface, where the target command includes at least one of the following information: the method comprises the steps that the process number of a target application and the identification of a target module in the target application are adopted, wherein the target module comprises a preset monitoring logic processing package, and the preset monitoring logic processing package is used for monitoring an interface of the target application;
The transmission unit is configured to return a response message to the terminal device, and send the target list including the at least one piece of login information to the terminal device, so as to display the at least one piece of login information in an interface of the terminal device.
8. The interface test login-free device according to claim 6 or 7, wherein the processing unit is further configured to monitor a plurality of functions corresponding to the interface of the target application based on a preset monitoring logic processing packet;
the processing unit is further configured to determine, before any one of the functions is monitored to be called by the terminal device and executed, whether the any one function is a login function of the target application;
the processing unit is further configured to execute the arbitrary function when it is determined that the arbitrary function is a login function of the target application, and acquire target login information corresponding to a target request object for calling the arbitrary function before the arbitrary function is executed and response content is returned to the terminal device;
the processing unit is further configured to store target login information corresponding to the target request object in the target list.
9. The interface test login-free device according to claim 8, wherein the processing unit is further configured to determine whether selected login information exists in the target list when it is determined that the arbitrary function is not a login function of the target application;
the processing unit is further configured to create a target cookie object when it is determined that the selected login information exists in the target list, and add the target cookie object to the target request object, where the target cookie object includes a session number included in the selected login information.
10. The interface test login-free device according to claim 9, wherein the processing unit is further configured to obtain a status field value corresponding to each of the at least one piece of login information included in the target list, the status field value being any one of: a first status field value for indicating that the corresponding login information is selected, and a second status field value for indicating that the corresponding login information is not selected;
the processing unit is further configured to determine that the selected login information exists in the target list when it is determined that a status field value corresponding to any one of the at least one piece of login information is a first status field value.
11. An electronic device, comprising: a processor and a memory; wherein the memory is configured to store one or more programs, the one or more programs comprising computer-executable instructions that, when executed by the electronic device, cause the electronic device to perform an interface test log-in-free method of any of claims 1-5.
12. A computer readable storage medium storing one or more programs, wherein the one or more programs comprise instructions, which when executed by a computer, cause the computer to perform an interface test log-free method of any of claims 1-5.
CN202310665442.7A 2023-06-06 2023-06-06 Login-free method, device, equipment and storage medium for interface test Pending CN116881119A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310665442.7A CN116881119A (en) 2023-06-06 2023-06-06 Login-free method, device, equipment and storage medium for interface test

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310665442.7A CN116881119A (en) 2023-06-06 2023-06-06 Login-free method, device, equipment and storage medium for interface test

Publications (1)

Publication Number Publication Date
CN116881119A true CN116881119A (en) 2023-10-13

Family

ID=88268768

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310665442.7A Pending CN116881119A (en) 2023-06-06 2023-06-06 Login-free method, device, equipment and storage medium for interface test

Country Status (1)

Country Link
CN (1) CN116881119A (en)

Similar Documents

Publication Publication Date Title
CN110765024B (en) Simulation test method, simulation test device, electronic equipment and computer readable storage medium
CN114095567B (en) Data access request processing method and device, computer equipment and medium
CN113900834B (en) Data processing method, device, equipment and storage medium based on Internet of things technology
CN109558320A (en) System detection method, device, system, equipment and computer readable storage medium
CN107274222A (en) Advertisement placement method and device
CN111190551A (en) Redis data migration system, method and device and terminal
CN108650123B (en) Fault information recording method, device, equipment and storage medium
CN115705190A (en) Method and device for determining dependence degree
CN113191889A (en) Wind control configuration method, configuration system, electronic device and readable storage medium
CN110838929B (en) System error checking method and system error checking device
CN108647139B (en) System test method, device, storage medium and electronic device
CN116881119A (en) Login-free method, device, equipment and storage medium for interface test
CN113296911B (en) Cluster calling method, cluster calling device, electronic equipment and readable storage medium
CN103019927B (en) A kind of performance test methods and system
CN115361378A (en) Test environment file searching method and system and computer equipment
CN113849356A (en) Equipment testing method and device, electronic equipment and storage medium
CN111737129A (en) Service control method, service control device, computer readable medium and electronic equipment
CN112416750A (en) Application program boundary testing method and system
CN112860770A (en) Report generation method and device, electronic equipment and storage medium
CN112699034B (en) Virtual login user construction method, device, equipment and storage medium
CN113407440B (en) Testing system and method for wireless communication module
CN115481448B (en) Data acquisition method, device, server and storage medium
CN116208660B (en) Method, device, system, equipment and medium for dynamically connecting remote desktop with cloud server
CN111158671B (en) Micro-service architecture software module dynamic loading method based on registration and directional scanning
CN115174665A (en) Login state determination method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination