CN109684188B - Test method and device - Google Patents

Test method and device Download PDF

Info

Publication number
CN109684188B
CN109684188B CN201710975922.8A CN201710975922A CN109684188B CN 109684188 B CN109684188 B CN 109684188B CN 201710975922 A CN201710975922 A CN 201710975922A CN 109684188 B CN109684188 B CN 109684188B
Authority
CN
China
Prior art keywords
tested
class identifier
parameter
information
class
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.)
Active
Application number
CN201710975922.8A
Other languages
Chinese (zh)
Other versions
CN109684188A (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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201710975922.8A priority Critical patent/CN109684188B/en
Publication of CN109684188A publication Critical patent/CN109684188A/en
Application granted granted Critical
Publication of CN109684188B publication Critical patent/CN109684188B/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/3684Test management for test design, e.g. generating new test cases

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)
  • Computer And Data Communications (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application discloses a testing method and a testing device. One embodiment of the method comprises: receiving selection information of a method to be tested sent by a user; determining a method name and a parameter type of a method to be tested according to the method selection information to be tested, wherein the method to be tested is a method defined in a class corresponding to a class identifier input by the user in advance; generating parameters of the method to be tested according to the parameter type of the method to be tested; sending a test request to a server for the server to execute the method to be tested according to the test request, wherein the test request comprises the class identifier, the method name and the parameters of the method to be tested; and receiving test result information sent by the server, and displaying the test result information. The embodiment simplifies the testing steps and improves the testing efficiency.

Description

Test method and device
Technical Field
The present application relates to the field of computer technologies, and in particular, to a testing method and apparatus.
Background
The interface is a statement of a series of methods, when a tester receives a new interface or finds a problem in the test process and inspects one interface, the connectivity of the interface needs to be tested, and after the interface receives parameters with a correct format, whether the data can be processed or not is verified, and the data is returned. When testing the connectivity of the interface, a tester firstly needs to obtain an interface document, prepare test data, then set up an interface test environment, finally call the interface to be tested by using the prepared test data, and check the connectivity of a returned result verification interface. The process of preparing test data, setting up a test environment and the like consumes a great deal of time, so that the test efficiency is seriously influenced.
Disclosure of Invention
It is an object of the present application to provide an improved testing method and apparatus to solve the technical problems mentioned in the background section above.
In a first aspect, an embodiment of the present application provides a testing method, where the method includes: receiving selection information of a method to be tested sent by a user; determining a method name and a parameter type of a method to be tested according to the information selected by the method to be tested, wherein the method to be tested is a method defined in a class corresponding to a class identifier input by the user in advance; generating parameters of the method to be tested according to the parameter types of the method to be tested; sending a test request to a server for the server to execute the method to be tested according to the test request, wherein the test request comprises the class identifier, a method name and parameters of the method to be tested; and receiving the test result information sent by the server, and displaying the test result information.
In some embodiments, before the receiving user-input method selection information to be tested, the method further includes: in response to detecting the user input of the class identifier, sending the class identifier to the server; receiving a method information list sent by the server, wherein the method information list is a list of method information of methods defined in a class corresponding to the class identifier and generated by the server, and the method information comprises method names and parameter types of the methods; and displaying the method information list so that the user can input the selection information of the method to be tested based on the method information list.
In some embodiments, the generating the parameters of the method to be tested according to the parameter types of the method to be tested includes: acquiring parameter values from a preset parameter value set according to the parameter types of the method to be tested, wherein the parameter value set comprises basic data types and data sets corresponding to the basic data types; and generating the parameters of the method to be tested by using the acquired parameter values.
In a second aspect, an embodiment of the present application provides a testing method, including: receiving a test request sent by a terminal, wherein the test request comprises a class identifier, a method name and parameters of a method to be tested; executing a to-be-tested method corresponding to the method name of the to-be-tested method according to the test request to obtain an execution result, wherein the to-be-tested method is a method defined in a class corresponding to the class identifier; and sending test result information to the terminal according to the execution result so as to be displayed by the terminal.
In some embodiments, before receiving the test request sent by the terminal, the method further includes: receiving a class identifier sent by a terminal; generating a method information list according to the class identifier, wherein the method information list comprises a list of method information of methods defined in a class corresponding to the class identifier, and the method information comprises method names and parameter types of the methods; and sending the method information list to the terminal.
In some embodiments, the generating the method information list according to the class identifier includes: determining the method name and the first parameter type of each method defined in the class corresponding to the class identifier according to the class identifier; aiming at the first parameter type of each method defined in the class corresponding to the class identifier, if the first parameter type of the method is a basic data type, taking the first parameter type of the method as the parameter type of the method; if the first parameter type of the method is an object type, acquiring a basic data type corresponding to the object as the parameter type of the method; and generating a method information list by using the method name and the parameter type of the method defined in the class corresponding to the class identifier.
In a third aspect, an embodiment of the present application provides a testing apparatus, including: the receiving unit is used for receiving the to-be-tested method selection information sent by the user; a determining unit, configured to determine a method name and a parameter type of a method to be tested according to the information selected by the method to be tested, where the method to be tested is defined in a class corresponding to a class identifier input by the user in advance; the generating unit is used for generating the parameters of the method to be tested according to the parameter types of the method to be tested; a sending unit, configured to send a test request to a server, so that the server executes the method to be tested according to the test request, where the test request includes the class identifier, a method name of the method to be tested, and a parameter; and the display unit is used for receiving the test result information sent by the server and displaying the test result information.
In some embodiments, the apparatus further comprises a display unit, the display unit being configured to: in response to detecting the user input of the class identifier, sending the class identifier to the server; receiving a method information list sent by the server, wherein the method information list is a list of method information of methods defined in a class corresponding to the class identifier and generated by the server, and the method information comprises method names and parameter types of the methods; and displaying the method information list so that the user can input the selection information of the method to be tested based on the method information list.
In some embodiments, the generating unit is further configured to: acquiring parameter values from a preset parameter value set according to the parameter types of the method to be tested, wherein the parameter value set comprises basic data types and data sets corresponding to the basic data types; and generating the parameters of the method to be tested by using the acquired parameter values.
In a fourth aspect, an embodiment of the present application provides a testing apparatus, including: a request receiving unit, configured to receive a test request sent by a terminal, where the test request includes a class identifier, a method name of a method to be tested, and a parameter; a test execution unit, configured to execute a to-be-tested method corresponding to the method name of the to-be-tested method according to the test request, to obtain an execution result, where the to-be-tested method is a method defined in a class corresponding to the class identifier; and the information sending unit is used for sending the test result information to the terminal according to the execution result so as to be displayed by the terminal.
In some embodiments, the above apparatus further comprises: a class identifier receiving unit, configured to receive a class identifier sent by a terminal; a list generating unit, configured to generate a method information list according to the class identifier, where the method information list includes a list of method information of methods defined in a class corresponding to the class identifier, where the method information includes a method name and a parameter type of the method; a list transmitting unit, configured to transmit the method information list to the terminal.
In some embodiments, the list generating unit is further configured to: determining the method name and the first parameter type of each method defined in the class corresponding to the class identifier according to the class identifier; aiming at the first parameter type of each method defined in the class corresponding to the class identifier, if the first parameter type of the method is a basic data type, taking the first parameter type of the method as the parameter type of the method; if the first parameter type of the method is an object type, acquiring a basic data type corresponding to the object as the parameter type of the method; and generating a method information list by using the method name and the parameter type of the method defined in the class corresponding to the class identifier.
In a fifth aspect, an embodiment of the present application provides a terminal, where the terminal includes: one or more processors; a storage device for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the method as described in any implementation manner of the first aspect.
In a sixth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, where the computer program is characterized in that when executed by a processor, the computer program implements the method described in any implementation manner in the first aspect.
According to the testing method and the testing device provided by the embodiment of the application, the method name and the parameter type of the method to be tested are determined according to the information selected by the user to be tested, the parameter of the method to be tested is generated according to the parameter type of the method to be tested, then the testing request comprising the class identifier, the method name and the parameter of the method to be tested is sent to the server so that the server can execute the method to be tested, finally the testing result information sent by the server is received, and the testing result information is displayed.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is an exemplary system architecture diagram in which the present application may be applied;
FIG. 2 is a flow diagram of one embodiment of a testing method according to the present application;
FIG. 3 is a schematic diagram of an application scenario of a test method according to the present application;
FIG. 4 is a flow chart of yet another embodiment of a testing method according to the present application;
FIG. 5 is a schematic block diagram of one embodiment of a test apparatus according to the present application;
FIG. 6 is a schematic structural diagram of yet another embodiment of a testing device according to the present application;
fig. 7 is a schematic structural diagram of a computer system suitable for implementing a terminal device according to an embodiment of the present application.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1 shows an exemplary system architecture 100 to which embodiments of the testing method or testing apparatus of the present application may be applied.
As shown in fig. 1, the system architecture 100 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, wireless communication links, or fiber optic cables, to name a few.
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 client applications installed thereon, such as a web browser application, a shopping-like application, a search-like application, an instant messaging tool, a mailbox client, social platform software, and the like.
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting information display, including but not limited to smart phones, tablet computers, electronic book readers, MP3 players (Moving Picture Experts Group Audio Layer III, mpeg compression standard Audio Layer 3), MP4 players (Moving Picture Experts Group Audio Layer IV, mpeg compression standard Audio Layer 4), laptop portable computers, desktop computers, and the like.
The server 105 may be a server that provides various services, for example, executes a method to be tested according to a test request sent by the terminal devices 101, 102, 103, and feeds back test result information to the terminal devices 101, 102, 103 according to the execution result.
It should be noted that the testing method provided by the embodiment corresponding to fig. 2 of the present application is generally executed by the terminal devices 101, 102, and 103, and accordingly, the testing apparatus in fig. 5 is generally disposed in the terminal devices 101, 102, and 103; the testing method provided by the embodiment corresponding to fig. 4 is generally executed by the server 105, and accordingly, the testing apparatus in fig. 6 is generally disposed in the server 105.
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.
With continued reference to FIG. 2, a flow 200 of one embodiment of a testing method according to the present application is shown. The test method comprises the following steps:
step 201, receiving the selection information of the method to be tested sent by the user.
In this embodiment, the electronic device (for example, the terminal devices 101, 102, and 103 shown in fig. 1) on which the test method operates may receive the to-be-tested method selection information sent by the user, where the to-be-tested method selection information is used to select the to-be-tested method defined in the to-be-tested interface. The to-be-tested method selection information may be sent by a user in various manners, for example, the to-be-tested method selection information may be sent by a manner that the user directly inputs information such as a method name of the to-be-tested method on the electronic device, or may be sent by a manner that the user selects information such as a method name of the to-be-tested method pre-displayed on the electronic device. The user may be a tester.
Step 202, determining the method name and the parameter type of the method to be tested according to the method selection information to be tested.
In this embodiment, the electronic device may determine a method name and a parameter type of a method to be tested according to the to-be-tested method selection information, where the to-be-tested method is defined in a class corresponding to the class identifier input in advance by the user. Here, the class corresponding to the class identifier may be a JAVA bean, and the JAVA bean is a reusable component written in JAVA language. The parameter types of the method to be tested may be basic data types.
And step 203, generating parameters of the method to be tested according to the parameter types of the method to be tested.
In this embodiment, the electronic device may generate the parameters of the method to be tested in various manners (e.g., randomly generated) according to the types of the parameters of the method to be tested.
In some optional implementations of this embodiment, step 203 may specifically include:
first, the electronic device may obtain a parameter value from a preset parameter value set according to a parameter type of the method to be tested, where the parameter value set may include a basic data type and a data set corresponding to the basic data type. The electronic device may store a parameter value set in advance, where the parameter value set may include basic data types, such as boolean (boolean), byte (byte), character (char), double precision (double), floating point (float), integer (int), long integer (long), and short integer (short), and each basic data type stores a data set correspondingly. The electronic device may obtain (e.g., randomly obtain) parameter values from the corresponding data sets according to the parameter types of the methods to be tested. For example, if the parameter type of the method to be tested is integer, the electronic device may randomly obtain a parameter value of the integer from the data set corresponding to the integer.
Then, the electronic device may further generate a parameter of the method to be tested using the obtained parameter value. For example, the electronic device may assemble the obtained parameter values into a json (JavaScript Object Notation) format to form complete parameters.
Step 204, sending a test request to the server for the server to execute the method to be tested according to the test request.
In this embodiment, the electronic device may send a test request to a server in a wired connection manner or a wireless connection manner, where the server is a server where a method to be tested is located. The test request may include a class identifier, a method name of the method to be tested, and a parameter. It should be noted that the wireless connection means may include, but is not limited to, a 3G/4G connection, a WiFi connection, a bluetooth connection, a WiMAX connection, a Zigbee connection, a uwb (ultra wideband) connection, and other wireless connection means now known or developed in the future.
And step 205, receiving the test result information sent by the server, and displaying the test result information.
In this embodiment, the electronic device may receive the test result information sent by the server, and display the test result information for a user to view. The test result information may be "pass", "fail", or the like, which is used to prompt the user of the test result.
In some optional implementations of this embodiment, before step 201, the electronic device may further perform the following operations:
firstly, in response to detecting that a user inputs a class identifier, sending the class identifier to the server;
then, the electronic device may receive a method information list sent by the server, where the method information list may be a list of method information of methods defined in a class corresponding to the class identifier, where the method information may include a method name and a parameter type of the method, and the list is generated by the server;
finally, the electronic device can display the method information list so that a user can input the selection information of the method to be tested based on the method information list. For example, the user may input the method selection information to be tested by clicking.
With continued reference to fig. 3, fig. 3 is a schematic diagram of an application scenario of the test method according to the present embodiment. In the application scenario of fig. 3, a user first sends to the terminal device 301 the method selection information to be tested; then, the terminal device 301 determines the method name and the parameter type of the method to be tested according to the method selection information to be tested; then, the terminal device 301 generates a parameter of the method to be tested according to the type of the parameter of the method to be tested; secondly, the terminal device 301 sends a test request to the server 302, and the server 302 executes a method to be tested according to the test request to obtain an execution result; finally, the server 302 sends test result information obtained according to the execution result to the terminal device 301, and displays the test result information for the user to view.
The method provided by the embodiment of the application can automatically generate the parameters of the method to be tested, and a test environment is not required to be set up in the test process, so that the test steps are simplified, and the test efficiency is improved.
With further reference to fig. 4, a flow 400 of yet another embodiment of a testing method is shown. The process 400 of the test method includes the following steps:
step 401, receiving a test request sent by a terminal.
In this embodiment, an electronic device (for example, the server 105 shown in fig. 1) on which the test method operates may receive a test request sent by a terminal through a wired connection manner or a wireless connection manner, where the test request may include a class identifier, a method name and parameters of the method to be tested.
In some optional implementations of this embodiment, before step 401, the electronic device may further perform the following operations: first, the electronic device may receive a class identifier sent by a terminal, and according to the class identifier, the electronic device may locate a specific class and obtain an instance of the class. Then, the electronic device may generate a method information list according to the class identifier, where the method information list may include a list of method information of methods defined in a class corresponding to the class identifier, and the method information may include a method name and a parameter type of the method. Finally, the electronic device may send the method information list to the terminal for the terminal to display.
In some optional implementation manners, the generating the method information list according to the class identifier may specifically include:
first, the electronic device may determine, according to the class identifier, a method name and a first parameter type of each method defined in a class corresponding to the class identifier, where the first parameter type may be a basic data type or a reference data type (e.g., an object), and here, the electronic device may first obtain, by using a reflection mechanism, a method name of each method defined in the class corresponding to the class identifier, and then obtain, by using a reflection mechanism, the first parameter type of each method according to the method name of each method defined in the class corresponding to the class identifier.
Then, aiming at the first parameter type of each method defined in the class corresponding to the class identifier, if the first parameter type of the method is a basic data type, taking the first parameter type of the method as the parameter type of the method; if the first parameter type of the method is the object type, the basic data type corresponding to the object is obtained as the parameter type of the method, for example, when the first parameter type of the method is the object type, the electronic device may recursively obtain the attribute type of the object until the basic data type corresponding to the object is obtained.
Finally, the electronic device may generate a method information list using the method name and the parameter type of the method defined in the class corresponding to the class identifier.
Step 402, executing the to-be-tested method corresponding to the method name of the to-be-tested method according to the test request to obtain an execution result.
In this embodiment, the electronic device may execute the method to be tested corresponding to the method name of the method to be tested according to the test request received in step 401, to obtain an execution result, where the execution result may include an abnormal occurrence and an abnormal non-occurrence. Here, the method to be tested may be a method defined in a class corresponding to the class identifier, and the electronic device may first locate a specific class according to the class identifier in the test request, then further locate a corresponding method to be tested from the methods defined in the located class according to a method name of the method to be tested in the test request, and finally call the method to be tested through a parameter of the method to be tested in the test request.
And 403, sending test result information to the terminal according to the execution result for the terminal to display.
In this embodiment, the electronic device may send test result information to the terminal according to the execution result of step 402 for the terminal to display, for example, when the execution result is that an exception occurs, the electronic device may send "failed" test result information to the terminal, and when the execution result is that the exception does not occur, the electronic device may send "passed" test result information to the terminal.
As can be seen from fig. 4, the flow 400 of the testing method in this embodiment executes the method to be tested according to the test request sent by the terminal to obtain the execution result, so that a tester is not required to set up a testing environment, thereby simplifying the testing steps and improving the testing efficiency.
With further reference to fig. 5, as an implementation of the method shown in fig. 2, the present application provides an embodiment of a testing apparatus, which corresponds to the embodiment of the method shown in fig. 2, and which can be applied to various electronic devices.
As shown in fig. 5, the test apparatus 500 of the present embodiment includes: a receiving unit 501, a determining unit 502, a generating unit 503, a sending unit 504 and a presenting unit 505. The receiving unit 501 is configured to receive test method selection information sent by a user; the determining unit 502 is configured to determine a method name and a parameter type of a method to be tested according to the information selected by the method to be tested, where the method to be tested is defined in a class corresponding to a class identifier input by the user in advance; the generating unit 503 is configured to generate a parameter of the method to be tested according to the type of the parameter of the method to be tested; the sending unit 504 is configured to send a test request to a server, so that the server executes the method to be tested according to the test request, where the test request includes the class identifier, a method name of the method to be tested, and a parameter; the display unit 505 is configured to receive the test result information sent by the server, and display the test result information.
In this embodiment, specific processing of the receiving unit 501, the determining unit 502, the generating unit 503, the sending unit 504 and the displaying unit 505 of the testing apparatus 500 and technical effects thereof may refer to related descriptions of step 201, step 202, step 203, step 204 and step 205 in the corresponding embodiment of fig. 2, which are not repeated herein.
In some optional implementations of this embodiment, the apparatus 500 may further include a display unit (not shown in the figure), and the display unit is configured to: in response to detecting the user input of the class identifier, sending the class identifier to the server; receiving a method information list sent by the server, wherein the method information list is a list of method information of methods defined in a class corresponding to the class identifier and generated by the server, and the method information comprises method names and parameter types of the methods; and displaying the method information list so that the user can input the selection information of the method to be tested based on the method information list.
In some optional implementations of this embodiment, the generating unit 503 may be further configured to: acquiring parameter values from a preset parameter value set according to the parameter types of the method to be tested, wherein the parameter value set comprises basic data types and data sets corresponding to the basic data types; and generating the parameters of the method to be tested by using the acquired parameter values.
With further reference to fig. 6, as an implementation of the method shown in fig. 4, the present application provides an embodiment of a testing apparatus, which corresponds to the embodiment of the method shown in fig. 4, and which can be applied to various electronic devices.
As shown in fig. 6, the test apparatus 600 of the present embodiment includes: a request receiving unit 601, a test execution unit 602, and an information transmitting unit 603. The request receiving unit 601 is configured to receive a test request sent by a terminal, where the test request includes a class identifier, a method name of a method to be tested, and a parameter; the test execution unit 602 is configured to execute a to-be-tested method corresponding to the method name of the to-be-tested method according to the test request, so as to obtain an execution result, where the to-be-tested method is a method defined in a class corresponding to the class identifier; the information sending unit 603 is configured to send test result information to the terminal according to the execution result, so that the terminal can display the test result information.
In this embodiment, specific processing of the request receiving unit 601, the test executing unit 602, and the information sending unit 603 of the testing apparatus 600 and technical effects thereof can refer to related descriptions of step 401, step 402, and step 403 in the corresponding embodiment of fig. 4, which are not described herein again.
In some optional implementations of this embodiment, the apparatus 600 may further include: a class identifier receiving unit (not shown in the figure) for receiving the class identifier transmitted by the terminal; a list generating unit (not shown in the figure) configured to generate a method information list according to the class identifier, where the method information list includes a list of method information of methods defined in a class corresponding to the class identifier, where the method information includes a method name and a parameter type of the method; a list transmitting unit (not shown in the figure) for transmitting the method information list to the terminal.
In some optional implementations of this embodiment, the list generating unit may be further configured to: determining the method name and the first parameter type of each method defined in the class corresponding to the class identifier according to the class identifier; aiming at the first parameter type of each method defined in the class corresponding to the class identifier, if the first parameter type of the method is a basic data type, taking the first parameter type of the method as the parameter type of the method; if the first parameter type of the method is an object type, acquiring a basic data type corresponding to the object as the parameter type of the method; and generating a method information list by using the method name and the parameter type of the method defined in the class corresponding to the class identifier.
Referring now to FIG. 7, shown is a block diagram of a computer system 700 suitable for use in implementing a terminal device of an embodiment of the present application. The terminal device shown in fig. 7 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 7, the computer system 700 includes a Central Processing Unit (CPU)701, which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM) 702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. In the RAM 703, various programs and data necessary for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An Input/Output (I/O) interface 705 is also connected to the bus 704.
The following components are connected to the I/O interface 705: an input portion 706 including a keyboard, a mouse, and the like; an output section 707 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and a speaker; a storage section 708 including a hard disk and the like; and a communication section 709 including a Network interface card such as a LAN (Local Area Network) card, a modem, or the like. The communication section 709 performs communication processing via a network such as the internet. A drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read out therefrom is mounted into the storage section 708 as necessary.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts 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 medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 709, and/or installed from the removable medium 711. The computer program, when executed by a Central Processing Unit (CPU)701, performs the above-described functions defined in the method of the present application. It should be noted that the computer readable medium described herein can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, 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), an optical fiber, 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 application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
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 application. 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 and/or flowchart illustration, and combinations of blocks in the block diagrams and/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.
The units described in the embodiments of the present application may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes a receiving unit, a determining unit, a generating unit, a transmitting unit, and a presenting unit. The names of the units do not form a limitation to the unit itself under certain conditions, and for example, the receiving unit may also be described as a unit for receiving the method selection information to be tested sent by the user.
As another aspect, the present application also provides a computer-readable medium, which may be contained in the apparatus described in the above embodiments; or may be present separately and not assembled into the device. The computer readable medium carries one or more programs which, when executed by the apparatus, cause the apparatus to: receiving selection information of a method to be tested sent by a user; determining a method name and a parameter type of a method to be tested according to the information selected by the method to be tested, wherein the method to be tested is a method defined in a class corresponding to a class identifier input by the user in advance; generating parameters of the method to be tested according to the parameter types of the method to be tested; sending a test request to a server for the server to execute the method to be tested according to the test request, wherein the test request comprises the class identifier, a method name and parameters of the method to be tested; and receiving the test result information sent by the server, and displaying the test result information.
The above description is only a preferred embodiment of the application and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention herein disclosed is not limited to the particular combination of features described above, but also encompasses other arrangements formed by any combination of the above features or their equivalents without departing from the spirit of the invention. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.

