CN115757110A - Automatic testing method and device and electronic equipment - Google Patents

Automatic testing method and device and electronic equipment Download PDF

Info

Publication number
CN115757110A
CN115757110A CN202211411359.9A CN202211411359A CN115757110A CN 115757110 A CN115757110 A CN 115757110A CN 202211411359 A CN202211411359 A CN 202211411359A CN 115757110 A CN115757110 A CN 115757110A
Authority
CN
China
Prior art keywords
test
automatic
remote
preset
operation function
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211411359.9A
Other languages
Chinese (zh)
Inventor
吴国锋
黄智勇
赵大平
王涛
李茜
孙嘉明
王琪
孙前方
王翼
董津
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Winning Health Technology Group Co Ltd
Original Assignee
Winning Health Technology Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Winning Health Technology Group Co Ltd filed Critical Winning Health Technology Group Co Ltd
Priority to CN202211411359.9A priority Critical patent/CN115757110A/en
Publication of CN115757110A publication Critical patent/CN115757110A/en
Pending legal-status Critical Current

Links

Images

Abstract

The application provides an automatic testing method, an automatic testing device and electronic equipment, and relates to the technical field of computers. The method comprises the following steps: receiving a remote test request sent by a test control device, wherein the remote test request comprises: the name of the automatic operation function and the test parameters; determining an automatic operation function from an automatic operation function library by adopting a remote service program according to the name of the automatic operation function; calling a preset test interface by adopting a remote service program, sending an automatic operation function and test parameters to an automatic test tool, executing the automatic operation function by the automatic test tool according to the test parameters to test the application program to be tested, and supporting different programming languages by a preset automatic test framework and the automatic test tool; and receiving the test result of the application program to be tested by adopting the remote service program, and sending the test result to the test control equipment. The method and the device can realize cross-language communication between the automatic test framework and the automatic test tool, and complete automatic test.

Description

