CN113032244A - Interface testing method, device, computer system and computer readable storage medium - Google Patents

Interface testing method, device, computer system and computer readable storage medium Download PDF

Info

Publication number
CN113032244A
CN113032244A CN202110202647.2A CN202110202647A CN113032244A CN 113032244 A CN113032244 A CN 113032244A CN 202110202647 A CN202110202647 A CN 202110202647A CN 113032244 A CN113032244 A CN 113032244A
Authority
CN
China
Prior art keywords
test
interface
tested
target
service
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.)
Granted
Application number
CN202110202647.2A
Other languages
Chinese (zh)
Other versions
CN113032244B (en
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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202110202647.2A priority Critical patent/CN113032244B/en
Publication of CN113032244A publication Critical patent/CN113032244A/en
Application granted granted Critical
Publication of CN113032244B publication Critical patent/CN113032244B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/3664Environments for testing or debugging software
    • 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

Landscapes

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

Abstract

The present disclosure provides an interface testing method, an interface testing apparatus, a computer system, a computer-readable storage medium, and a computer program product, which may be used in the field of computers, internet of things technology, or other fields. Wherein, the method comprises the following steps: responding to a selection request aiming at a target interface service to be tested, and generating a test template corresponding to the target interface service to be tested, wherein the selection request is generated by selecting the target interface service to be tested on an interface test interface of a client by a user; sending the test template to the client so that the client generates a test message for testing the target tested interface service according to the test template; responding to a test request containing a test message, testing the target tested interface service, and generating a serialized test result; and sending the test result to the client so that the client can display the test result.

Description

Interface testing method, device, computer system and computer readable storage medium
Technical Field
The present disclosure relates to the field of computer and internet of things technologies, and more particularly, to an interface testing method, an interface testing apparatus, a computer system, a computer-readable storage medium, and a computer program product.
Background
There are many interface definitions in the software system in the industry, and the software system can be divided into an external interface and an internal interface according to range division, and can be divided into an http interface, an RPC interface, an API interface and the like according to protocol types. In the development process of system software, when testing different types of interfaces, corresponding interface environments are inevitably required to be loaded.
In the process of implementing the concept disclosed by the present disclosure, the inventor finds that there are at least the following problems in the related art, and the interface test engineering cost is high and the technical access threshold of the tester is high due to the need of loading the corresponding system environment during the interface test.
Disclosure of Invention
In view of the above, the present disclosure provides an interface testing method, an interface testing apparatus, a computer system, a computer-readable storage medium, and a computer program product.
One aspect of the present disclosure provides an interface testing method applied to a server, including: generating a test template corresponding to a target interface service to be tested in response to a selection request aiming at the target interface service to be tested, wherein the selection request is generated by selecting the target interface service to be tested on an interface test interface of a client by a user; sending the test template to the client so that the client generates a test message for testing the target tested interface service according to the test template; responding to a test request containing the test message, testing the target tested interface service, and generating a serialized test result; and sending the test result to the client so that the client can display the test result.
Another aspect of the present disclosure provides an interface testing method applied to a client, including: sending a selection request aiming at a target tested interface service to a server so that the server returns a test template corresponding to the target tested interface service according to the selection request, wherein the selection request is generated by selecting the target tested interface service on an interface test interface of a client by a user, and the interface test interface comprises at least one tested interface service; generating a test message for testing the target tested interface service according to the test template; sending a test request containing the test message to the server so that the server returns a test result corresponding to the target tested interface service; and receiving the test result and displaying the test result on the client.
Another aspect of the present disclosure provides an interface testing apparatus applied to a server, including: the device comprises a first generation module, a second generation module and a third generation module, wherein the first generation module is used for responding to a selection request aiming at a target interface service to be tested and generating a test template corresponding to the target interface service to be tested, and the selection request is generated by selecting the target interface service to be tested on an interface test interface of a client by a user; the first sending module is used for sending the test template to the client so that the client generates a test message for testing the target tested interface service according to the test template; the second generation module is used for responding to a test request containing the test message, testing the target tested interface service and generating a serialized test result; and the second sending module is used for sending the test result to the client so that the client can display the test result.
Another aspect of the present disclosure provides an interface testing apparatus applied to a client, including: a third sending module, configured to send a selection request for a target interface to be tested to a server, so that the server returns a test template corresponding to the target interface to be tested according to the selection request, where the selection request is generated when a user selects the target interface to be tested on an interface test interface of a client, where the interface test interface includes at least one interface to be tested; a fourth generating module, configured to generate a test packet for testing the target tested interface service according to the test template; a fourth sending module, configured to send a test request including the test packet to the server, so that the server returns a test result corresponding to the target tested interface service; and the first display module is used for receiving the test result and displaying the test result on the client.
Another aspect of the present disclosure provides a computer system comprising: one or more processors; memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the interface testing method as described above.
Another aspect of the present disclosure provides a computer-readable storage medium having stored thereon computer-executable instructions for implementing the interface testing method as described above when executed.
Another aspect of the present disclosure provides a computer program product comprising computer executable instructions for implementing the interface testing method as described above when executed.
According to the embodiment of the disclosure, a test template corresponding to a target interface service to be tested is generated by responding to a selection request for the target interface service to be tested, wherein the selection request is generated by selecting the target interface service to be tested on an interface test interface of a client by a user; sending the test template to the client so that the client generates a test message for testing the target tested interface service according to the test template; responding to a test request containing a test message, testing the target tested interface service, and generating a serialized test result; the client provides an interface test interface for controlling the test process of the tested interface service, and the tested interface service does not need to be loaded specially, so that the technical problem of high interface test engineering cost caused by the fact that a corresponding system environment needs to be loaded during interface test is at least partially solved, and the technical effect of reducing the technical threshold of testers is achieved.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent from the following description of embodiments of the present disclosure with reference to the accompanying drawings, in which:
FIG. 1 schematically illustrates an exemplary system architecture to which an interface test method may be applied, according to an embodiment of the disclosure;
fig. 2 schematically shows a flowchart of an interface testing method applied to a server according to an embodiment of the present disclosure;
FIG. 3 schematically illustrates a dependency assist functionality setup for an interface test method according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram illustrating dynamic execution of test packets for implementing an interface test method according to an embodiment of the present disclosure;
FIG. 5 schematically shows a flow chart of an interface testing method applied to a client according to an embodiment of the present disclosure;
FIG. 6 schematically shows a system architecture diagram for implementing an interface test method according to an embodiment of the present disclosure;
FIG. 7 schematically shows a block diagram of an interface testing apparatus applied to a server according to an embodiment of the present disclosure;
FIG. 8 schematically shows a block diagram of an interface testing arrangement applied to a client according to an embodiment of the present disclosure; and
FIG. 9 schematically illustrates a block diagram of a computer system suitable for implementing the interface testing method according to an embodiment of the present disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is illustrative only and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It is noted that the terms used herein should be interpreted as having a meaning that is consistent with the context of this specification and should not be interpreted in an idealized or overly formal sense.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B and C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.). Where a convention analogous to "A, B or at least one of C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B or C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
With the development of cloud computing in the field of computers, distributed application technology tends to be mature, application tends to be more miniaturized, and development is conducted in multiple levels.
The inventor finds that the traditional system design turns to a horizontal service decoupling and vertical layered structure in the process of realizing the concept of the present disclosure, but from the research and development test point of view, more manpower needs to be invested to realize a multi-level system, and the multi-level system means that a tool level is needed to support research and development test work of different levels. In the aspect of interface testing, more layers and types of interfaces need to be covered, but in the research and development process of system software, the problem of system dependence needs to be solved for different types of interfaces, the calling function of different interfaces is realized, the interface testing is realized by sequentially completing multiple steps of interface configuration, communication area editing, interface request, result processing and the like, the test engineering realization cost is high, and the technical access threshold of testers is high.
The inventor also finds that, in the process of implementing the concept disclosed by the invention, in the research and development process, the software version iteration needs to solve the problem of cost in the aspects of technology and management due to the fact that different versions of the same interface and multiple implementations of different environments need to be realized.
Embodiments of the present disclosure provide an interface testing method, an interface testing apparatus, a computer system, a computer-readable storage medium, and a computer program product. The method can be applied to a server, and comprises the steps of responding to a selection request aiming at a target tested interface service, and generating a test template corresponding to the target tested interface service, wherein the selection request is generated by selecting the target tested interface service on an interface test interface of a client side by a user; sending the test template to the client so that the client generates a test message for testing the target tested interface service according to the test template; responding to a test request containing a test message, testing the target tested interface service, and generating a serialized test result; and sending the test result to the client so that the client can display the test result. The method can also be applied to a client, and comprises the following steps: sending a selection request aiming at a target tested interface service to a server so that the server returns a test template corresponding to the target tested interface service according to the selection request, wherein the selection request is generated by selecting the target tested interface service on an interface test interface of a client by a user, and the interface test interface comprises at least one tested interface service; generating a test message for testing the target tested interface service according to the test template; sending a test request containing a test message to a server so that the server returns a test result corresponding to the target tested interface service; and receiving the test result and displaying the test result on the client
Fig. 1 schematically illustrates an exemplary system architecture 100 to which the interface test method may be applied, according to an embodiment of the disclosure. It should be noted that fig. 1 is only an example of a system architecture to which the embodiments of the present disclosure may be applied to help those skilled in the art understand the technical content of the present disclosure, and does not mean that the embodiments of the present disclosure may not be applied to other devices, systems, environments or scenarios.
As shown in fig. 1, the system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired and/or wireless communication links, and so forth.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have various communication client applications installed thereon, such as a shopping application, a web browser application, a search application, an instant messaging tool, a mailbox client, and/or social platform software.
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 105 may be a server that provides various services, such as a background management server that provides support for websites browsed by users using the terminal devices 101, 102, 103. The background management server may analyze and perform other processing on the received data such as the user request, and feed back a processing result (e.g., a webpage, information, or data obtained or generated according to the user request) to the terminal device.
It should be noted that the interface testing method provided by the embodiment of the present disclosure may be generally executed by the server 105. Accordingly, the interface testing apparatus provided by the embodiments of the present disclosure may be generally disposed in the server 105. The interface testing method provided by the embodiment of the present disclosure may also be performed by a server or a server cluster that is different from the server 105 and is capable of communicating with the terminal devices 101, 102, 103 and/or the server 105. Accordingly, the interface testing apparatus provided in the embodiments of the present disclosure may also be disposed in a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and/or the server 105. Alternatively, the interface testing method provided by the embodiment of the present disclosure may also be executed by the terminal device 101, 102, or 103, or may also be executed by another terminal device different from the terminal device 101, 102, or 103. Accordingly, the interface testing apparatus provided in the embodiments of the present disclosure may also be disposed in the terminal device 101, 102, or 103, or in another terminal device different from the terminal device 101, 102, or 103.
For example, the interface under test service may be originally provided by any one of the terminal devices 101, 102, or 103 (for example, but not limited to, the terminal device 101), or may be provided by importing an external storage device into the terminal device 101, and then the server 105 may locally perform the interface testing method provided by the embodiment of the present disclosure. Alternatively, the interface under test service may be originally provided by the server 105, or may be provided by an external server imported into the server 105, and then any one of the terminal devices 101, 102, or 103 (for example, the terminal device 101, but not limited thereto) may locally perform the interface testing method provided by the embodiment of the present disclosure. Or sending the interface service to be tested to other terminal devices, servers, or server clusters, and executing the interface test method provided by the embodiment of the disclosure by the other terminal devices, servers, or server clusters receiving the interface service to be tested.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
It should be noted that the interface testing method, the interface testing apparatus, the computer system, the computer readable storage medium, and the computer program product of the present disclosure may be used in the field of computer and internet of things technologies, and may also be used in any field other than the field of computer and internet of things technologies.
Fig. 2 schematically shows a flowchart of an interface testing method applied to a server according to an embodiment of the present disclosure.
As shown in fig. 2, the method includes operations S201 to S204.
In operation S201, a test template corresponding to a target interface under test service is generated in response to a selection request for the target interface under test service, where the selection request is generated by a user selecting the target interface under test service on an interface test interface of a client.
According to the embodiment of the disclosure, the interface service to be tested may be implemented according to a system to be tested, for example, the system to be tested may be used to construct a server, and each interface to be tested in the system to be tested may be packaged into different test service nodes according to different types and versions, for example, the interface service to be tested may be constructed. The test service nodes may be deployed at a minimum service granularity, for example, in consideration of implementation cost, for example, different types of interfaces to be tested may be merged to synthesize one interface to be tested service, but it is necessary to ensure that iterative versions of the merged interfaces to be tested are consistent, so as to avoid version conflicts, and meanwhile, each test service node may inherit a basic service of a corresponding system to be tested, such as a service registration module, a service response module, and the like. The client is used for providing an integrated user interface (i.e. the interface test interface) for the developer, for example, all test service nodes packaged at the server may be presented in the form of a testable service list in the interface test interface, and the target interface under test service may be, for example, a test service node selected by a user. The selection request may include, for example, a url portion and a message portion, the url portion is used to determine the target dut interface service, data of the message portion may be, for example, default data or null data, and an initial field value of the obtained test template may be, for example, a default value or a null value.
In operation S202, the test template is sent to the client, so that the client generates a test packet for testing the target tested interface service according to the test template.
According to the embodiment of the disclosure, after receiving the test template, the client may, for example, manually edit data on the basis of the test template by a tester, for example, modify an initial field value in the template into a test value having an actual meaning, so that a test packet for testing the target tested interface service may be generated according to the modified data.
In operation S203, in response to the test request including the test packet, the target dut interface service is tested, and a serialized test result is generated.
According to an embodiment of the present disclosure, the test request may include, for example, a url (link) part and a message part (i.e., the test message), where the url part includes, for example, service attribute related information that may be used to determine the target interface under test service, and the message part may include, for example, service related information that is used to provide test data for the target interface under test service.
In operation S204, the test result is sent to the client, so that the client presents the test result.
According to the embodiment of the disclosure, the test result obtained after the test is performed in response to the test request can be displayed on the client side for visual observation by a tester, for example.
Through the embodiment of the disclosure, the client provides the interface test interface for controlling the test process of the tested interface service, the tested interface service can be directly packaged at the server, and meanwhile, the system environment of the service can be directly utilized, and a complex additional loading process is not needed, so that the technical problem of high interface test engineering cost caused by the fact that the corresponding system environment needs to be loaded during interface test is solved, and the technical threshold of testers is reduced.
The method illustrated in fig. 2 is further described below with reference to the accompanying drawings in conjunction with the specific embodiments.
According to an embodiment of the present disclosure, the above operation S201 may include operations S201-1 to S201-3, for example.
In operation S201-1, registration information of the target dut interface service registered with the test service registry is determined according to the selection request, where the registration information includes attribute information of the target dut interface service and an input class method for performing information processing.
According to an embodiment of the present disclosure, the test service registry may be configured to provide a registration service for the test service node, for example, when a tester needs to request access to a certain test service node or certain test service nodes (such as the target dut interface service), the test service node may be first found from a service end by way of routing, and then registered in the test service registry. The registration information may include, for example, service node information, a service ID, an interface name, a request version, a request path, communication area information, a request parameter, and the like (i.e., the attribute information), so as to ensure the uniqueness of the tested interface service. The client can discover all measurable services through the testing service registry, and display the related information of all measurable interface services to be tested in the interface testing interface in the form of a measurable service list for the reference and selection of a tester.
According to the embodiment of the present disclosure, for example, service registration information may be defined at a client, a test service node that needs to request access is determined, and after a corresponding test service node is found from a server, registration is completed with data in JSON format, where the JSON data may be represented as follows:
Figure BDA0002948925050000101
the values corresponding to the fields of id, name, interface, method, and version, for example, may constitute the attribute information, and the value corresponding to the input field, for example, may constitute the input method.
In operation S201-2, the attribute information is processed using an input class method to generate an input class instance.
According to an embodiment of the present disclosure, the input class method may be expressed in the form of:
Figure BDA0002948925050000102
Figure BDA0002948925050000111
in operation S201-3, the input class instance is serialized to obtain a test template.
According to an embodiment of the present disclosure, the input class instance (or called communication zone class instance) may be used to generate a test template, for example. Specifically, by performing serialization processing on the input class instance and extracting the annotation information by using JAVA DOC API in combination with the source code (such as the input class method described above), a request message template (i.e. the test template) in the following form can be generated:
Figure BDA0002948925050000112
it should be noted that the native JSON does not support the annotation format, and when the packet is processed by the background service, the annotation content needs to be removed, and the packet is restored to the valid JSON packet data.
According to an embodiment of the present disclosure, the above operation S203 may include, for example, operations S203-1 to S203-4.
In operation S203-1, registration information of a target dut interface service registered in a test service registry is acquired, where the registry includes an output class method for performing information processing.
According to an embodiment of the present disclosure, the output class method may be expressed in the following form, for example:
Figure BDA0002948925050000121
in operation S201-2, return information obtained by the target dut after responding to the test request and performing the test is obtained.
According to the embodiment of the present disclosure, the return format of the target tested interface service may be JSON format data, and the return packet (i.e., the return information) is, for example, { "result 1": true, "result 2": "transaction success", "recovery 3": 10000}.
In operation S201-3, the return information is deserialized by using an output class method to obtain an output class instance.
In operation S201-4, the output class instance is serialized to obtain a test result.
According to the embodiment of the disclosure, the message return format has no supplementary information and is poor in readability for developers. To solve the problem, for example, deserialization may be performed according to the information of the returned message and the output class method to obtain an output class instance, and the output class instance is serialized again, and field annotation information is extracted by combining with the JAVA DOC API, so as to obtain a test result in the following form, for example:
Figure BDA0002948925050000131
through the above embodiment of the present disclosure, a plurality of tested system test service nodes are built, and the test service nodes are registered in the test service registration center, so that the test service nodes registered in the registration center can be derived from the tested system, and can be isolated from the tested system, that is, on the basis of inheriting the basic service of the tested system, the mutual conflict with the built-in registration service of the tested system can be avoided, the problem of erecting the test service of the plurality of tested systems is solved, and the technical problem that the tested system is difficult to realize multi-level test can be effectively shielded. Meanwhile, the testable service list is displayed to research and development personnel through an interface test interface of the client, the discoverability of the test service nodes is improved, the test template is generated through binding with the source code, and annotation information of the source code is injected, so that the testability of the test service nodes is improved, and the relevance of the testable service nodes is more transparently displayed to the research and development personnel.
According to the embodiment of the present disclosure, in order to further optimize the test efficiency, for example, a system dependency assistance function may also be introduced. Based on this, the interface testing method may further include: acquiring an auxiliary tool for a target tested interface service and a tested system configuration related to the target tested interface service; and registering the attribute information of the auxiliary tool to the test service registry.
Fig. 3 schematically illustrates a dependency assistance function setup for an interface test method according to an embodiment of the present disclosure.
According to the embodiment of the present disclosure, referring to fig. 3, the correlation auxiliary function set for the tested system related to the tested interface service may be implemented by, for example, a testing server, and may be customized according to the type of the tested system, the testing server services the monitoring module, and registers the monitoring service in the registry, and the client may discover the monitoring service and acquire the monitoring data through the registry. In this embodiment, taking a distributed system as an example, for example, the following services may be implemented:
a) and log monitoring, namely acquiring log information of a tested system in real time, and providing functions of monitoring, filtering, sampling, abnormality discrimination and the like.
b) And monitoring the system state, namely monitoring the service state of the tested system.
c) And the heartbeat service is used for monitoring the heartbeat service of the tested system.
d) Monitoring the availability of the interface, monitoring the service state of the interface granularity, the availability of the service, the version of the interface and the like.
e) And (4) data caching operation, so that the conventional operations of monitoring the availability of the cache, increasing, deleting, modifying and checking are realized.
f) The system configuration and the like are adopted, the related functions such as a configuration center and the like are commonly used in a distributed system, the isomorphism of the test service and the tested system is realized, the same research and development framework, the system configuration and the like are used, the test service is set to be a sensitive service, and the research and development personnel can sense the running state of the tested system more efficiently.
According to the embodiment of the disclosure, in order to further improve the testability of the test service, for example, a dynamic analysis function of the test message can be introduced, and a set of dynamic script analysis execution mechanism is constructed to realize the transition of the test message from a static text to a dynamic text. Based on this, the interface testing method may further include: acquiring a test script with a preset format from a client, wherein the test script comprises a parameter value setting script, a message generation script and a result processing script; determining a parameter value for testing the target tested interface service according to the parameter value setting script; generating a test message with parameter values adapted to the test template according to the message generation script; and processing the test result according to the result processing script.
According to the embodiment of the disclosure, because system data is constantly changed in the development process, in order to ensure the performability of static messages, dynamic logic processing needs to be performed on the messages, such as system date fields in the messages, states of test data, dictionaries of parameter classes, and the like, and meanwhile, the test data needs to be adjusted to different test cases and test scenes in the test process of a tested system. Therefore, a set of custom literal expression parsing functions needs to be designed and implemented, and functions such as dynamic generation of messages, logical calculation, database operation, and the like are implemented. The dynamic parsing execution of the test packets is further described below with reference to specific embodiments.
According to an embodiment of the present disclosure, to implement the above-mentioned series of operations of the test script having the preset format, for example, it is necessary to first define a message segmentation format and parse syntax.
According to the embodiment of the present disclosure, the definition manner for the packet segmentation format may be expressed as: the method comprises the steps of analyzing and executing before executing, requesting a message template, analyzing and executing after executing, and labeling with script segmentation labels// script,// before,// template and// after. Wherein, the tag/script may indicate, for example, that the segment script uses the rule of the message segment format defined herein; the tag// before may, for example, indicate that a corresponding script, e.g., for parsing execution before execution (e.g., before generating the test message), sets a script for the parameter value; the tag/template may, for example, represent a corresponding script as a message generation script, where the corresponding script is, for example, used to request a message template, and may, for example, dynamically generate a test message by executing the part of the script, and may initiate an interface request (for example, an operation that requires an interface in the test request) after the test message is generated; the tag// after, for example, may indicate that the corresponding script, for example, used to parse execution after execution (e.g., after the system under test returns test results in response to a test request), is a result processing script.
According to an embodiment of the present disclosure, the parsing syntax may be defined using a literal expression, and the specific definition rule may be expressed as:
a) after the message is split according to the message segmentation format, each segment is analyzed and executed according to the line.
b) Using $ [ type operation ] { operation, parameter, }, defining a basic expression form, where $ is an expression header, and left and right curly brackets { } are used as start and end symbols, where type, operation is a noun-verb combination, type is defined as a set of identical objects, verb is an operation of the object, and parameter is an indefinite length parameter.
c) During text analysis, the minimum unit of the regular expression is used for identification, all units are recursively matched, and the matching model is (.? ) \ \ $ ([ \ \ $ { } ] {0, } | \ \? ) \ \ { ([ \ \ $ { } ] {0, }) \ \ }.
d) The parameter part adopts Comma-Separated Values format (CSV for short) to decompose, obtains parameter Values according to positions, can nest literal expression for parameter Values, and analyzes according to the mode of using and analyzing, and does not analyze and execute when the parameter is not used.
e) The expression returns the type, is defined as String, Boolean, Number, Empty, Mixed.
f) And logically judging, introducing a Javascript execution engine to perform expression logic calculation processing, wherein the expression is $ servers { alert, an assertion formula is established, and 1 is larger than 0}, and the logic expression with 1 larger than 0 uses the Javascript engine to perform result processing.
g) And (2) multi-line input, wherein in the text, when the parameter has multi-line input, the use < coincidence begins, and the use > coincidence ends, and multi-line data is recorded as the parameter.
h) Defining a plurality of internal objects to realize common functions:
variable, variable.
Commonly using expression 1, obtaining variables: $ Variable { get, Variable, [ default ] }.
Common expression 2, set variables: $ Variable { set, Variable, value }.
Environment, defining environment by module granularity.
Common expression 1, binding environment: environment { bind, Environment name }.
Common expression 2, setting environment: environment { set, Environment name, field name 1, value 1, }.
Setting, system setup.
Commonly using expression 1, obtaining variables: $ Setting { get, field, [ default ] }.
Common expression 2, set variables: $ Setting { set, field, value }.
Asserters, declaring whether the associated values are consistent with expectations during execution.
Common expression 1, predicate equals: $ assert, { equivalents, desc, expect, actual }.
Common expression 2, predicate calculation: $ assert { command, desc, command }.
Http, http protocol request.
Common expression 1, POST mode request: $ Http { post, url, content, charset }.
The common expression 2 and GET mode request: $ Http { get, url }.
Database operation, wherein an environment needs to be selected, and environment loading is performed firstly in configuration and referred according to names.
General expression 1, $ DataBase { SQL, environmental name, < >
select*from sometable where limit 10;
update sometable set field1=$Variable{get,field1}where field2=$Variable{get,field2};
>>>}。
JSON, JSON data parsing.
Commonly using expression 1, resolving and setting the key value of the JSON character string as a variable:
$JSON{fetch2Variable,$Variable{get,somejsonstring}}。
common expression 2, obtaining a field value in JOSN by a key value:
$JSON{fetch,fieldName,$Variable{get,somejsonstring}}。
fig. 4 schematically shows a test packet dynamic execution diagram for implementing the interface test method according to the embodiment of the present disclosure.
According to an embodiment of the present disclosure, as shown in fig. 4, the rules of the message segment formats including// before,// template,// after, etc. tags described above are introduced using// script segment tags.
According to an embodiment of the present disclosure, as shown in fig. 4, using the// before script segmentation tag, for example, the text content of the script before execution (i.e., the parameter value setting script described above) can be acquired. By using a script grammar parser, each word quantity expression is identified according to lines, an expression execution engine is used for completing expression parsing, creating internal objects and storing variable contents defined in the expressions, so that the operations of upper and lower information definition, data (such as parameter values) preparation and the like of the script are completed.
According to the embodiment of the present disclosure, as shown in fig. 4, by using the// template script segmentation tag, for example, the content of a message template (i.e., the message generation script) can be obtained, and the value part in the template is defined by $ { variable name } expression. By using the message assembler, the numerical format of the replaceable part defined in the message template content is identified by line, and the corresponding variable value (such as the parameter value) is obtained in the context for replacement until no replaceable format exists, and the requestable message content (i.e. the test message) can be finally obtained. By obtaining service configuration information, test service node information is obtained in a test service registry, a request instance can be created, and a test request can be initiated. In response to the test request, the request response information may be obtained, and the storage unit may be created to store the message text result.
According to the embodiment of the present disclosure, as shown in fig. 4, for example, a request result may be first asserted, and an abnormal return is identified, such as a request failure throws out an abnormal process, the asserted result is a transaction failure, and a normal return request is further processed, which may include, for example, data query, data printing, data comparison, and peer-to-peer processing operations. In this embodiment, using the// after script segmentation tag, for example, the text content of the executed script (i.e., the result processing script) may be obtained, a script parser may be used to identify each word-level expression by line, and an expression execution engine may be used to complete the expression parsing. The general processing flow may be expressed, for example, as processing a message result, for example, converting a message whose returned result is a JSON literal into a JSON object, extracting a message field, and performing validity assertion on the result field and a service field, respectively. And printing and displaying objects such as lists and the like in the results, checking background data, and asserting expected results.
Through the embodiment of the disclosure, a set of dynamic script execution scheme is provided, and case design execution can be transited from static state to dynamic state. Through the dynamic script, the script can be more adaptively executed, excessive manual intervention is not needed in test execution of multiple rounds, the test intention of testers can be more expressed by the dynamic script, and multiple verification points are solidified, so that the research and development test efficiency is greatly improved.
Fig. 5 schematically shows a flowchart of an interface testing method applied to a client according to an embodiment of the present disclosure.
As shown in fig. 5, the method includes operations S501 to S504.
In operation S501, a selection request for a target interface under test service is sent to a server, so that the server returns a test template corresponding to the target interface under test service according to the selection request, where the selection request is generated when a user selects the target interface under test service on an interface test interface of a client, where the interface test interface includes at least one interface under test service.
In operation S502, a test packet for testing the target tested interface service is generated according to the test template.
In operation S503, the test request including the test packet is sent to the server, so that the server returns a test result corresponding to the target dut interface service.
In operation S504, the test result is received and presented to the client.
Through the embodiment of the disclosure, the client provides the interface test interface for controlling the test process of the tested interface service, the tested interface service can be directly packaged at the server, and meanwhile, the system environment of the service can be directly utilized, and a complex additional loading process is not needed, so that the technical problem of high interface test engineering cost caused by the fact that the corresponding system environment needs to be loaded during interface test is solved, and the technical threshold of testers is reduced.
According to an embodiment of the present disclosure, the interface testing method applied to the client may further include: acquiring auxiliary information monitored by an auxiliary tool configured for a target tested interface service and a tested system related to the target tested interface service; and displaying the auxiliary information to the client.
According to an embodiment of the present disclosure, the interface testing method applied to the client may further include: acquiring a test script with a preset format from a client, wherein the test script comprises a parameter value setting script, a message generation script and a result processing script; determining a parameter value for testing the target tested interface service according to the parameter value setting script; generating a test message with parameter values adapted to the test template according to the message generation script; and processing the test result according to the result processing script.
It should be noted that the interface test method portion applied to the client in the embodiment of the present disclosure corresponds to the interface test method portion applied to the server in the embodiment of the present disclosure, and the description of the interface test method portion applied to the client may specifically refer to the interface test method portion applied to the server, which is not described herein again.
The method shown in fig. 2 and 3 is further described with reference to fig. 6 in conjunction with specific embodiments.
Fig. 6 schematically shows a system structure diagram for implementing the interface test method according to an embodiment of the present disclosure.
As shown in fig. 6, the system is implemented by a BS (Browser/Server) structure, and includes a B-side (client) and an S-side (Server), where the B-side can provide a uniform interface test interface for testers, and present interface attribute information, a message template, a request path, and the like, and can provide tested system information including system application information, interface service information, auxiliary information, and the like, and the S-side can implement various types of interface calling component modules, and the components are laterally extended, and can provide test service nodes corresponding to each tested system in an independent service form. The service end can be implemented by a service component, including a test service registry, a test service route, an interface service node, and the like.
According to the embodiment of the disclosure, the client can obtain the test service list through the test service registration center, edit the communication area information after the client selects the test interface, and initiate the request after requesting the parameters, the test service route can follow the service information, route to the test service node, and complete the service request through the test service node.
According to the embodiment of the disclosure, in the case that the system under test is an API system, the test service node may, for example, implement API interface call, complete SDK loading of the API interface, identify the testable service, and register the testable service to the test service registry. In the case that the system under test is an http system, the test service node may, for example, implement an http protocol request, and register the testable service in the test service registry. In the case that the system under test is an RPC system, taking a Dubbo open source distributed system as an example, the test service node may be simulated as a consumer role, and simultaneously register information of the test service node in a test service registry.
According to the embodiment of the disclosure, in an agile development project research and development mode, an iteration period is short, and a situation that a set of system with multiple iteration versions coexist may exist, for example, as shown in fig. 6, a plurality of version services may be implemented through longitudinal extension, and test service nodes of different versions are respectively registered in a registry, so that heterogeneous structures of a tested system, such as differences between different interface services in the tested system, are shielded, a uniform test entry is obtained through packaging, and the test cost of research and development personnel can be effectively reduced.
Through the embodiment of the disclosure, a set of interface test service model is defined, test service nodes of different types and versions can be integrated, the mutual influence of different interface types, research and development environments and research and development versions is reduced, and dependency conflicts and the like are solved. Meanwhile, the cost for realizing the simulation system call in the interface test process is saved, and the technical threshold of a tester is reduced.
According to the embodiment of the present disclosure, for the system shown in fig. 6, when responding to a test request, for example, it may be agreed that the input and output messages of the test service node all adopt the JSON data format. Taking a tested system realized by JAVA as an example, the tested interface service generally comprises interface identification, an interface name, a calling method, input classes, output classes and other related information, the generation of a formatted input message template and the display of output messages are realized by using input and output classes in combination with a test engineering source code, using a JAVA DOC API technology to extract annotation information, and performing JAVA object serialization and deserialization operations, so that complete interface test information is displayed for developers, and the testability of the system is improved. Meanwhile, JAVA is converted into JSON format to construct test messages, so that the pressure of the system is reduced, and the test cost can be further reduced.
Through the embodiment of the disclosure, a multifunctional interface testing method is realized, and the method is used as a reuse support for a software research and development team in research and development work. In an agile development mode, a project generally needs to complete project research, development and delivery work through multiple iteration cycles, one team or multiple systems, multiple applications and multiple types of interfaces are simultaneously made, the research and development project can face human resource risks and research and development technical risks along with the increase of complexity of the application systems, and the benign development of the research and development team can be effectively supported by building the interface test service which is strong in expansibility, good in maintainability, convenient and easy to use.
Fig. 7 schematically shows a block diagram of an interface testing apparatus applied to a server according to an embodiment of the present disclosure.
As shown in fig. 7, the interface testing apparatus 700 includes a first generating module 710, a first transmitting module 720, a second generating module 730, and a second transmitting module 740.
The first generating module 710 is configured to generate a test template corresponding to a target interface under test service in response to a selection request for the target interface under test service, where the selection request is generated by selecting the target interface under test service for an interface test interface of a client by a user.
The first sending module 720 is configured to send the test template to the client, so that the client generates a test packet for testing the target tested interface service according to the test template.
The second generating module 730 is configured to respond to the test request including the test packet, test the target tested interface service, and generate a serialized test result.
The second sending module 740 is configured to send the test result to the client, so that the client displays the test result.
Through the embodiment of the disclosure, the client provides the interface test interface for controlling the test process of the tested interface service, the tested interface service can be directly packaged at the server, and meanwhile, the system environment of the service can be directly utilized, and a complex additional loading process is not needed, so that the technical problem of high interface test engineering cost caused by the fact that the corresponding system environment needs to be loaded during interface test is solved, and the technical threshold of testers is reduced.
According to an embodiment of the present disclosure, the first generating module includes a determining unit, a first processing unit, and a second processing unit.
And the determining unit is used for determining the registration information of the target tested interface service registered in the test service registration center according to the selection request, wherein the registration information comprises the attribute information of the target tested interface service and an input method for information processing.
And the first processing unit is used for processing the attribute information by using an input class method to generate an input class instance.
And the second processing unit is used for carrying out serialization processing on the input class instance to obtain the test template.
According to an embodiment of the present disclosure, the second generating module includes a first acquiring unit, a second acquiring unit, a third processing unit, and a fourth processing unit.
The device comprises a first acquisition unit, a second acquisition unit and a test service registration center, wherein the first acquisition unit is used for acquiring registration information of a target tested interface service registered in the test service registration center, and the registration center comprises an output method for processing information.
And the second acquisition unit is used for acquiring return information obtained by testing the target tested interface service after responding to the test request.
And the third processing unit is used for performing deserialization processing on the return information by using an output class method to obtain an output class example.
And the fourth processing unit is used for carrying out serialization processing on the output class examples to obtain a test result.
According to an embodiment of the present disclosure, the interface testing apparatus 700 further includes a first obtaining module and a registering module.
The first acquisition module is used for acquiring auxiliary tools configured for the target interface service to be tested and a system to be tested related to the target interface service to be tested.
And the registration module is used for registering the attribute information of the auxiliary tool to the test service registration center.
According to an embodiment of the present disclosure, the interface testing apparatus 700 further includes a second obtaining module, a first determining module, a third generating module, and a first processing module.
And the second acquisition module is used for acquiring a test script with a preset format from the client, wherein the test script comprises a parameter value setting script, a message generation script and a result processing script.
And the first determining module is used for determining the parameter value for testing the target tested interface service according to the parameter value setting script.
And the third generation module is used for generating a test message which is adaptive to the test template and has parameter values according to the message generation script.
And the first processing module is used for processing the test result according to the result processing script.
Fig. 8 schematically shows a block diagram of an interface testing apparatus applied to a client according to an embodiment of the present disclosure.
As shown in fig. 8, the interface testing apparatus 800 includes a third sending module 810, a fourth generating module 820, a fourth sending module 830, and a first display module 840.
A third sending module 810, configured to send a selection request for a target interface-under-test service to the server, so that the server returns a test template corresponding to the target interface-under-test service according to the selection request, where the selection request is generated when a user selects the target interface-under-test service on an interface test interface of the client, and the interface test interface includes at least one interface-under-test service.
A fourth generating module 820, configured to generate a test packet for testing the target tested interface service according to the test template.
A fourth sending module 830, configured to send the test request including the test packet to the server, so that the server returns a test result corresponding to the target tested interface service.
The first display module 840 is configured to receive the test result and display the test result on the client.
Through the embodiment of the disclosure, the client provides the interface test interface for controlling the test process of the tested interface service, the tested interface service can be directly packaged at the server, and meanwhile, the system environment of the service can be directly utilized, and a complex additional loading process is not needed, so that the technical problem of high interface test engineering cost caused by the fact that the corresponding system environment needs to be loaded during interface test is solved, and the technical threshold of testers is reduced.
According to an embodiment of the present disclosure, the interface testing apparatus 800 further includes a third obtaining module and a second displaying module.
And the third acquisition module is used for acquiring auxiliary information monitored by auxiliary tools configured for the target tested interface service and the tested system related to the target tested interface service.
And the second display module is used for displaying the auxiliary information on the client.
According to an embodiment of the present disclosure, the interface testing apparatus 800 further includes a fourth obtaining module, a second determining module, a fifth generating module, and a second processing module.
And the fourth obtaining module is used for obtaining a test script with a preset format from the client, wherein the test script comprises a parameter value setting script, a message generating script and a result processing script.
And the second determining module is used for determining the parameter value for testing the target tested interface service according to the parameter value setting script.
And the fifth generation module is used for generating a test message which is adaptive to the test template and has parameter values according to the message generation script.
And the second processing module is used for processing the test result according to the result processing script.
Any of the modules, units, or at least part of the functionality of any of them according to embodiments of the present disclosure may be implemented in one module. Any one or more of the modules and units according to the embodiments of the present disclosure may be implemented by being split into a plurality of modules. Any one or more of the modules, units according to the embodiments of the present disclosure may be implemented at least partially as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented by any other reasonable means of hardware or firmware by integrating or packaging the circuits, or in any one of three implementations of software, hardware and firmware, or in any suitable combination of any of them. Alternatively, one or more of the modules, units according to embodiments of the present disclosure may be implemented at least partly as computer program modules, which, when executed, may perform the respective functions.
For example, any plurality of the first generating module 710, the first sending module 720, the second generating module 730, and the second sending module 740, or the third sending module 810, the fourth generating module 820, the fourth sending module 830, and the first presenting module 840 may be combined and implemented in one module/unit, or any one of the modules/units may be split into a plurality of modules/units. Alternatively, at least part of the functionality of one or more of these modules/units may be combined with at least part of the functionality of other modules/units and implemented in one module/unit. According to the embodiment of the present disclosure, at least one of the first generating module 710, the first sending module 720, the second generating module 730, and the second sending module 740, or the third sending module 810, the fourth generating module 820, the fourth sending module 830, and the first presenting module 840 may be at least partially implemented as a hardware circuit, for example, a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented by hardware or firmware in any other reasonable manner of integrating or packaging a circuit, or implemented by any one of three implementation manners of software, hardware, and firmware, or implemented by a suitable combination of any several of them. Alternatively, at least one of the first generating module 710, the first transmitting module 720, the second generating module 730 and the second transmitting module 740, or the third transmitting module 810, the fourth generating module 820, the fourth transmitting module 830 and the first presenting module 840 may be at least partially implemented as a computer program module which, when executed, may perform a corresponding function.
It should be noted that the interface testing apparatus portion in the embodiment of the present disclosure corresponds to the interface testing method portion in the embodiment of the present disclosure, and the description of the interface testing apparatus portion specifically refers to the interface testing method portion, which is not described herein again.
FIG. 9 schematically illustrates a block diagram of a computer system suitable for implementing the interface testing method according to an embodiment of the present disclosure. The computer system illustrated in FIG. 9 is only one example and should not impose any limitations on the scope of use or functionality of embodiments of the disclosure.
As shown in fig. 9, a computer system 900 according to an embodiment of the present disclosure includes a processor 901 which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)902 or a program loaded from a storage section 908 into a Random Access Memory (RAM) 903. Processor 901 may comprise, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or associated chipset, and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), among others. The processor 901 may also include on-board memory for caching purposes. The processor 901 may comprise a single processing unit or a plurality of processing units for performing the different actions of the method flows according to embodiments of the present disclosure.
In the RAM 903, various programs and data necessary for the operation of the system 900 are stored. The processor 901, the ROM 902, and the RAM 903 are connected to each other through a bus 904. The processor 901 performs various operations of the method flows according to the embodiments of the present disclosure by executing programs in the ROM 902 and/or the RAM 903. Note that the programs may also be stored in one or more memories other than the ROM 902 and the RAM 903. The processor 901 may also perform various operations of the method flows according to embodiments of the present disclosure by executing programs stored in the one or more memories.
System 900 may also include an input/output (I/O) interface 905, input/output (I/O) interface 905 also connected to bus 904, according to an embodiment of the present disclosure. The system 900 may also include one or more of the following components connected to the I/O interface 905: an input portion 906 including a keyboard, a mouse, and the like; an output section 907 including components such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 908 including a hard disk and the like; and a communication section 909 including a network interface card such as a LAN card, a modem, or the like. The communication section 909 performs communication processing via a network such as the internet. The drive 910 is also connected to the I/O interface 905 as necessary. A removable medium 911 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 910 as necessary, so that a computer program read out therefrom is mounted into the storage section 908 as necessary.
According to embodiments of the present disclosure, method flows according to embodiments of the present disclosure may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable storage medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 909, and/or installed from the removable medium 911. The computer program, when executed by the processor 901, performs the above-described functions defined in the system of the embodiment of the present disclosure. The systems, devices, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
The present disclosure also provides a computer-readable storage medium, which may be contained in the apparatus/device/system described in the above embodiments; or may exist separately and not be assembled into the device/apparatus/system. The computer-readable storage medium carries one or more programs which, when executed, implement the method according to an embodiment of the disclosure.
According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. Examples may include, but are not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, 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.
For example, according to embodiments of the present disclosure, a computer-readable storage medium may include the ROM 902 and/or the RAM 903 described above and/or one or more memories other than the ROM 902 and the RAM 903.
Embodiments of the present disclosure also include a computer program product comprising a computer program containing program code for performing the method provided by the embodiments of the present disclosure, when the computer program product is run on an electronic device, the program code being adapted to cause the electronic device to carry out the interface testing method provided by the embodiments of the present disclosure.
The computer program, when executed by the processor 901, performs the above-described functions defined in the system/apparatus of the embodiments of the present disclosure. The systems, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
In one embodiment, the computer program may be hosted on a tangible storage medium such as an optical storage device, a magnetic storage device, or the like. In another embodiment, the computer program may also be transmitted, distributed in the form of a signal on a network medium, and downloaded and installed through the communication section 909 and/or installed from the removable medium 911. The computer program containing program code may be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
In accordance with embodiments of the present disclosure, program code for executing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, these computer programs may be implemented using high level procedural and/or object oriented programming languages, and/or assembly/machine languages. The programming language includes, but is not limited to, programming languages such as Java, C + +, python, the "C" language, or the like. The program code may execute entirely on the user computing device, partly on the user device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions. Those skilled in the art will appreciate that various combinations and/or combinations of features recited in the various embodiments and/or claims of the present disclosure can be made, even if such combinations or combinations are not expressly recited in the present disclosure. In particular, various combinations and/or combinations of the features recited in the various embodiments and/or claims of the present disclosure may be made without departing from the spirit or teaching of the present disclosure. All such combinations and/or associations are within the scope of the present disclosure.
The embodiments of the present disclosure have been described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described separately above, this does not mean that the measures in the embodiments cannot be used in advantageous combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be devised by those skilled in the art without departing from the scope of the present disclosure, and such alternatives and modifications are intended to be within the scope of the present disclosure.