Claims (14)

1. A method of testing, the method comprising:
receiving selection information of a method to be tested sent by a user;
determining a method name and a parameter type of a method to be tested according to the selection information of the method to be tested, wherein the method to be tested is a method defined in a class corresponding to a class identifier input by the user in advance, the selection information of the method to be tested is selected from a method information list by the user, and the method information list is generated by a server according to the class identifier;
generating parameters of the method to be tested according to the parameter type of the method to be tested;
sending a test request to the server, so that the server executes the method to be tested according to the test request, wherein the test request comprises the class identifier, the method name and the parameters of the method to be tested;
and receiving test result information sent by the server, and displaying the test result information.
2. The method of claim 1, wherein prior to said receiving user input of method selection information to be tested, said method further comprises:
in response to detecting user input of the class identifier, sending the class identifier to the server;
receiving a method information list sent by the server, wherein the list of method information of the method defined in the class corresponding to the class identifier comprises a method name and a parameter type of the method;
and displaying the method information list so that the user can input the selection information of the method to be tested based on the method information list.
3. The method of claim 1, wherein generating the parameters of the method to be tested according to the parameter types of the method to be tested comprises:
acquiring parameter values from a preset parameter value set according to the parameter type of the method to be tested, wherein the parameter value set comprises a basic data type and a data set corresponding to the basic data type;
and generating parameters of the method to be tested by using the acquired parameter values.
4. A method of testing, the method comprising:
generating a method information list according to the class identifier sent by the terminal so that the terminal determines the method name and the parameter type of the method to be tested according to the method selection information to be tested selected by the user from the method information list;
receiving a test request sent by the terminal, wherein the test request comprises a class identifier, a method name of a method to be tested and parameters, and the parameters are generated by the terminal according to the parameter type of the method to be tested;
executing a to-be-tested method corresponding to the method name of the to-be-tested method according to the test request to obtain an execution result, wherein the to-be-tested method is a method defined in a class corresponding to the class identifier;
and sending test result information to the terminal according to the execution result so as to be displayed by the terminal.
5. The method of claim 4, wherein before receiving the test request sent by the terminal, the method further comprises:
receiving a class identifier sent by a terminal;
generating a method information list according to the class identifier, wherein the method information list comprises a list of method information of methods defined in a class corresponding to the class identifier, and the method information comprises method names and parameter types of the methods;
and sending the method information list to the terminal.
6. The method of claim 5, wherein generating the list of method information according to the class identifier comprises:
determining the method name and the first parameter type of each method defined in the class corresponding to the class identifier according to the class identifier;
aiming at the first parameter type of each method defined in the class corresponding to the class identifier, if the first parameter type of the method is a basic data type, taking the first parameter type of the method as the parameter type of the method; if the first parameter type of the method is an object type, acquiring a basic data type corresponding to the object as the parameter type of the method;
and generating a method information list by using the method name and the parameter type of the method defined in the class corresponding to the class identifier.
7. A test apparatus, the apparatus comprising:
the receiving unit is used for receiving the to-be-tested method selection information sent by the user;
the determining unit is used for determining the method name and the parameter type of the method to be tested according to the selection information of the method to be tested, wherein the method to be tested is a method defined in a class corresponding to the class identifier input by the user in advance, the selection information of the method to be tested is selected from a method information list by the user, and the method information list is generated by the server according to the class identifier;
the generating unit is used for generating the parameters of the method to be tested according to the parameter types of the method to be tested;
a sending unit, configured to send a test request to the server, so that the server executes the method to be tested according to the test request, where the test request includes the class identifier, a method name of the method to be tested, and a parameter;
and the display unit is used for receiving the test result information sent by the server and displaying the test result information.
8. The apparatus of claim 7, further comprising a display unit to:
in response to detecting user input of the class identifier, sending the class identifier to the server;
receiving a method information list sent by the server, wherein the method information list is a list of method information of methods defined in a class corresponding to the class identifier and generated by the server, and the method information comprises method names and parameter types of the methods;
and displaying the method information list so that the user can input the selection information of the method to be tested based on the method information list.
9. The apparatus of claim 7, wherein the generating unit is further configured to:
acquiring parameter values from a preset parameter value set according to the parameter type of the method to be tested, wherein the parameter value set comprises a basic data type and a data set corresponding to the basic data type;
and generating parameters of the method to be tested by using the acquired parameter values.
10. A test apparatus, the apparatus comprising:
the list generating unit is used for generating a method information list according to the class identifier sent by the terminal so that the terminal determines the method name and the parameter type of the method to be tested according to the method selection information to be tested selected by the user from the method information list;
a request receiving unit, configured to receive a test request sent by the terminal, where the test request includes a class identifier, a method name of a method to be tested, and a parameter, and the parameter is generated by the terminal according to a parameter type of the method to be tested;
the test execution unit is used for executing the to-be-tested method corresponding to the method name of the to-be-tested method according to the test request to obtain an execution result, wherein the to-be-tested method is a method defined in the class corresponding to the class identifier;
and the information sending unit is used for sending test result information to the terminal according to the execution result so as to be displayed by the terminal.
11. The apparatus according to claim 10, wherein the method information list comprises a list of method information of methods defined in a class corresponding to the class identifier, wherein the method information comprises method names and parameter types of the methods; and
the device further comprises:
a class identifier receiving unit, configured to receive a class identifier sent by a terminal;
a list transmitting unit for transmitting the method information list to the terminal.
12. The apparatus of claim 11, wherein the list generating unit is further configured to:
determining the method name and the first parameter type of each method defined in the class corresponding to the class identifier according to the class identifier;
aiming at the first parameter type of each method defined in the class corresponding to the class identifier, if the first parameter type of the method is a basic data type, taking the first parameter type of the method as the parameter type of the method; if the first parameter type of the method is an object type, acquiring a basic data type corresponding to the object as the parameter type of the method;
and generating a method information list by using the method name and the parameter type of the method defined in the class corresponding to the class identifier.
13. A terminal, comprising:
one or more processors;
a storage device for storing one or more programs,
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-3.
14. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-3.
CN201710975922.8A 2017-10-19 2017-10-19 Test method and device Active CN109684188B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710975922.8A CN109684188B (en) 2017-10-19 2017-10-19 Test method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710975922.8A CN109684188B (en) 2017-10-19 2017-10-19 Test method and device

