CN107943683B - Test script generation method and device, electronic equipment and storage medium - Google Patents

Test script generation method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN107943683B
CN107943683B CN201711034946.XA CN201711034946A CN107943683B CN 107943683 B CN107943683 B CN 107943683B CN 201711034946 A CN201711034946 A CN 201711034946A CN 107943683 B CN107943683 B CN 107943683B
Authority
CN
China
Prior art keywords
script
language
user
test
receiving
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
CN201711034946.XA
Other languages
Chinese (zh)
Other versions
CN107943683A (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 Qihoo Technology Co Ltd
Original Assignee
Beijing Qihoo 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 Qihoo Technology Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201711034946.XA priority Critical patent/CN107943683B/en
Publication of CN107943683A publication Critical patent/CN107943683A/en
Application granted granted Critical
Publication of CN107943683B publication Critical patent/CN107943683B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING; 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

Abstract

The embodiment of the invention provides a test script generation method, a test script generation device, electronic equipment and a storage medium, which are applied to a test platform, wherein the test platform comprises a server and more than one test equipment, and the method comprises the following steps: determining a scripting language selected by a user and an operation set executed by the user; compiling the operation into a function according to the scripting language for each operation in the operation set; combining the functions corresponding to the operations to generate a function set; and inserting a calling statement corresponding to the script language into the function set to generate a test script. According to the test script generation scheme provided by the embodiment of the invention, a user only executes simple operation without writing codes, so that the time consumption is short, and a large amount of human resources can be saved.

Description

Test script generation method and device, electronic equipment and storage medium
Technical Field
The invention relates to the technical field of internet, in particular to a test script generation method and device, electronic equipment and a storage medium.
Background
With the development of terminal technology, the performance of terminal equipment is better and better, and therefore more and more applications begin to emerge. The user may use various applications to perform desired operations, such as playing games through a game application, playing audio and video through a video application, searching through a browser application, querying for information, and the like.
After the application program is developed and released formally on line, the application program needs to be tested, and the application program can be on line only after the test is completed and no problem exists, wherein the application program needs to be tested on terminal equipment of different models because operating systems of different terminal equipment have certain differences. In order to facilitate the application program to be tested, a test platform can be provided, the test platform provides a plurality of types of test equipment, and the server remotely controls the test equipment, so that the application program can be run on the test equipment. After the test of the application program is completed, the test equipment uploads the test result to the test platform, and the test platform distributes the result to the server for storage, so that the test is completed.
When different models of test equipment test the same application program, the applied test scripts may be different, and even the language types of the test scripts that can be executed are different. Therefore, testers need to manually write codes to generate test scripts of different language types to meet the test requirements of different models of test equipment, and the test equipment is long in time and needs to consume a large amount of human resources.
Disclosure of Invention
In view of the above, the present invention has been made to provide a test script generation method and apparatus, an electronic device, and a storage medium that overcome or at least partially solve the above-mentioned problems.
According to an aspect of the present invention, there is provided a test script generating method applied to a test platform, where the test platform includes a server and more than one test device, the method including: determining a scripting language selected by a user and an operation set executed by the user; compiling the operation into a function according to the scripting language for each operation in the operation set; combining the functions corresponding to the operations to generate a function set; and inserting a calling statement corresponding to the script language into the function set to generate a test script.
Optionally, the determining the scripting language and the operation set executed by the user includes: receiving a selection instruction of a user on a script recording interface for a script language, and determining the script language selected by the user according to the selection instruction; receiving each operation instruction executed by a user on the script recording interface; and respectively determining the operation corresponding to each operation instruction, and sequencing the operations according to the execution sequence to form an operation set.
Optionally, the receiving a selection instruction of the user for the script language on the script recording interface includes: receiving a selection instruction of a user for a language selection button displayed in a script recording interface; wherein, a script language corresponds to a selection button; or receiving a display instruction of a user for a language pull-down menu in the script recording interface, and displaying the language pull-down menu; and receiving a selection instruction of the user for the script language in the language pull-down menu.
Optionally, after the determining the scripting language selected by the user and the operation set executed by the user, the method further includes: and transmitting the script language and the operation set into a pre-created script generator so that the script generator generates a test script according to the script language and the operation set.
Optionally, the parameters corresponding to the operations in the operation set are described by a Json format.
Optionally, the scripting language includes: python, Lua and Java.
Optionally, after the inserting the call statement corresponding to the scripting language into the function set to generate the test script, the method further includes: when the test script is executed, determining the script language of the test script; and calling an engine matched with the scripting language to execute the test script.
According to another aspect of the present invention, there is provided a test script generating apparatus applied to a test platform, where the test platform includes a server and more than one test device, the apparatus including: the determining module is used for determining the script language selected by the user and the operation set executed by the user; the compiling module is used for compiling the operation into a function according to the script language aiming at each operation in the operation set; the merging module is used for merging the functions corresponding to the operations to generate a function set; and the generating module is used for inserting the calling statement corresponding to the script language into the function set to generate a test script.
Optionally, the determining module includes: the first receiving submodule is used for receiving a selection instruction of a user on a script recording interface for the script language and determining the script language selected by the user according to the selection instruction; the second receiving submodule is used for receiving each operation instruction executed by the user on the script recording interface; and the operation set determining submodule is used for respectively determining the operation corresponding to each operation instruction and sequencing the operations according to the execution sequence to form an operation set.
Optionally, when the first receiving sub-module receives a selection instruction of the script language from the user on the script recording interface, the first receiving sub-module is specifically configured to: receiving a selection instruction of a user for a language selection button displayed in a script recording interface; wherein, a script language corresponds to a selection button; or receiving a display instruction of a user for a language pull-down menu in the script recording interface, and displaying the language pull-down menu; receiving a selection instruction of a user for the script language in the language pull-down menu;
optionally, the apparatus further comprises: and the transmitting module is used for transmitting the script language and the operation set into a pre-created script generator after the determining module determines the script language selected by the user and the operation set executed by the user, so that the script generator generates a script according to the script language and the operation set.
Optionally, the parameters corresponding to the operations in the operation set are described by a Json format.
Optionally, the scripting language includes: python, Lua and Java.
Optionally, the apparatus further comprises: the execution module is used for determining the script language of the script when the script is executed; and calling an engine matched with the script language to execute the script.
In accordance with still another aspect of the present invention, there is provided an electronic apparatus including: one or more processors; and one or more machine readable media having instructions stored thereon that, when executed by the one or more processors, cause the electronic device to perform any one or more test script generation methods as described herein.
According to yet another aspect of the present invention, there is provided one or more machine-readable media having instructions stored thereon, which when executed by one or more processors, cause an electronic device to perform any one or more of the test script generation methods described herein.
According to the test script generation method and device provided by the invention, the test script of the corresponding script language can be generated according to the script language selected by the user and the operation set executed on the script recording interface when the script is recorded, the user only executes simple operation without writing codes, the time consumption is short, and a large amount of manpower resources can be saved.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a flow diagram illustrating the steps of a test script generation method according to one embodiment of the present invention;
FIG. 2 is a flow diagram illustrating steps of another test script generation method according to one embodiment of the invention;
FIG. 3 is a block diagram illustrating an embodiment of a test script generating apparatus according to the present invention;
FIG. 4 is a block diagram illustrating an embodiment of a test script generating apparatus according to an embodiment of the present invention;
FIG. 5 schematically shows a block diagram of a server for performing the method according to the invention;
fig. 6 schematically shows a storage unit for holding or carrying program code implementing a method according to the invention; and
fig. 7 is a block diagram schematically showing a partial structure related to a terminal device provided by an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
In the embodiment of the present invention, the test platform is used for testing the application program, and for example, may test an operating state, such as a stuck state and a fluency, and also test the compatibility of the application program, and also perform a UI (user interface) traversal test, and the like. The test platform comprises a server and more than one test device, wherein the server is used for managing the test devices and can determine the states of the test devices, distribute tasks, determine task results and the like. The test equipment is used for testing the application program. The server of the test platform includes various types, for example, a management server, a storage server, and the like, wherein the storage server may also include a plurality of servers, for example, a log server for storing log data, a picture server for storing picture data, and the like. There may be one or more servers for each kind of server, for example, the test platform may have one or more management servers, and different management servers may manage the same or different projects.
In the embodiment of the application, the test platform can provide various users to perform APP tests, and different users have different requirements for the tests, for example, some users are large clients and some users are small clients. The large client can also be called as a special user, the special user usually has a large number of APPs to be tested, and the special user can also have own special testing equipment connected to the testing platform, and the equipment is the special equipment of the user, so that the application test of the user is completed by the special equipment. Small customers may also be referred to as public users, who typically need a small number of APPs to be tested, do not have their own dedicated devices, but rather perform the tests through common devices provided by the test platform. No matter the special equipment or the public equipment needs the corresponding test script during testing, the test script is compiled by a tester according to the test requirement, and the compiled test script can be pushed to each test equipment by the server through the proxy server.
The embodiment of the application provides a convenient test script generation method, and testers can execute simple operation in a script recording system without manually writing test codes.
The method comprises the following specific steps:
referring to FIG. 1, a flowchart illustrating steps of a test script generation method according to an embodiment of the present invention is shown.
Step 102: a user selected scripting language and a set of operations performed by the user are determined.
The scripting language available for user selection may include, but is not limited to: python, Lua, Java and other computer languages. In the application, a tester can quickly and conveniently generate the test script through the script recording system. The script recording system can be operated on a terminal device or a server. The script recording system provides a script recording interface for a tester, the script recording interface is displayed on the script recording interface to allow the tester to select a script language according to actual requirements, meanwhile, the interface of the to-be-tested APP is also displayed, the tester manually executes operation on the control on the APP interface, and when a test script generation instruction is received, the tester forms an operation set for each operation executed by the control.
Step 104: and compiling the operation into a function according to the script language selected by the user aiming at each operation in the operation set.
Operations may include, but are not limited to: a double-click operation, a single-click operation, a slide operation, a long-press operation, or the like. A set of parameters in the script recording system that has been pre-generated for each operation in a description in Json format. The parameter set described in the Json format can be mapped to the corresponding operation through the operation, and the mapped parameter set is compiled through the script language selected by the user to obtain a function corresponding to the operation. The test script comprises a plurality of functions corresponding to the operation.
Step 106: and combining the functions corresponding to the operations to generate a function set.
Through step 104, the operations can be compiled to generate corresponding functions, and the functions corresponding to the operations are ordered according to the execution sequence of the operations.
Step 108: and inserting a calling statement corresponding to the script language selected by the user into the function set to generate a test script.
The set of execution functions may be called by calling a statement, for example: the calling statement may be a main function. After the test script is generated, the test script can be copied from the script recording system and installed on corresponding test equipment, and the test equipment can automatically execute a test task according to the test script. Or the server or the terminal device where the script recording system is located may issue to each corresponding test device, and the test device automatically executes the test task according to the test script and reports the test result to the server or the terminal device.
In conclusion, when the script recording system records the script, the test script of the corresponding script language can be generated according to the script language selected by the user and the operation set executed on the script recording interface, and the user only executes simple operation without writing codes, so that the time consumption is short, and a large amount of human resources can be saved.
Referring to FIG. 2, a flowchart of the steps of another test script generation method according to one embodiment of the present invention is shown.
Step 202: receiving a selection instruction of a user on the script recording interface to the script language, and determining the script language selected by the user according to the selection instruction.
According to the embodiment of the application, the script recording system executes the test script generation method, the script recording system can be arranged in the server or in the terminal equipment, the script recording interface is displayed after the script recording system is started, and the script recording interface comprises a user interface for a user to select a script language and an interface of an APP to be tested. The user interface for the user, i.e. the tester, to select the script language can be a plurality of buttons, and each button corresponds to one script language; the language pull-down menu can also be a language pull-down menu, and the language pull-down menu comprises a plurality of script languages for the user to select; in addition, a script language input box can be used, and a user can manually input the name of the script language according to actual requirements.
Correspondingly, when a selection instruction of the user for the script language on the script recording interface is received, the selection instruction of the user for a language selection button displayed in the script recording interface can be received; the method also can receive a display instruction of a language pull-down menu in the script recording interface from a user, and display the language pull-down menu; receiving a selection instruction of a user for the script language in the language pull-down menu; a scripting language name entered by the user in the scripting language input box may also be received.
Scripting languages may include, but are not limited to: python, Lua, Java and other computer languages. The user can select and generate the test script of any one of the computer languages according to the requirement.
Step 204: and receiving each operation instruction executed by the user on the script recording interface.
The server or the terminal equipment of the running script recording system can be connected with the intelligent terminal provided with the APP to be tested, the screen display information which is the same as the intelligent terminal is synchronously displayed in the script recording interface of the script recording system, therefore, when the APP is started on the intelligent terminal, the APP interface can be synchronously displayed on the script recording interface, a tester can execute the operation of the control on the APP interface displayed on the script recording interface, the operation is synchronized to the APP interface displayed on the intelligent terminal, the intelligent terminal carries out the operation of skipping of the APP interface according to the received operation, the closing operation and the like. The operation performed on the control on the APP interface may include, but is not limited to: single click operation, double click operation, long press operation, slide operation, or the like.
In the script recording system, a corresponding parameter set is defined for each operation in advance and is described by a Json format, that is, each operation corresponds to one parameter set described by the Json format.
Step 206: and respectively determining the operation corresponding to each operation instruction, and sequencing the operations according to the execution sequence to form an operation set.
When an operation completion instruction is received, all operations contained in the test script which needs to be generated at this time are completed, and an operation set is obtained. The parameters corresponding to each operation in the operation set are described in a Json format, and each operation corresponds to one function during testing, so that the parameters corresponding to each operation need to be compiled to generate a corresponding function, and a function set can be obtained after each operation in the operation set is compiled correspondingly.
In the specific implementation process, the script language and the operation set can be transmitted into a pre-created script generator, and the script generator generates a test script according to the script language and the operation set selected by the user. The script generator is part of a script recording system.
Step 208: and compiling the operation into a function according to the script language selected by the user aiming at each operation in the operation set.
In the script recording system, parameter sets described in a Json format are defined for each operation, and the parameter sets corresponding to the operations are compiled according to a script language selected by a user to obtain functions corresponding to the operations.
Step 210: and combining the functions corresponding to the operations to generate a function set.
When the functions are combined, the functions corresponding to the operations may be sorted and combined according to the execution order of the operations.
Step 212: and inserting a calling statement corresponding to the script language selected by the user into the function set to generate a test script.
The function set needs to be inserted with a corresponding call statement for execution, so that in the application, a call statement, such as a Main function, needs to be inserted into the function set when the test script is generated. The description modes of the calling statements are different according to different scripting languages, so that the calling statements corresponding to the scripting language selected by the user need to be determined and inserted into the function set to generate the test script.
After the test script is generated, the test script can be copied from the script recording system and installed on corresponding test equipment, and the test equipment can automatically execute a test task according to the test script. Or the server or the terminal device where the script recording system is located may issue to each corresponding test device, and the test device automatically executes the test task according to the test script and reports the test result to the server or the terminal device. When a server, terminal equipment or test equipment provided with the test script executes the test script, determining the script language of the test script; and calling an engine matched with the scripting language to execute the test script.
In conclusion, when the script recording system records the script, the test script of the corresponding script language can be generated according to the script language selected by the user and the operation set executed on the script recording interface, and the user only executes simple operation without writing codes, so that the time consumption is short, and a large amount of human resources can be saved. In addition, in the embodiment of the application, a plurality of interfaces for the testers to select the script language are provided in the script recording interface, so that the testers can operate conveniently.
For simplicity of explanation, the method embodiments are described as a series of acts or combinations, but those skilled in the art will appreciate that the embodiments are not limited by the order of acts described, as some steps may occur in other orders or concurrently with other steps in accordance with the embodiments of the invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the invention.
On the basis of the above embodiments, the present embodiment further provides a test script generating device, which is applied to a test platform, where the test platform includes a server and more than one test device.
Referring to fig. 3, a block diagram of a test script generating apparatus according to an embodiment of the present invention is shown, which may specifically include the following modules:
a determining module 302, configured to determine a scripting language selected by a user and a set of operations performed by the user;
a compiling module 304, configured to compile, for each operation in the operation set, the operation into a function according to the scripting language;
a merging module 306, configured to merge functions corresponding to the operations to generate a function set;
and the generating module 308 is configured to insert a call statement corresponding to the scripting language into the function set to generate a test script.
In summary, the test script generating device can generate the test script corresponding to the script language according to the script language selected by the user and the operation set executed on the script recording interface, and the user only executes simple operations without writing codes, thereby consuming short time and saving a large amount of human resources.
Referring to fig. 4, a block diagram of another embodiment of a test script generating apparatus according to an embodiment of the present invention is shown, which may specifically include the following modules:
a determining module 402, configured to determine a scripting language selected by a user and a set of operations performed by the user;
a compiling module 404, configured to compile, for each operation in the operation set, the operation into a function according to the scripting language;
a merging module 406, configured to merge functions corresponding to the operations to generate a function set;
a generating module 408, configured to insert a calling statement corresponding to the scripting language into the function set to generate a test script;
an importing module 410, configured to, after the determining module 402 determines a scripting language selected by a user and an operation set executed by the user, import the scripting language and the operation set into a pre-created script generator, so that the script generator generates a script according to the scripting language and the operation set;
an execution module 412, configured to determine a scripting language of the script when the script is executed; and calling an engine matched with the script language to execute the script.
Wherein the determining module 404 may include: the first receiving submodule 4042 is configured to receive a selection instruction of a user for a scripting language on the script recording interface, and determine the scripting language selected by the user according to the selection instruction; the second receiving sub-module 4044 is configured to receive each operation instruction executed by the user on the script recording interface; the operation set determining submodule 4046 is configured to determine operations corresponding to the operation instructions, and sort the operations according to the execution sequence to form an operation set.
When the first receiving submodule receives a selection instruction of a user on the script recording interface for the script language, the first receiving submodule is specifically used for: receiving a selection instruction of a user for a language selection button displayed in a script recording interface; wherein, a script language corresponds to a selection button; or receiving a display instruction of a user for a language pull-down menu in the script recording interface, and displaying the language pull-down menu; receiving a selection instruction of a user for the script language in the language pull-down menu;
and describing parameters corresponding to each operation in the operation set by a Json format.
The scripting language includes: python, Lua and Java.
In summary, when the test script generating device records the script, the test script of the corresponding script language can be generated according to the script language selected by the user and the operation set executed on the script recording interface, and the user only executes simple operations without writing codes, so that the time consumption is short, and a large amount of human resources can be saved. In addition, in the embodiment of the application, a plurality of interfaces for the testers to select the script language are provided in the script recording interface, so that the testers can operate conveniently.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
The various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functionality of some or all of the components in an electronic device according to embodiments of the present invention. The present invention may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form. The electronic devices may include servers (clusters), terminal devices, and the like.
An embodiment of the present invention provides an electronic device, including: one or more processors; and one or more machine readable media having instructions stored thereon, which when executed by the one or more processors, cause the electronic device to perform a test script generation method as described in one or more of the embodiments of the invention.
Embodiments of the invention provide one or more machine-readable media having instructions stored thereon, which when executed by one or more processors, cause an electronic device to perform a test script generation method as described in one or more of embodiments of the invention.
An example of an embodiment of the present invention provides a server, for example, fig. 5 illustrates a server, such as an application server, a cloud control service server cluster, and the like, which may implement the method for generating a test script according to the present invention. The server conventionally includes a processor 510 and a computer program product or computer-readable medium in the form of a memory 520. The memory 520 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read only memory), an EPROM, a hard disk, or a ROM. The memory 520 has a memory space 530 for program code 531 for performing any of the method steps in the method described above. For example, the storage space 530 for the program code may include respective program codes 531 for implementing various steps in the above method, respectively. The program code can be read from or written to one or more computer program products. These computer program products comprise a program code carrier such as a hard disk, a Compact Disc (CD), a memory card or a floppy disk. Such a computer program product is typically a portable or fixed storage unit as described with reference to fig. 6. The storage unit may have a storage section, a storage space, and the like arranged similarly to the memory 520 in the server of fig. 5. The program code may be compressed, for example, in a suitable form. Typically, the storage unit comprises computer readable code 531', i.e. code that can be read by a processor, such as 510, for example, which when executed by a server causes the server to perform the steps of the method described above.
In an example of the embodiment of the present invention, a terminal device, such as a terminal device for generating a test script and performing a test, is further provided, as shown in fig. 7, for convenience of description, only a part related to the embodiment of the present invention is shown, and details of the specific technology are not disclosed, please refer to a method part in the embodiment of the present invention. The terminal device may be any device including a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), a vehicle-mounted computer, and the like.
Fig. 7 is a block diagram illustrating a partial structure related to a terminal device provided in an embodiment of the present invention. Referring to fig. 7, the terminal device includes: radio Frequency (RF) circuit 710, memory 720, input unit 730, display unit 740, sensor 750, audio circuit 760, wireless fidelity (WiFi) module 770, processor 780, power supply 790 and camera 7110. Those skilled in the art will appreciate that the terminal device configuration shown in fig. 7 does not constitute a limitation of the terminal device and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The following specifically describes each constituent component of the terminal device with reference to fig. 7:
the RF circuit 710 may be used for receiving and transmitting signals during information transmission and reception or during a call, and in particular, receives downlink information of a base station and then processes the received downlink information to the processor 780; in addition, the data for designing uplink is transmitted to the base station. In general, the RF circuit 710 includes, but is not limited to, an antenna, at least one Amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like. In addition, the RF circuit 710 may also communicate with networks and other devices via wireless communication. The wireless communication may use any communication standard or protocol, including but not limited to Global System for Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), and the like.
The memory 720 may be used to store software programs and modules, and the processor 780 may execute various functional applications of the terminal device and data processing by operating the software programs and modules stored in the memory 720. The memory 720 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the terminal device, and the like. Further, the memory 720 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The input unit 730 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the terminal device. Specifically, the input unit 730 may include a touch panel 731 and other input devices 732. The touch panel 731, also referred to as a touch screen, can collect touch operations of a user (e.g. operations of the user on or near the touch panel 731 by using any suitable object or accessory such as a finger, a stylus, etc.) and drive the corresponding connection device according to a preset program. Alternatively, the touch panel 731 may include two portions of a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts it to touch point coordinates, and sends the touch point coordinates to the processor 780, and can receive and execute commands from the processor 780. In addition, the touch panel 731 may be implemented by various types, such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. The input unit 730 may include other input devices 732 in addition to the touch panel 731. In particular, other input devices 732 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 740 may be used to display information input by the user or information provided to the user and various menus of the terminal device. The Display unit 740 may include a Display panel 741, and optionally, the Display panel 741 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. Further, the touch panel 731 can cover the display panel 741, and when the touch panel 731 detects a touch operation on or near the touch panel 731, the touch operation is transmitted to the processor 780 to determine the type of the touch event, and then the processor 780 provides a corresponding visual output on the display panel 741 according to the type of the touch event. Although in fig. 7, the touch panel 731 and the display panel 741 are two independent components to implement the input and output functions of the terminal device, in some embodiments, the touch panel 731 and the display panel 741 may be integrated to implement the input and output functions of the terminal device.
The terminal device may also include at least one sensor 750, such as light sensors, motion sensors, and other sensors. Specifically, the light sensor may include an ambient light sensor that may adjust the brightness of the display panel 741 according to the brightness of ambient light, and a proximity sensor that may turn off the display panel 741 and/or a backlight when the terminal device is moved to the ear. As one of the motion sensors, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally, three axes), detect the magnitude and direction of gravity when stationary, and can be used for applications (such as horizontal and vertical screen switching, related games, magnetometer attitude calibration) for recognizing the attitude of the terminal device, and related functions (such as pedometer and tapping) for vibration recognition; as for other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which can be configured in the terminal device, detailed description is omitted here.
Audio circuitry 760, speaker 761, and microphone 762 may provide an audio interface between a user and a terminal device. The audio circuit 760 can transmit the electrical signal converted from the received audio data to the speaker 761, and the electrical signal is converted into a sound signal by the speaker 761 and output; on the other hand, the microphone 762 converts the collected sound signal into an electric signal, converts the electric signal into audio data after being received by the audio circuit 760, processes the audio data by the audio data output processor 780, and transmits the processed audio data to, for example, another terminal device via the RF circuit 710, or outputs the audio data to the memory 720 for further processing.
WiFi belongs to short-distance wireless transmission technology, and the terminal equipment can help a user to send and receive e-mails, browse webpages, access streaming media and the like through the WiFi module 770, and provides wireless broadband Internet access for the user. Although fig. 7 shows the WiFi module 770, it is understood that it does not belong to the essential constitution of the terminal device, and may be omitted entirely as needed within the scope not changing the essence of the invention.
The processor 780 is a control center of the terminal device, connects various parts of the entire terminal device using various interfaces and lines, and performs various functions of the terminal device and processes data by operating or executing software programs and/or modules stored in the memory 720 and calling data stored in the memory 720, thereby integrally monitoring the terminal device. Optionally, processor 780 may include one or more processing units; preferably, the processor 780 may integrate an application processor, which primarily handles operating systems, user interfaces, applications, etc., and a modem processor, which primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into processor 780.
The terminal device also includes a power supply 790 (e.g., a battery) for powering the various components, which may preferably be logically coupled to the processor 780 via a power management system to manage charging, discharging, and power consumption management functions via the power management system.
The camera 7110 may perform a photographing function.
Although not shown, the terminal device may further include a bluetooth module or the like, which is not described in detail herein.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.
The invention discloses a test script generating method A1, which is applied to a test platform, wherein the test platform comprises a server and more than one test device, and the method comprises the following steps:
determining a scripting language selected by a user and an operation set executed by the user;
compiling the operation into a function according to the scripting language for each operation in the operation set;
combining the functions corresponding to the operations to generate a function set;
and inserting a calling statement corresponding to the script language into the function set to generate a test script.
A2, the method of A1, wherein the determining the scripting language and the set of operations performed by the user includes:
receiving a selection instruction of a user on a script recording interface for a script language, and determining the script language selected by the user according to the selection instruction;
receiving each operation instruction executed by a user on the script recording interface;
and respectively determining the operation corresponding to each operation instruction, and sequencing the operations according to the execution sequence to form an operation set.
A3, the method according to A2, wherein the receiving of the selection instruction of the user for the script language on the script recording interface includes:
receiving a selection instruction of a user for a language selection button displayed in a script recording interface; wherein, a script language corresponds to a selection button; alternatively, the first and second electrodes may be,
receiving a display instruction of a user for a language pull-down menu in a script recording interface, and displaying the language pull-down menu; and receiving a selection instruction of the user for the script language in the language pull-down menu.
A4, the method according to A1, wherein after the determining the scripting language selected by the user and the set of operations performed by the user, the method further comprises:
and transmitting the script language and the operation set into a pre-created script generator so that the script generator generates a test script according to the script language and the operation set.
A5, the method according to A1, wherein the parameters corresponding to each operation in the operation set are described by Json format.
A6, the method of A1, wherein the scripting language includes: python, Lua and Java.
A7, the method according to A1, wherein after the inserting the call statement corresponding to the script language into the function set generates a test script, the method further comprises:
when the test script is executed, determining the script language of the test script;
and calling an engine matched with the scripting language to execute the test script.
The invention also discloses B8, a test script generating device, which is applied to a test platform, wherein the test platform comprises a server and more than one test device, and the device comprises:
the determining module is used for determining the script language selected by the user and the operation set executed by the user;
the compiling module is used for compiling the operation into a function according to the script language aiming at each operation in the operation set;
the merging module is used for merging the functions corresponding to the operations to generate a function set;
and the generating module is used for inserting the calling statement corresponding to the script language into the function set to generate a test script.
B9, the apparatus of B8, wherein the means for determining comprises:
the first receiving submodule is used for receiving a selection instruction of a user on a script recording interface for the script language and determining the script language selected by the user according to the selection instruction;
the second receiving submodule is used for receiving each operation instruction executed by the user on the script recording interface;
and the operation set determining submodule is used for respectively determining the operation corresponding to each operation instruction and sequencing the operations according to the execution sequence to form an operation set.
B10, the apparatus according to B9, wherein when the first receiving sub-module receives a selection instruction of the script language from the user on the script recording interface, the first receiving sub-module is specifically configured to:
receiving a selection instruction of a user for a language selection button displayed in a script recording interface; wherein, a script language corresponds to a selection button; alternatively, the first and second electrodes may be,
receiving a display instruction of a user for a language pull-down menu in a script recording interface, and displaying the language pull-down menu; receiving a selection instruction of a user for the script language in the language pull-down menu;
b11, the apparatus according to B8, wherein the apparatus further comprises:
and the transmitting module is used for transmitting the script language and the operation set into a pre-created script generator after the determining module determines the script language selected by the user and the operation set executed by the user, so that the script generator generates a script according to the script language and the operation set.
B12, the apparatus according to B8, wherein the parameters corresponding to each operation in the operation set are described by Json format.
B13, the apparatus of B8, wherein the scripting language includes: python, Lua and Java.
B14, the apparatus according to B8, wherein the apparatus further comprises:
the execution module is used for determining the script language of the script when the script is executed; and calling an engine matched with the script language to execute the script.
The invention also discloses, C15, an electronic device, comprising:
one or more processors; and
one or more machine-readable media having instructions stored thereon that, when executed by the one or more processors, cause the electronic device to perform a test script generation method as described in one or more of a1-a 7.
D16, one or more machine readable media having instructions stored thereon that, when executed by one or more processors, cause an electronic device to perform a test script generation method as described in one or more of a1-a 7.