Claims (13)

1. An interface testing method, comprising:
generating a test template corresponding to a target interface service to be tested in response to a selection request aiming at the target interface service to be tested, wherein the selection request is generated by selecting the target interface service to be tested on an interface test interface of a client by a user;
sending the test template to the client so that the client generates a test message for testing the target tested interface service according to the test template;
responding to a test request containing the test message, testing the target tested interface service, and generating a serialized test result; and
and sending the test result to the client so that the client can display the test result.
2. The method of claim 1, wherein generating, in response to a selection request for a target interface under test service, a test template corresponding to the target interface under test service comprises:
determining registration information of the target tested interface service registered in a test service registration center according to the selection request, wherein the registration information comprises attribute information of the target tested interface service and an input method for information processing;
processing the attribute information by using the input class method to generate an input class instance; and
and carrying out serialization processing on the input class example to obtain the test template.
3. The method of claim 1, wherein the target dut interface service is tested in response to the test request including the test packet, and generating the serialized test result comprises:
acquiring registration information of the target tested interface service registered in a test service registration center, wherein the registration center comprises an output method for processing information;
obtaining return information obtained by testing the target tested interface service after responding to the test request;
performing deserialization processing on the return information by using the output class method to obtain an output class example; and
and carrying out serialization processing on the output class example to obtain the test result.
4. The method of claim 1, further comprising:
acquiring an auxiliary tool for the target interface service to be tested and the configuration of the system to be tested related to the target interface service to be tested; and
and registering the attribute information of the auxiliary tool to a test service registration center.
5. The method of claim 1, further comprising:
acquiring a test script with a preset format from a client, wherein the test script comprises a parameter value setting script, a message generation script and a result processing script;
determining a parameter value for testing the target tested interface service according to the parameter value setting script;
generating the test message which is adaptive to the test template and has the parameter value according to the message generation script; and
and processing the test result according to the result processing script.
6. An interface testing method, comprising:
sending a selection request aiming at a target tested interface service to a server so that the server returns a test template corresponding to the target tested interface service according to the selection request, wherein the selection request is generated by selecting the target tested interface service on an interface test interface of a client by a user, and the interface test interface comprises at least one tested interface service;
generating a test message for testing the target tested interface service according to the test template;
sending a test request containing the test message to the server so that the server returns a test result corresponding to the target tested interface service; and
and receiving the test result and displaying the test result on the client.
7. The method of claim 6, further comprising:
acquiring auxiliary information monitored by auxiliary tools configured for the target interface service to be tested and a system to be tested related to the target interface service to be tested; and
and displaying the auxiliary information to the client.
8. The method of claim 6, further comprising:
acquiring a test script with a preset format from a client, wherein the test script comprises a parameter value setting script, a message generation script and a result processing script;
determining a parameter value for testing the target tested interface service according to the parameter value setting script;
generating the test message which is adaptive to the test template and has the parameter value according to the message generation script; and
and processing the test result according to the result processing script.
9. An interface test apparatus comprising:
the device comprises a first generation module, a second generation module and a third generation module, wherein the first generation module is used for responding to a selection request aiming at a target interface service to be tested and generating a test template corresponding to the target interface service to be tested, and the selection request is generated by selecting the target interface service to be tested on an interface test interface of a client by a user;
the first sending module is used for sending the test template to the client so that the client generates a test message for testing the target tested interface service according to the test template;
the second generation module is used for responding to a test request containing the test message, testing the target tested interface service and generating a serialized test result; and
and the second sending module is used for sending the test result to the client so that the client can display the test result.
10. An interface test apparatus comprising:
a third sending module, configured to send a selection request for a target interface to be tested to a server, so that the server returns a test template corresponding to the target interface to be tested according to the selection request, where the selection request is generated when a user selects the target interface to be tested on an interface test interface of a client, where the interface test interface includes at least one interface to be tested;
a fourth generating module, configured to generate a test packet for testing the target tested interface service according to the test template;
a fourth sending module, configured to send a test request including the test packet to the server, so that the server returns a test result corresponding to the target tested interface service; and
and the first display module is used for receiving the test result and displaying the test result on the client.
11. A computer system, comprising:
one or more processors;
a memory for storing one or more programs,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any of claims 1-5 or 6-8.
12. A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to carry out the method of any one of claims 1 to 5 or 6 to 8.
13. A computer program product comprising computer executable instructions for implementing the method of any one of claims 1 to 5 or 6 to 8 when executed.
CN202110202647.2A 2021-02-23 2021-02-23 Interface test method, device, computer system and computer readable storage medium Active CN113032244B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110202647.2A CN113032244B (en) 2021-02-23 2021-02-23 Interface test method, device, computer system and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110202647.2A CN113032244B (en) 2021-02-23 2021-02-23 Interface test method, device, computer system and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN113032244A true CN113032244A (en) 2021-06-25
CN113032244B CN113032244B (en) 2024-02-02