Publications (2)

Publication Number Publication Date
CN109684188A CN109684188A (en) 2019-04-26
CN109684188B true CN109684188B (en) 2022-04-12

Family

ID=66182895

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710975922.8A Active CN109684188B (en) 2017-10-19 2017-10-19 Test method and device

Country Status (1)

Country Link
CN (1) CN109684188B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110618927A (en) * 2019-06-20 2019-12-27 北京无限光场科技有限公司 Method and apparatus for testing applications
CN110716877A (en) * 2019-09-30 2020-01-21 拉扎斯网络科技(上海)有限公司 Automatic test method, device, computer system and readable storage medium
CN113138912B (en) * 2020-01-17 2023-09-22 北京京东振世信息技术有限公司 Interface testing method and system, client and server
CN111563035B (en) * 2020-04-22 2023-05-12 腾讯科技(成都)有限公司 Test result display method, device, equipment and storage medium
CN111752834A (en) * 2020-06-24 2020-10-09 京东数字科技控股有限公司 Automatic testing method and device
CN112037861A (en) * 2020-09-15 2020-12-04 中国科学院微生物研究所 Method and device for processing microorganism information analysis result, electronic device and medium
CN117118962B (en) * 2023-07-25 2024-03-22 领悦数字信息技术有限公司 Method and system for deploying user methods across multiple cloud platforms

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001265594A (en) * 2000-03-15 2001-09-28 Nippon Telegr & Teleph Corp <Ntt> Program function managing device, function managing method and recording medium with program for performing the method recorded thereon
CN104731566A (en) * 2013-12-19 2015-06-24 华为软件技术有限公司 Testing device, method and system for IDE (Integrated Development Environment)
CN106021112A (en) * 2016-05-31 2016-10-12 腾讯科技(深圳)有限公司 Program testing system, method and device
CN107239392A (en) * 2016-03-29 2017-10-10 腾讯科技(深圳)有限公司 A kind of method of testing, device and terminal

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001265594A (en) * 2000-03-15 2001-09-28 Nippon Telegr & Teleph Corp <Ntt> Program function managing device, function managing method and recording medium with program for performing the method recorded thereon
CN104731566A (en) * 2013-12-19 2015-06-24 华为软件技术有限公司 Testing device, method and system for IDE (Integrated Development Environment)
CN107239392A (en) * 2016-03-29 2017-10-10 腾讯科技(深圳)有限公司 A kind of method of testing, device and terminal
CN106021112A (en) * 2016-05-31 2016-10-12 腾讯科技(深圳)有限公司 Program testing system, method and device