Automatic testing method and device and electronic equipment
Technical Field
The invention relates to the technical field of computers, in particular to an automatic testing method and device and electronic equipment.
Background
In the automatic test, a tester needs to select a host language to compile an automatic test framework, and control an automatic test tool to test an application program to be tested.
If the automated testing tool is designed by adopting a host language different from that of the automated testing framework, the automated testing framework can be developed only by replacing the host language, or the cross-language access is realized by utilizing an external interface of the host language.
However, changing the host language of the automated test framework requires the automated test framework developer to learn a new programming language, and all test frameworks need to be rewritten, resulting in increased test costs. The host language of the external interface provided by the automated testing tool may not be called by the host language of the automated testing framework, and the cross-language automated testing cannot be realized.
Disclosure of Invention
The present invention is directed to provide an automated testing method, an automated testing device, and an electronic apparatus, so as to implement cross-language communication between an automated testing framework and an automated testing tool, thereby completing an automated testing.
In order to achieve the above purpose, the embodiments of the present application adopt the following technical solutions:
in a first aspect, an embodiment of the present application provides an automated testing method, which is applied to a remote device, and the method includes:
receiving a remote test request sent by a test control device, wherein the remote test request comprises: the remote test request is sent to the remote equipment where the remote service program corresponding to the preset remote calling address is located by the test control equipment by adopting a preset automatic test frame according to the preset remote calling address;
determining an automatic operation function from a preset automatic operation function library by adopting the remote service program according to the automatic operation function name;
calling a preset test interface by adopting the remote service program, and sending the automatic operation function and the test parameters to an automatic test tool corresponding to the preset test interface, so that the automatic test tool executes the automatic operation function according to the test parameters to test a preset application program to be tested; the preset automatic test framework and the automatic test tool respectively support different programming languages;
receiving a test result of the application program to be tested, returned by the automatic test tool through the preset test interface, by adopting the remote service program;
and sending the test result of the application program to be tested to the test control equipment.
Optionally, before receiving the remote test request sent by the test control device, the method further includes:
adopting a preset remote service program library to establish the remote service program;
registering an operation function library corresponding to the preset test interface to the remote service program to generate the automatic operation function library;
and starting the remote service program to generate the preset remote calling address.
Optionally, registering the operation function library corresponding to the preset test interface in the remote service program, and generating the automation operation function library includes:
and acquiring the operation function library from a library file corresponding to the preset test interface by adopting a registration function, writing operation functions in the operation function library and generating the automatic operation function library.
Optionally, the test parameters include: and the application program identification to be tested and the function test content are used for enabling the automatic test tool to execute the automatic operation function according to the function test content and testing the application program to be tested corresponding to the application program identification to be tested.
In a second aspect, an embodiment of the present application further provides an automated testing method, which is applied to test control equipment, and the method includes:
executing a preset automatic test case by adopting a preset automatic test framework, and acquiring an automatic operation function name and test parameters corresponding to the automatic test case;
adopting the preset automatic test framework, sending a remote test request to remote equipment where a remote service program corresponding to a preset remote call address is located according to the preset remote call address, wherein the remote test request comprises: the automation function name and the test parameters; the remote test request is used for enabling the remote equipment to call a preset test interface by adopting the remote service program, and sending an automatic operation function corresponding to the automatic operation function name and the test parameters to an automatic test tool corresponding to the preset test interface, so that the automatic test tool executes the automatic operation function according to the test parameters to test a preset application program to be tested; the preset automatic test framework and the automatic test tool respectively support different programming languages;
and adopting the preset automatic test frame, receiving a test result of the application program to be tested, which is returned by the remote equipment, wherein the test result of the application program to be tested is that the remote equipment adopts the remote service program, and receiving a test result of the application program to be tested, which is returned by the automatic test tool adopting the preset test interface.
Optionally, before executing the preset automated test case by using the preset automated test framework, the method further includes:
and acquiring a remote calling address of the remote service program from the remote equipment in a mode of presetting a remote function library of the preset automatic test framework.
Optionally, before the preset automated test frame is adopted and the preset automated test case is executed, the method further includes:
receiving input test keywords by adopting the preset automatic test framework; the test key includes: the automation function name and the test parameters;
and generating the automatic test case according to the automatic operation function name and the test parameters.
In a third aspect, an embodiment of the present application further provides an automatic testing apparatus, which is applied to a remote device, and the apparatus includes:
a test request receiving module, configured to receive a remote test request sent by a test control device, where the remote test request includes: the remote test request is sent to the remote equipment where the remote service program corresponding to the preset remote calling address is located by the test control equipment by adopting a preset automatic test frame according to the preset remote calling address;
the operation function determining module is used for determining an automatic operation function from a preset automatic operation function library by adopting the remote service program according to the automatic operation function name;
the test content sending module is used for calling a preset test interface by adopting the remote service program, sending the automatic operation function and the test parameters to an automatic test tool corresponding to the preset test interface, and enabling the automatic test tool to execute the automatic operation function according to the test parameters to test a preset application program to be tested; the preset automatic test framework and the automatic test tool respectively support different programming languages;
the test result acquisition module is used for receiving a test result of the application program to be tested, which is returned by the automatic test tool by adopting the preset test interface, by adopting the remote service program;
and the test result sending module is used for sending the test result of the application program to be tested to the test control equipment.
Optionally, the apparatus further comprises:
the service program creating module is used for creating the remote service program by adopting a preset remote service program library;
the operation function registration module is used for registering an operation function library corresponding to the preset test interface to the remote service program to generate the automatic operation function library;
and the calling address generating module is used for starting the remote service program and generating the preset remote calling address.
Optionally, the operation function registration module is specifically configured to obtain the operation function library from a library file corresponding to the preset test interface by using a registration function, and write an operation function in the operation function library to generate the automatic operation function library.
Optionally, the test parameters include: and the to-be-tested application program identifier and the function test content are used for enabling the automatic test tool to execute the automatic operation function according to the function test content and test the to-be-tested application program corresponding to the to-be-tested application program identifier.
In a fourth aspect, an embodiment of the present application further provides an automatic testing apparatus, which is applied to test control equipment, and the apparatus includes:
the test content acquisition module is used for executing a preset automatic test case by adopting a preset automatic test framework and acquiring an automatic operation function name and test parameters corresponding to the automatic test case;
the test request sending module is used for sending a remote test request to remote equipment where a remote service program corresponding to a preset remote calling address is located according to the preset remote calling address by adopting the preset automatic test framework, and the remote test request comprises: the automation function name and the test parameters; the remote test request is used for enabling the remote equipment to call a preset test interface by adopting the remote service program, and sending an automatic operation function corresponding to the automatic operation function name and the test parameters to an automatic test tool corresponding to the preset test interface, so that the automatic test tool tests a preset application program to be tested according to the execution of the automatic operation function; the preset automatic test framework and the automatic test tool respectively support different programming languages;
and the test result receiving module is used for adopting the preset automatic test framework to receive the test result of the application program to be tested returned by the remote equipment, wherein the test result of the application program to be tested is that the remote equipment adopts the remote service program to receive the test result of the application program to be tested returned by the preset test interface adopted by the automatic test tool.
Optionally, the apparatus further comprises:
and the calling address acquisition module is used for acquiring the remote calling address of the remote service program from the remote equipment in a mode of adopting a preset remote function library of the preset automatic test framework.
Optionally, the apparatus further comprises:
the keyword receiving module is used for receiving the input test keywords by adopting the preset automatic test framework; the test key includes: the automation function name and the test parameters;
and the test case generation module is used for generating the automatic test case according to the name of the automatic operation function and the test parameters.
In a fifth aspect, an embodiment of the present application further provides an electronic device, including: a processor, a storage medium and a bus, the storage medium storing program instructions executable by the processor, the processor and the storage medium communicating via the bus when the electronic device is running, the processor executing the program instructions to perform the steps of the automated testing method according to any one of the first aspect or the steps of the automated testing method according to any one of the second aspect.
In a sixth aspect, embodiments of the present application further provide a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to perform the steps of the automated testing method according to any one of the first aspect or the steps of the automated testing method according to any one of the second aspect.
The beneficial effect of this application is:
the application provides an automatic test method, an automatic test device and electronic equipment, wherein an automatic operation function is determined from an automatic operation function library through a remote service program, and the automatic operation function is sent to an automatic test tool, so that the automatic test tool controls an application program to be tested to execute the automatic operation function, an automatic test framework indirectly calls the automatic test tool through a remote service program in a cross-language mode, and the automatic test of the application program to be tested is completed; and moreover, the automatic test case is compiled by using the automatic test framework, and the compiling of the GUI automatic test case aiming at the application program to be tested can be simplified by combining with an automatic test tool indirectly called by a remote service program, so that the complexity and difficulty of the automatic test are reduced, and the execution efficiency of the automatic test is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
Fig. 1 is a schematic structural diagram of an automated test system according to an embodiment of the present disclosure;
fig. 2 is a first schematic flowchart of an automated testing method according to an embodiment of the present disclosure;
fig. 3 is a schematic flowchart illustrating an automated testing method according to an embodiment of the present application;
fig. 4 is a schematic flowchart of a third automated testing method according to an embodiment of the present disclosure;
fig. 5 is a schematic flowchart of an automated testing method according to an embodiment of the present application;
FIG. 6 is a first schematic structural diagram of an automatic test apparatus according to an embodiment of the present disclosure;
FIG. 7 is a second schematic structural diagram of an automatic test apparatus according to an embodiment of the present disclosure;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention.
Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Furthermore, the terms "first," "second," and the like in the description and in the claims, as well as in the drawings, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in other sequences than those illustrated or described herein. Moreover, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that the features of the embodiments of the present application may be combined with each other without conflict.
Before describing the automated testing method, the automated testing device, and the electronic device provided in the embodiments of the present application in detail, an application scenario of the embodiments of the present application is introduced. The automatic testing Framework aimed at by the embodiment of the application is Robot Framework, and the automatic testing tool aimed at by the embodiment of the application is Ranorex.
The Robot Framework is a functional automation test Framework written based on a Python language, has good expandability, supports Remote invocation of a Python self-defined class library and a Remote Procedure scheduling Protocol (RPC), and can simultaneously test various types of clients or interfaces.
The Ranorex is a Graphical User Interface (GUI) automatic testing tool developed by C #. Net language, can support automatic testing of web, winform, IOS and Android application programs, provides an Api Interface to support users to write C #, ironpython codes for calling, and realizes extensible automatic testing.
And calling an API (application programming interface) of Ranorex through an automatic test Framework of the Robot Framework, so that the GUI automatic test of the application program can be realized. However, because the Robot Framework and the automation test case are written by the Python language, and the Ranorex is developed by the Net language, the Python language cannot analyze and call the application program developed by the Net language, the Robot Framework cannot directly call the API of the Ranorex to realize the GUI automation test.
In order to solve the technical problems in the prior art, embodiments of the present application provide a remote service program, where a Robot Framework calls a remote service program, and the remote service program calls an API interface of a Ranorex, so as to implement an automated GUI test.
Referring to fig. 1, a schematic structural diagram of an automated testing system according to an embodiment of the present disclosure is shown in fig. 1, where the automated testing system may include: the test control device 10 and the remote device 20, the test control device 10 being communicatively connected to the remote device 20.
The automatic testing system comprises a testing control device 10, a remote device 20, an automatic testing case, a remote service program, an automatic testing tool and an application program to be tested, wherein the automatic testing frame is built on the testing control device 10, the automatic testing case can be compiled through the automatic testing frame, the remote service program, the automatic testing tool and the application program to be tested are installed on the remote device 20, the remote service program is used for enabling the testing control device 10 to indirectly call a preset testing interface of the automatic testing tool and send a testing request to the automatic testing tool, and the automatic testing tool is used for carrying out GUI (graphical user interface) automatic testing on the application program to be tested. It should be noted that the remote device 20 is generally a terminal device to be tested.
On the basis of the automatic test system, the embodiment of the application aims to provide an automatic test method which is applied to remote equipment in the automatic test system. Referring to fig. 2, a first flowchart of an automated testing method according to an embodiment of the present application is shown, and as shown in fig. 2, the method may include:
s11: receiving a remote test request sent by a test control device, wherein the remote test request comprises: and the remote test request is sent to the remote equipment where the remote service program corresponding to the preset remote calling address is located by adopting a preset automatic test framework according to the preset remote calling address by the test control equipment.
In this embodiment, the test control device sends a remote test request to the remote device where the remote service program is located according to the preset remote call address of the remote service program by executing the automated test case compiled by using the preset automated test framework.
After receiving the remote test request, the remote equipment calls the remote service program, analyzes the remote test request and determines an automation operation function name and test parameters included in the remote test request, wherein the automation operation function name in the remote test request is a keyword of GUI automation test needing to be executed on the application program to be tested and compiled in an automation test case, and the test parameters are parameters needed by executing the automation operation function.
S12: and determining an automatic operation function from a preset automatic operation function library by adopting a remote service program according to the name of the automatic operation function.
In this embodiment, an automation operation function library is created in advance in the remote service program, the automation operation function library includes a plurality of automation operation actions that can be executed by the application program to be tested under the control of the automation test tool, and the remote service program determines the corresponding automation operation function from the automation operation function library according to the name of the automation operation function carried in the remote test request.
S13: calling a preset test interface by adopting a remote service program, and sending an automatic operation function and test parameters to an automatic test tool corresponding to the preset test interface, so that the automatic test tool executes the automatic operation function according to the test parameters to test a preset application program to be tested; the preset automatic test framework and the automatic test tool respectively support different programming languages.
In this embodiment, the preset test interface is an interface provided by the automated test tool and externally available for calling, the preset test interface uses a programming language the same as that of the automated test tool, and since the preset automated test framework on the test control device and the automated test framework on the remote device use different programming languages, the preset automated test framework cannot directly call the interface of the automated test tool, but the programming language used by the remote service program provided in this embodiment may communicate with the preset automated test framework, or call a predictive test interface provided by the programming language based on the automated test tool.
And after the remote service program determines the automatic operation function, calling a preset test interface of the automatic test tool, sending the automatic operation function and the test parameters to the automatic test tool, and executing the automatic test function by the automatic test tool according to the test parameters aiming at the application program to be tested in the remote equipment to complete the automatic test aiming at the application program to be tested.
In a possible implementation manner, the operation to be tested of the application program to be tested, which is compiled in the automatic test case, may be composed of a plurality of sub-operations, each automatic operation function in the automatic operation function library may also be composed of a plurality of operation sub-functions, after the remote service program determines an automatic operation function, the automatic operation function is split into a plurality of operation sub-functions, the remote service program sequentially sends the plurality of operation sub-functions to the automatic test tool through a preset test interface, and after the automatic test tool executes each operation sub-function for the application program to be tested, the remote service program sends the next operation sub-function.
In an example, the operation of testing the application program to be tested written in the automatic test case is a login test operation, and the login test operation includes: inputting an account number sub-operation, inputting a codon operation and confirming a login sub-operation, wherein the login test operation function comprises the following steps: the remote service program sequentially sends the input account number operation subfunction, the input password operation subfunction and the login confirmation operation subfunction to an automatic test tool through a preset test interface, and the automatic test tool sequentially executes an automatic test process of inputting an account number, an input password and login confirmation aiming at an application program to be tested.
It should be noted that, if there is a failure of the automated testing tool to execute one operation sub-function for the application program to be tested, the remote service program does not send the next operation sub-function any more.
In one possible implementation, the test parameters include: and the application program identification to be tested and the function test content are used for enabling the automatic test tool to execute an automatic operation function according to the function test content and testing the application program to be tested corresponding to the application program identification to be tested.
In this embodiment, the remote device includes multiple applications to be tested, and the automatic test case is used to instruct to test at least one application to be tested, so when sending the remote test request, an identifier of the application to be tested needs to be carried, and in addition, for a test action that needs to be executed by inputting relevant information in the application, functional test content needs to be input in the remote test program, so that the automatic test tool selects a target application to be tested from the multiple applications to be tested according to the identifier of the application to be tested, and executes an automatic operation function on the target application to be tested according to the functional test content.
For example, if the test operation is a login test operation, the functional test content may include a login account number and a login password.
In some embodiments, when the remote service program sequentially sends the plurality of operation subfunctions, the functional test contents corresponding to the operation subfunctions are sent to the automatic test tool together.
S14: and receiving a test result of the application program to be tested, which is returned by the automatic test tool through the preset test interface, by adopting the remote service program.
In this embodiment, after the automated testing tool completes an automated testing process for the application program to be tested, the testing result is sent to the remote service program of the remote device through the preset testing interface. Generally, the test results include: and the application program to be tested executes the test log generated when the automatic test function is executed.
S15: and sending the test result of the application program to be tested to the test control equipment.
In this embodiment, because the automated testing framework and the automated testing tool cannot communicate directly, the automated testing tool cannot send the test result of the application program to be tested to the testing control device where the automated testing framework is located, and also needs to send the test result of the application program to be tested to the testing control device through the remote device.
In a possible implementation manner, if there are a plurality of test control devices sending remote test requests to the remote device, the remote service program may process the plurality of remote test requests in parallel, or process the plurality of remote test requests sequentially according to the time of receiving the remote test requests.
According to the automatic testing method provided by the embodiment, the automatic operation function is determined from the automatic operation function library through the remote service program, and the automatic operation function is sent to the automatic testing tool, so that the automatic testing tool controls the application program to be tested to execute the automatic operation function, the automatic testing framework indirectly calls the automatic testing tool through the remote service program in a cross-language manner, and the automatic testing of the application program to be tested is completed; and moreover, the automatic test case is compiled by utilizing the automatic test framework, and the compiling of the GUI automatic test case aiming at the application program to be tested can be simplified by combining with an automatic test tool indirectly called by a remote service program, so that the complexity and the difficulty of automatic test are reduced, and the execution efficiency of the automatic test is improved.
One implementation of creating a remote service is described in detail below in conjunction with FIG. 3.
Referring to fig. 3, a second flowchart of an automated testing method according to an embodiment of the present application is shown, as shown in fig. 3, before receiving a remote testing request sent by a testing control device, the method may further include:
s21: and creating the remote service program by adopting a preset remote service program library.
In this embodiment, a preset remote service program library provides a remote service program creating method, a development framework provided by the remote service program library is adopted, so that a remote service program can be created, and when the remote service program is created, a remote call address needs to be set for the remote service program, so that other devices can access the remote service program through the remote call address.
For example, the preset remote service library may be a simplexlrpcserver library, and the program for creating the remote service based on the development framework provided by the simplexlrpcserver library may be: stoppable XMLRPCserver (192.168.137.9, int (8270)), where (192.168.137.9, int (8270)) is used to define the address of the created remote service.
In some embodiments, the Ironpython language is used for creating the remote service program for the automation test Framework being Robot Framework and the automation test tool being Ranorex. The Ironpython language is a Python language implemented on the Net, so that the Robot Framework based on the Python language can communicate with a remote service program, and the remote service program can also access the Ranorex based on the Net language through a preset test interface of the Ranorex.
S22: and registering the operation function library corresponding to the preset test interface to the remote service program to generate an automatic operation function library.
In this embodiment, for an operation function library that can be called through a preset test interface in an automatic test tool, an automatic operation function is generated by writing a function in the operation function library, and the automatic operation function is registered in a remote service program to generate an automatic operation function library of the remote service program.
In a possible implementation manner, the registering an operation function library corresponding to the preset test interface in the remote service program to generate an automation operation function library may include:
and acquiring an operation function library from a library file corresponding to a preset test interface by adopting a registration function, and compiling the operation function in the operation function library to generate an automatic operation function library.
In this embodiment, a library file of a function that can be called by the automatic test tool through the preset test interface is obtained, where the library file includes a library function for the automatic test tool to execute a test action, and the test action may include: the method comprises the following steps of mouse operation, keyboard operation, application program opening operation, application program closing operation and the like, wherein the library function comprises a plurality of operation functions, and an automatic operation function for performing GUI (graphical user interface) automatic test on the application program to be tested can be written according to the plurality of operation functions in the library function.
It should be noted that, the compiling of the automation operation function for the remote service program may be determined according to the test requirements of the automation test case, and if the automation test case needs to perform the login test on the application program to be tested, the operation functions corresponding to the multiple operation actions are obtained from the library function according to the multiple operation actions corresponding to the login test, the operation functions corresponding to the multiple operation actions are compiled into the automation operation function, and finally, the library file containing the multiple automation operation functions is registered in the user function of the remote service program.
For example, writing a GUI operation function calling a Ranorex API using the Ironpython language may include: and (3) quoting a library file Ranorex.core.dll of the Ranorex API, introducing a library function of the Ranorex API from the library file, calling a GUI operation function of the Ranorex API, and writing an automatic operation function. After the automatic operation function is generated, a register _ function registration function is adopted to register the library files of the plurality of compiled automatic operation functions into a user function of the remote service program.
S23: and starting a remote service program to generate a preset remote calling address.
In this embodiment, after the remote service program is successfully created, the remote service program needs to be run in the remote device, so that it is ensured that the remote service program can provide a function of indirectly accessing the automated testing tool for the testing control device. And generating a preset remote calling address of the remote service program by starting the remote service program. For example, according to the remote calling address of the remote service program set when the remote service program is created, after the remote service program is started, the remote calling address of the remote service program is: 8270, such as: http:// 192.168.137.9.
In the automated testing method provided by the embodiment, the remote service program is created, the automated operation function library of the remote service program is generated by registering according to the operation library function of the preset testing interface of the automated testing tool, and the remote service program is started to generate the preset remote calling address, so that the automated testing framework can indirectly call the automated testing tool through the remote service program, execute the automated testing function, and complete the automated testing of the application program to be tested.
One implementation of the automatic test method performed by the test control device is described in detail below with reference to fig. 4.
Referring to fig. 4, a third flowchart of an automated testing method provided in the embodiment of the present application is shown, and as shown in fig. 4, the method may include:
s31: and executing a preset automatic test case by adopting a preset automatic test framework, and acquiring an automatic operation function name and test parameters corresponding to the automatic test case.
In this embodiment, an automated test framework is built in the test control device, and an automated test case is compiled based on the automated test framework, where the automated test case includes an automation operation function name and test parameters for performing automated testing on an application program to be tested. And acquiring the name of the automation operation function and the test parameters from the automation test case by executing the automation test case.
In a possible implementation manner, before the preset automated test framework is adopted and the preset automated test case is executed, the method may further include:
and acquiring a remote calling address of the remote service program from the remote equipment by adopting a mode of presetting a remote function library of the automatic test framework.
In this embodiment, in order to call the remote service program, a remote call address provided externally by the remote service program needs to be determined, a preset remote function library is introduced into a preset automated test framework, and the remote call address of the remote service program is acquired through the preset remote function library.
For example, for the Robot Framework, a remote invocation address of the remote server can be introduced in a remoting library manner.
One implementation of creating an automated test case is described in detail below in conjunction with FIG. 5.
Referring to fig. 5, a fourth flowchart of the automated testing method provided in the embodiment of the present application is shown, as shown in fig. 5, before the step S31 of using a preset automated testing framework to execute a preset automated testing case, the method may further include:
s41: receiving input test keywords by adopting a preset automatic test framework; the test key includes: automation function names and test parameters.
S42: and generating an automatic test case according to the automatic operation function name and the test parameters.
In this embodiment, the preset automated testing framework may be driven by a keyword, and an automated testing case may be generated by inputting a testing keyword in the preset automated testing framework, thereby simplifying the compiling of the automated testing case. The test key may include an automation function name and test parameters.
The name of the automation operation function can be determined according to the automation operation function contained in the remote service program, and the test parameters can include: the application program identifier to be tested and the functional test content may be, for example: login account number, login password and the like.
S32: adopting and predetermineeing automatic test frame, according to predetermineeing remote call address, send remote test request to the remote equipment that the remote service procedure that predetermines remote call address corresponds is located, remote test request includes: the name of the automatic operation function and the test parameters; the remote test request is used for enabling the remote equipment to call a preset test interface by adopting a remote service program, and sending an automatic operation function and test parameters corresponding to the automatic operation function name to an automatic test tool corresponding to the preset test interface, so that the automatic test tool executes the automatic operation function according to the test parameters to test a preset application program to be tested; the preset automatic test framework and the automatic test tool respectively support different programming languages.
In this embodiment, the test control device obtains a preset remote call address of the remote service program, and uses a preset automated test framework to send a remote test request to the remote device where the remote service program is located according to the preset remote call address, and after receiving the remote test request, the remote device calls the remote service program to access a preset test interface of the automated test tool, and sends an automated operation function and test parameters to the automated test tool, and the automated test tool executes the automated test function according to the test parameters for the application program to be tested in the remote device, thereby completing the automated test for the application program to be tested. For a specific process, reference may be made to the above S12 to S13, which is not described herein again.
S33: and receiving a test result of the application program to be tested, which is returned by the remote equipment, by adopting a preset automatic test framework, wherein the test result of the application program to be tested is that the remote equipment adopts a remote service program, and receiving the test result of the application program to be tested, which is returned by the automatic test tool adopting a preset test interface.
In this embodiment, after the automated testing tool completes the automated testing, the testing result is returned to the remote service program, and the remote service program forwards the testing result to the testing control device, where specific steps may refer to S14 to S15, and this embodiment is not described herein again.
In the automated testing method provided in the above embodiment, the test control device sends the remote test request to the remote service program based on the automated test framework, and the remote service program sends the automated operation function to the automated testing tool, so that the automated testing tool controls the application program to be tested to execute the automated operation function, thereby implementing that the automated testing framework indirectly calls the automated testing tool through the remote service program across languages, and completing the automated testing of the application program to be tested; and moreover, the automatic test case is compiled by using the automatic test framework, and the compiling of the GUI automatic test case aiming at the application program to be tested can be simplified by combining with an automatic test tool indirectly called by a remote service program, so that the complexity and difficulty of the automatic test are reduced, and the execution efficiency of the automatic test is improved.
On the basis of the above embodiments, the embodiments of the present application further provide an automatic testing apparatus, which is applied to a remote device. Referring to fig. 6, a first structural schematic diagram of an automatic testing apparatus according to an embodiment of the present application is shown in fig. 6, where the apparatus includes:
a test request receiving module 11, configured to receive a remote test request sent by a test control device, where the remote test request includes: the remote test request is sent to remote equipment where a remote service program corresponding to a preset remote calling address is located by adopting a preset automatic test frame for test control equipment according to the preset remote calling address;
an operation function determining module 12, configured to determine an automation operation function from a preset automation operation function library according to the name of the automation operation function by using a remote service program;
the test content sending module 13 is configured to call a preset test interface by using a remote service program, and send an automation operation function and test parameters to an automation test tool corresponding to the preset test interface, so that the automation test tool executes the automation operation function according to the test parameters to test a preset application program to be tested; the system comprises a preset automatic test framework, an automatic test tool and a control module, wherein the preset automatic test framework and the automatic test tool respectively support different programming languages;
the test result acquisition module 14 is configured to receive, by using a remote service program, a test result of the application program to be tested, which is returned by the automated test tool using the preset test interface;
and the test result sending module 15 is configured to send the test result of the application program to be tested to the test control device.
Optionally, the apparatus further comprises:
the service program creating module is used for creating a remote service program by adopting a preset remote service program library;
the operation function registration module is used for registering an operation function library corresponding to the preset test interface to the remote service program to generate an automatic operation function library;
and the calling address generating module is used for starting the remote service program and generating a preset remote calling address.
Optionally, the operation function registration module is specifically configured to obtain an operation function library from a library file corresponding to the preset test interface by using a registration function, and write an operation function in the operation function library to generate an automatic operation function library.
Optionally, the test parameters include: and the application program identification to be tested and the function test content are used for enabling the automatic test tool to execute the automatic operation function according to the function test content and testing the application program to be tested corresponding to the application program identification to be tested.
On the basis of the above embodiments, the embodiments of the present application further provide an automatic testing apparatus, which is applied to test control equipment. Referring to fig. 7, a second schematic structural diagram of an automated testing apparatus according to an embodiment of the present application is shown in fig. 7, where the apparatus includes:
the test content obtaining module 21 is configured to execute a preset automatic test case by using a preset automatic test framework, and obtain an automation operation function name and test parameters corresponding to the automatic test case;
the test request sending module 22 is configured to send, by using a preset automated test framework, a remote test request to a remote device where a remote service program corresponding to a preset remote invocation address is located according to the preset remote invocation address, where the remote test request includes: the name of the automatic operation function and the test parameters; the remote test request is used for enabling the remote equipment to call a preset test interface by adopting a remote service program, and sending an automatic operation function and test parameters corresponding to the automatic operation function name to an automatic test tool corresponding to the preset test interface, so that the automatic test tool tests a preset application program to be tested according to the execution of the automatic operation function; the system comprises a preset automatic test framework, an automatic test tool and a control module, wherein the preset automatic test framework and the automatic test tool respectively support different programming languages;
and the test result receiving module 23 is configured to receive, by using the preset automatic test framework, a test result of the application program to be tested, which is returned by the remote device, where the test result of the application program to be tested is that the remote device uses the remote service program, and receives a test result of the application program to be tested, which is returned by the automatic test tool using the preset test interface.
Optionally, the apparatus further comprises:
and the call address acquisition module is used for acquiring a remote call address of the remote service program from the remote equipment in a mode of presetting a remote function library of the automatic test framework.
Optionally, the apparatus further comprises:
the keyword receiving module is used for receiving input test keywords by adopting a preset automatic test framework; the test key includes: the name of the automatic operation function and the test parameters;
and the test case generation module is used for generating the automatic test case according to the name of the automatic operation function and the test parameters.
The above-mentioned apparatus is used for executing the method provided by the foregoing embodiment, and the implementation principle and technical effect are similar, which are not described herein again.
These above modules may be one or more integrated circuits configured to implement the above methods, such as: one or more Application Specific Integrated Circuits (ASICs), or one or more microprocessors, or one or more Field Programmable Gate Arrays (FPGAs), etc. For another example, when one of the above modules is implemented in the form of a Processing element scheduler code, the Processing element may be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
Referring to fig. 8, which is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure, as shown in fig. 8, the electronic device 100 includes: a processor 101, a storage medium 102 and a bus, the storage medium 102 storing program instructions executable by the processor 101, the processor 101 communicating with the storage medium 102 via the bus when the electronic device 100 is running, the processor 101 executing the program instructions to perform method embodiments as applied to a remote device, or to perform method embodiments as applied to a test control device, as described above. The specific implementation and technical effects are similar, and are not described herein again.
Optionally, the present invention also provides a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method embodiments as applied to a remote device, or the method embodiments as applied to a test control device. The specific implementation and technical effects are similar, and are not described herein again.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer-readable storage medium. The software functional unit is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) or a processor (in english: processor) to execute some steps of the methods according to the embodiments of the present invention. And the aforementioned storage medium includes: a U disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily think of the changes or substitutions within the technical scope of the present invention, and shall cover the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. An automated testing method, applied to a remote device, the method comprising:
receiving a remote test request sent by a test control device, wherein the remote test request comprises: the remote test request is sent to the remote equipment where the remote service program corresponding to the preset remote calling address is located by the test control equipment by adopting a preset automatic test frame according to the preset remote calling address;
determining an automatic operation function from a preset automatic operation function library by adopting the remote service program according to the automatic operation function name;
calling a preset test interface by adopting the remote service program, and sending the automatic operation function and the test parameters to an automatic test tool corresponding to the preset test interface, so that the automatic test tool executes the automatic operation function according to the test parameters to test a preset application program to be tested; the preset automatic test framework and the automatic test tool respectively support different programming languages;
receiving a test result of the application program to be tested, returned by the automatic test tool by adopting the preset test interface, by adopting the remote service program;
and sending the test result of the application program to be tested to the test control equipment.
2. The method of claim 1, wherein prior to receiving the remote test request sent by the test control device, the method further comprises:
adopting a preset remote service program library to create the remote service program;
registering an operation function library corresponding to the preset test interface to the remote service program to generate the automatic operation function library;
and starting the remote service program to generate the preset remote calling address.
3. The method of claim 2, wherein the registering the operation function library corresponding to the preset test interface with the remote service program to generate the automatic operation function library comprises:
and acquiring the operation function library from the library file corresponding to the preset test interface by adopting a registration function, writing the operation function in the operation function library and generating the automatic operation function library.
4. The method of claim 1, wherein the test parameters comprise: and the application program identification to be tested and the function test content are used for enabling the automatic test tool to execute the automatic operation function according to the function test content and testing the application program to be tested corresponding to the application program identification to be tested.
5. An automated testing method is applied to test control equipment, and comprises the following steps:
executing a preset automatic test case by adopting a preset automatic test framework, and acquiring an automatic operation function name and test parameters corresponding to the automatic test case;
adopting the preset automatic test framework, sending a remote test request to remote equipment where a remote service program corresponding to a preset remote calling address is located according to the preset remote calling address, wherein the remote test request comprises: the automation function name and the test parameters; the remote test request is used for enabling the remote equipment to call a preset test interface by adopting the remote service program, and sending an automatic operation function corresponding to the automatic operation function name and the test parameters to an automatic test tool corresponding to the preset test interface, so that the automatic test tool executes the automatic operation function according to the test parameters to test a preset application program to be tested; the preset automatic test framework and the automatic test tool respectively support different programming languages;
and adopting the preset automatic test framework to receive the test result of the application program to be tested returned by the remote equipment, wherein the test result of the application program to be tested is that the remote equipment adopts the remote service program to receive the test result of the application program to be tested returned by the automatic test tool adopting the preset test interface.
6. The method of claim 5, wherein prior to executing the predetermined automated test case using the predetermined automated test framework, the method further comprises:
and acquiring a remote calling address of the remote service program from the remote equipment in a mode of presetting a remote function library of the automatic testing framework.
7. The method of claim 5, wherein prior to executing the predetermined automated test case using the predetermined automated test framework, the method further comprises:
receiving input test keywords by adopting the preset automatic test framework; the test key includes: the automation function name and the test parameters;
and generating the automatic test case according to the automatic operation function name and the test parameters.
8. An automated testing apparatus for use with remote devices, the apparatus comprising:
a test request receiving module, configured to receive a remote test request sent by a test control device, where the remote test request includes: the remote test request is sent to the remote equipment where the remote service program corresponding to the preset remote calling address is located by the test control equipment by adopting a preset automatic test frame according to the preset remote calling address;
the operation function determining module is used for determining an automatic operation function from a preset automatic operation function library by adopting the remote service program according to the automatic operation function name;
the test content sending module is used for calling a preset test interface by adopting the remote service program, sending the automatic operation function and the test parameters to an automatic test tool corresponding to the preset test interface, and enabling the automatic test tool to execute the automatic operation function according to the test parameters to test a preset application program to be tested; the preset automatic test framework and the automatic test tool respectively support different programming languages;
the test result acquisition module is used for receiving a test result of the application program to be tested, which is returned by the automatic test tool through the preset test interface, by adopting the remote service program;
and the test result sending module is used for sending the test result of the application program to be tested to the test control equipment.
9. An automated testing device, applied to test control equipment, the device comprising:
the test content acquisition module is used for executing a preset automatic test case by adopting a preset automatic test framework and acquiring an automatic operation function name and test parameters corresponding to the automatic test case;
the test request sending module is used for sending a remote test request to remote equipment where a remote service program corresponding to a preset remote calling address is located according to the preset remote calling address by adopting the preset automatic test framework, and the remote test request comprises: the automation function name and the test parameters; the remote test request is used for enabling the remote equipment to call a preset test interface by adopting the remote service program, and sending an automatic operation function corresponding to the automatic operation function name and the test parameters to an automatic test tool corresponding to the preset test interface, so that the automatic test tool tests a preset application program to be tested according to the execution of the automatic operation function; the preset automatic test framework and the automatic test tool respectively support different programming languages;
and the test result receiving module is used for adopting the preset automatic test framework to receive the test result of the application program to be tested returned by the remote equipment, wherein the test result of the application program to be tested is that the remote equipment adopts the remote service program to receive the test result of the application program to be tested returned by the preset test interface adopted by the automatic test tool.
10. An electronic device, comprising: a processor, a storage medium and a bus, the storage medium storing program instructions executable by the processor, the processor and the storage medium communicating via the bus when the electronic device is running, the processor executing the program instructions to perform the steps of the automated testing method according to any one of claims 1 to 4, or to perform the steps of the automated testing method according to any one of claims 5 to 7.
CN202211411359.9A 2022-11-11 2022-11-11 Automatic testing method and device and electronic equipment Pending CN115757110A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211411359.9A CN115757110A (en) 2022-11-11 2022-11-11 Automatic testing method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211411359.9A CN115757110A (en) 2022-11-11 2022-11-11 Automatic testing method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN115757110A true CN115757110A (en) 2023-03-07