Family

ID=76460945

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110202647.2A Active CN113032244B (en) 2021-02-23 2021-02-23 Interface test method, device, computer system and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN113032244B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113377680A (en) * 2021-07-14 2021-09-10 中国工商银行股份有限公司 Dubbo service test system and method
CN114143222A (en) * 2021-12-07 2022-03-04 无锡物联网产业研究院 Internet of things key equipment cloud testing method for typical application of smart city
CN114567571A (en) * 2022-03-14 2022-05-31 Oppo广东移动通信有限公司 Performance test method and device, electronic equipment and computer readable storage medium
CN114666258A (en) * 2022-03-22 2022-06-24 阿波罗智联(北京)科技有限公司 Interface test method, device, electronic equipment and medium
CN115695228A (en) * 2022-10-18 2023-02-03 深圳市航盛电子股份有限公司 LVDS function testing method and device, terminal device and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180032428A1 (en) * 2014-05-02 2018-02-01 Amazon Technologies, Inc. Inter-process communication automated testing framework
CN110032511A (en) * 2019-03-19 2019-07-19 深圳市买买提信息科技有限公司 A kind of interface test method and interface testing equipment
CN110716870A (en) * 2019-09-23 2020-01-21 中国建设银行股份有限公司 Automatic service testing method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180032428A1 (en) * 2014-05-02 2018-02-01 Amazon Technologies, Inc. Inter-process communication automated testing framework
CN110032511A (en) * 2019-03-19 2019-07-19 深圳市买买提信息科技有限公司 A kind of interface test method and interface testing equipment
CN110716870A (en) * 2019-09-23 2020-01-21 中国建设银行股份有限公司 Automatic service testing method and device

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113377680A (en) * 2021-07-14 2021-09-10 中国工商银行股份有限公司 Dubbo service test system and method
CN114143222A (en) * 2021-12-07 2022-03-04 无锡物联网产业研究院 Internet of things key equipment cloud testing method for typical application of smart city
CN114567571A (en) * 2022-03-14 2022-05-31 Oppo广东移动通信有限公司 Performance test method and device, electronic equipment and computer readable storage medium
CN114567571B (en) * 2022-03-14 2023-11-10 Oppo广东移动通信有限公司 Performance test method, device, electronic equipment and computer readable storage medium
CN114666258A (en) * 2022-03-22 2022-06-24 阿波罗智联(北京)科技有限公司 Interface test method, device, electronic equipment and medium
CN114666258B (en) * 2022-03-22 2023-11-07 阿波罗智联(北京)科技有限公司 Interface testing method, device, electronic equipment and medium
CN115695228A (en) * 2022-10-18 2023-02-03 深圳市航盛电子股份有限公司 LVDS function testing method and device, terminal device and storage medium
CN115695228B (en) * 2022-10-18 2024-05-14 深圳市航盛电子股份有限公司 LVDS function test method, device, terminal equipment and storage medium