Also Published As

Publication number Publication date
CN109684188A (en) 2019-04-26

Similar Documents

Publication Publication Date Title
CN109684188B (en) Test method and device
WO2018223717A1 (en) Webpage front-end testing method, device, system, apparatus and readable storage medium
CN110708346B (en) Information processing system and method
CN109992498B (en) Test case generation method and system and computer system
CN111209202A (en) Terminal application testing method and device
CN110232091B (en) Method, system and apparatus for synchronizing data
CN112597047A (en) Test method, test device, electronic equipment and computer readable medium
CN109582317B (en) Method and apparatus for debugging hosted applications
CN107305528B (en) Application testing method and device
CN109656799B (en) Test method and device
CN111752834A (en) Automatic testing method and device
CN114840379A (en) Log generation method, device, server and storage medium
CN107368407B (en) Information processing method and device
CN107229565B (en) Test method and device
CN108959102B (en) Method and device for generating test data and testing application to be tested
CN113515462A (en) Method, device, equipment and storage medium for testing
CN112954056A (en) Monitoring data processing method and device, electronic equipment and storage medium
CN110489326B (en) IDS-based HTTPAPI debugging method device, medium and equipment
CN111813685A (en) Automatic testing method and device
CN109144864B (en) Method and device for testing window
CN107562629B (en) Method and device for testing
CN112131092A (en) Page debugging method and device
CN113407229B (en) Method and device for generating offline scripts
CN115203178A (en) Data quality inspection method and device, electronic equipment and storage medium
CN114625458A (en) Page data processing method and device, electronic equipment and storage medium

Legal Events

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