Claims (16)

1. A test script generation method is applied to a test platform, wherein the test platform comprises a server and more than one test device, and the method comprises the following steps:
determining a scripting language selected by a user and an operation set executed by the user;
compiling the operation into a function according to the scripting language for each operation in the operation set;
combining the functions corresponding to the operations to generate a function set;
inserting a calling statement corresponding to the scripting language into the function set to generate a test script;
the step of compiling the operations into functions according to the scripting language for each operation in the set of operations comprises:
the script recording system generates a parameter set described in a Json format for each operation in advance, maps the operation to the corresponding parameter set described in the Json format, and compiles the mapped parameter set through the script language selected by the user to obtain a function corresponding to the operation.
2. The method of claim 1, wherein determining the scripting language and the set of operations performed by the user comprises:
receiving a selection instruction of a user on a script recording interface for a script language, and determining the script language selected by the user according to the selection instruction;
receiving each operation instruction executed by a user on the script recording interface;
and respectively determining the operation corresponding to each operation instruction, and sequencing the operations according to the execution sequence to form an operation set.
3. The method of claim 2, wherein receiving a selection instruction of the script language from the user on the script recording interface comprises:
receiving a selection instruction of a user for a language selection button displayed in a script recording interface; wherein, a script language corresponds to a selection button; alternatively, the first and second electrodes may be,
receiving a display instruction of a user for a language pull-down menu in a script recording interface, and displaying the language pull-down menu; and receiving a selection instruction of the user for the script language in the language pull-down menu.
4. The method of claim 1, after determining the user-selected scripting language and the set of operations performed by the user, further comprising:
and transmitting the script language and the operation set into a pre-created script generator so that the script generator generates a test script according to the script language and the operation set.
5. The method of claim 1, wherein parameters corresponding to each operation in the set of operations are described in Json format.
6. The method of claim 1, wherein the scripting language comprises: python, Lua and Java.
7. The method according to claim 1, further comprising, after the inserting the call statement corresponding to the scripting language into the function set generates a test script:
when the test script is executed, determining the script language of the test script;
and calling an engine matched with the scripting language to execute the test script.
8. A test script generating device applied to a test platform, wherein the test platform comprises a server and more than one test equipment, and the device comprises:
the determining module is used for determining the script language selected by the user and the operation set executed by the user;
the compiling module is used for compiling the operation into a function according to the script language aiming at each operation in the operation set;
the merging module is used for merging the functions corresponding to the operations to generate a function set;
the generating module is used for inserting the calling statement corresponding to the script language into the function set to generate a test script;
the compiling module is specifically configured to: generating a parameter set described in a Json format for each operation in advance, mapping the operation to the corresponding parameter set described in the Json format, and compiling the mapped parameter set through the script language selected by the user to obtain a function corresponding to the operation.
9. The apparatus of claim 8, wherein the determining module comprises:
the first receiving submodule is used for receiving a selection instruction of a user on a script recording interface for the script language and determining the script language selected by the user according to the selection instruction;
the second receiving submodule is used for receiving each operation instruction executed by the user on the script recording interface;
and the operation set determining submodule is used for respectively determining the operation corresponding to each operation instruction and sequencing the operations according to the execution sequence to form an operation set.
10. The apparatus according to claim 9, wherein the first receiving submodule, when receiving a selection instruction of the script language from the user on the script recording interface, is specifically configured to:
receiving a selection instruction of a user for a language selection button displayed in a script recording interface; wherein, a script language corresponds to a selection button; alternatively, the first and second electrodes may be,
receiving a display instruction of a user for a language pull-down menu in a script recording interface, and displaying the language pull-down menu; and receiving a selection instruction of the user for the script language in the language pull-down menu.
11. The apparatus of claim 8, further comprising:
and the transmitting module is used for transmitting the script language and the operation set into a pre-created script generator after the determining module determines the script language selected by the user and the operation set executed by the user, so that the script generator generates a script according to the script language and the operation set.
12. The apparatus of claim 8, wherein parameters corresponding to each operation in the set of operations are described in Json format.
13. The apparatus of claim 8, wherein the scripting language comprises: python, Lua and Java.
14. The apparatus of claim 8, further comprising:
the execution module is used for determining the script language of the script when the script is executed; and calling an engine matched with the script language to execute the script.
15. An electronic device, comprising:
one or more processors; and
one or more machine-readable media having instructions stored thereon that, when executed by the one or more processors, cause the electronic device to perform a test script generation method as recited in one or more of claims 1-7.
16. One or more machine-readable media having instructions stored thereon that, when executed by one or more processors, cause an electronic device to perform a test script generation method as recited in one or more of claims 1-7.
CN201711034946.XA 2017-10-30 2017-10-30 Test script generation method and device, electronic equipment and storage medium Active CN107943683B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711034946.XA CN107943683B (en) 2017-10-30 2017-10-30 Test script generation method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711034946.XA CN107943683B (en) 2017-10-30 2017-10-30 Test script generation method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN107943683A CN107943683A (en) 2018-04-20
CN107943683B true CN107943683B (en) 2021-07-30