Also Published As

Publication number Publication date
CN113032244B (en) 2024-02-02

Similar Documents

Publication Publication Date Title
JP7371141B2 (en) Tools and methods for real-time dataflow programming languages
CN113032244B (en) Interface test method, device, computer system and computer readable storage medium
US10318595B2 (en) Analytics based on pipes programming model
CN113778848A (en) Test code generation method, device, computer system and medium
CN111026634A (en) Interface automation test system, method, device and storage medium
CN113138757B (en) Front-end code automatic generation method, device, server, system and medium
CN115599386A (en) Code generation method, device, equipment and storage medium
CN112860584A (en) Test method and device based on workflow model
CN117632710A (en) Method, device, equipment and storage medium for generating test code
CN115221033A (en) Interface protocol testing method and device, computer readable medium and electronic equipment
CN116483888A (en) Program evaluation method and device, electronic equipment and computer readable storage medium
CN111767194A (en) Information processing method, information processing apparatus, electronic device, and medium
CN116737535A (en) Interface test method, device, computer equipment and storage medium
CN114677114A (en) Approval process generation method and device based on graph dragging
CN113138767A (en) Code language conversion method, device, electronic equipment and storage medium
CN113377648A (en) Software system diagnosis method and device, electronic equipment and computer readable medium
CN112860259B (en) Interface processing method, device, electronic equipment and storage medium
Habibi et al. Sharif-TaaWS: a tool to automate unit testing of web services
CN113515326B (en) Data conversion method, device, electronic equipment and storage medium
CN116991735A (en) Front-end component change testing system, method, device, equipment and storage medium
CN116894004A (en) Information display method and device, electronic equipment and computer readable storage medium
CN114116519A (en) Interface test method and device, electronic equipment and storage medium
CN116561751A (en) Code analysis method, apparatus, device, medium, and program product
CN113419738A (en) Interface document generation method and device and interface management equipment
CN114691527A (en) Unit test case generation method, apparatus, device, medium, and program product

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
GR01 Patent grant
GR01 Patent grant