Family

ID=85369543

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211411359.9A Pending CN115757110A (en) 2022-11-11 2022-11-11 Automatic testing method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN115757110A (en)

Similar Documents

Publication Publication Date Title
EP3992800B1 (en) Program test method and apparatus, computer device, and storage medium
CN107291438B (en) Automatic script generation method and device and electronic equipment
US7725888B2 (en) Systems and methods for dynamically linking application software into a running operating system kernel
CN112270149B (en) Verification platform automatic integration method and system, electronic equipment and storage medium
CA2866180A1 (en) Systems and methods for building a universal intelligent assistant with learning capabilities
CN111026645A (en) User interface automatic testing method and device, storage medium and electronic equipment
CN103377120A (en) Test method and device for application programs
US20070277156A1 (en) Systems and Methods For Generating and Distributing Executable Procedures For Technical Desk-Side Support
CN109614325B (en) Method and device for determining control attribute, electronic equipment and storage medium
CN115658529A (en) Automatic testing method for user page and related equipment
CN111241111B (en) Data query method and device, data comparison method and device, medium and equipment
CN112231206A (en) Script editing method for application program test, computer readable storage medium and test platform
CN113505082A (en) Application program testing method and device
CN116166525A (en) Method and device for generating test script
CN114328250A (en) Automatic self-checking method, medium and device for software system
CN112988578A (en) Automatic testing method and device
CN117493188A (en) Interface testing method and device, electronic equipment and storage medium
CN110825370B (en) Mobile terminal application development method, device and system
CN116594874A (en) Method, device, computer equipment and storage medium for testing availability of running environment
CN112416747A (en) Test case execution method, device, equipment and medium
CN116719735A (en) Test case generation method and device
CN115757110A (en) Automatic testing method and device and electronic equipment
US11030087B2 (en) Systems and methods for automated invocation of accessibility validations in accessibility scripts
CN113656301A (en) Interface testing method, device, equipment and storage medium
CN108614704A (en) Code compiling method and device

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