Family

ID=61936692

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711034946.XA Active CN107943683B (en) 2017-10-30 2017-10-30 Test script generation method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN107943683B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109062780B (en) * 2018-06-25 2021-08-17 深圳市远行科技股份有限公司 Development method of automatic test case and terminal equipment
CN110225246B (en) * 2019-05-28 2021-07-20 北京字节跳动网络技术有限公司 Event script generation method and device, electronic equipment and computer readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101968770A (en) * 2010-11-01 2011-02-09 北京航空航天大学 Reusable embedded software testing and developing method and system
CN102306122A (en) * 2011-09-14 2012-01-04 北京星网锐捷网络技术有限公司 Automated testing method and equipment
US9317413B2 (en) * 2013-11-12 2016-04-19 Institute For Information Industry Testing device and testing method thereof
CN106326121A (en) * 2016-08-22 2017-01-11 上海亿账通互联网科技有限公司 Method for automatically generating test script and terminal
CN106874208A (en) * 2017-02-27 2017-06-20 网易(杭州)网络有限公司 The processing method of test script, device and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101968770A (en) * 2010-11-01 2011-02-09 北京航空航天大学 Reusable embedded software testing and developing method and system
CN102306122A (en) * 2011-09-14 2012-01-04 北京星网锐捷网络技术有限公司 Automated testing method and equipment
US9317413B2 (en) * 2013-11-12 2016-04-19 Institute For Information Industry Testing device and testing method thereof
CN106326121A (en) * 2016-08-22 2017-01-11 上海亿账通互联网科技有限公司 Method for automatically generating test script and terminal
CN106874208A (en) * 2017-02-27 2017-06-20 网易(杭州)网络有限公司 The processing method of test script, device and electronic equipment

Also Published As

Publication number Publication date
CN107943683A (en) 2018-04-20

Similar Documents

Publication Publication Date Title
CN108055490B (en) Video processing method and device, mobile terminal and storage medium
CN106210755B (en) A kind of methods, devices and systems playing live video
CN105404585B (en) Obtain the method and device of code coverage
CN104516812A (en) Method and device for testing software
CN108156508B (en) Barrage information processing method and device, mobile terminal, server and system
CN106231433B (en) A kind of methods, devices and systems playing network video
CN107038112B (en) Application interface debugging method and device
CN106295353B (en) Engine vulnerability detection method and detection device
CN107770596A (en) A kind of special efficacy synchronous method, device and mobile terminal
CN109062467B (en) Split screen application switching method and device, storage medium and electronic equipment
CN107943683B (en) Test script generation method and device, electronic equipment and storage medium
CN106502906B (en) A kind of method and apparatus of test application program
CN108958629B (en) Split screen quitting method and device, storage medium and electronic equipment
CN107995024A (en) A kind of device management method, device, server and storage medium
CN104102560B (en) The method and device of system performance testing
CN107943687B (en) Equipment sharing method, device, server and storage medium
CN105550316B (en) The method for pushing and device of audio list
CN108345543B (en) Data processing method, device, equipment and storage medium
CN105005529B (en) A kind of method and device that application program is tested
CN106713636B (en) Loading method, device and the mobile terminal of image data
CN106230919B (en) File uploading method and device
CN107943686A (en) A kind of test dispatching method, apparatus, server and storage medium
CN105976849B (en) A kind of method and apparatus of playing audio-fequency data
CN106228994B (en) A kind of method and apparatus detecting sound quality
CN108055567A (en) A kind of method for processing video frequency, device, terminal device 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