CN112711534A - Automatic testing method and device - Google Patents

Automatic testing method and device Download PDF

Info

Publication number
CN112711534A
CN112711534A CN202011606411.7A CN202011606411A CN112711534A CN 112711534 A CN112711534 A CN 112711534A CN 202011606411 A CN202011606411 A CN 202011606411A CN 112711534 A CN112711534 A CN 112711534A
Authority
CN
China
Prior art keywords
server
proxy
class
remote server
loading
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
CN202011606411.7A
Other languages
Chinese (zh)
Inventor
许伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Pinwei Software Co Ltd
Original Assignee
Guangzhou Pinwei Software 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 Guangzhou Pinwei Software Co Ltd filed Critical Guangzhou Pinwei Software Co Ltd
Priority to CN202011606411.7A priority Critical patent/CN112711534A/en
Publication of CN112711534A publication Critical patent/CN112711534A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Software Systems (AREA)
  • Debugging And Monitoring (AREA)
  • Test And Diagnosis Of Digital Computers (AREA)

Abstract

The invention discloses an automatic test method and a device, wherein the test method comprises the following steps: remotely starting the proxy service deployed on the remote server by at least one local server, wherein the remote server and the at least one local server are in communication connection; and the remote server remotely operates the proxy object instance through the proxy service. According to the automated testing method and device, the automated testing agent service is changed from the local service to the remote service, so that the resource occupation of the local server during automated testing can be reduced, the stability of automated testing is improved, and the agent service data can be shared by all the local servers, so that unified management is facilitated, the testing workload is reduced, and the testing efficiency is improved.

Description

Automatic testing method and device
Technical Field
The invention belongs to the technical field of computers, and particularly relates to an automatic testing method and device.
Background
in the process of the iOS automatic test, test data needs to be constructed through the proxy server, data support is provided for the automatic test, and the coverage of an automatic test scene is improved. The existing proxy server is deployed on a local server for executing an automated test, and the following technical problems are easy to occur:
firstly, local service end system resources are occupied, and testing efficiency is influenced; secondly, after the automated service is abnormally quitted, the agent service is easy to generate a zombie process on a local server (such as a Mac system); thirdly, the data of the proxy service is scattered, and different local servers cannot share the data.
Disclosure of Invention
The invention provides an automatic testing method and device, which can solve or at least partially solve the technical problems.
In order to achieve the purpose, the invention adopts the following technical scheme:
in a first aspect, an automated testing method is provided, including:
remotely starting proxy service deployed on a remote server by at least one local server, wherein the remote server and the at least one local server are in communication connection;
and the remote server remotely operates the proxy object instance through the proxy service.
Optionally, the proxy service includes:
packaging the test data operation rule into a Groovy script;
compiling the Groovy script into a Class;
and loading the Class.
Optionally, the method for loading a Class includes:
and loading the Class through a GroovyClassLoader Class loader.
Optionally, the loading the Class by a GroovyClassLoader Class loader includes:
dynamically loading an App Proxy script and executing the behavior thereof;
caching the Class of the Class;
and acquiring a target method through reflection, and transmitting parameters.
Optionally, the remotely starting, by the at least one local server, the proxy service deployed on the remote server includes:
at least one local server sends a test access request to the remote server;
and after receiving the test access request, the remote server starts the proxy service.
In a second aspect, an automated testing device is provided, which includes a remote server and at least one local server, where the remote server and the at least one local server are both in communication connection;
the remote server is provided with a proxy server, and when the proxy server is remotely started by at least one local server, the remote server remotely operates the proxy object instance through the proxy server.
Optionally, the proxy server includes:
the packaging module is used for packaging the test data operation rules into a Groovy script;
the compiling module is used for compiling the Groovy script into a Class;
and the loading module is used for loading the Class.
Optionally, the load module is a GroovyClassLoader class loader.
Optionally, the loading module includes:
the loading unit is used for dynamically loading the App Proxy script and executing the behavior of the App Proxy script;
the caching unit is used for caching the Class;
and the transmission unit is used for acquiring a target method through reflection and transmitting parameters.
Optionally, the local server includes a test module, where the test module is configured to send a test access request to the remote server;
the remote server comprises a starting module, and the starting module is used for starting the proxy server after receiving the test access request.
Compared with the prior art, the embodiment of the invention has the following beneficial effects:
according to the automated testing method and device provided by the embodiment of the invention, the automated testing agent service is changed from the local service to the remote service, so that the resource occupation of the local service terminal during the automated testing can be reduced, the stability of the automated testing is improved, and the agent service data can be shared by each local service terminal, thereby facilitating the unified management, reducing the testing workload and improving the testing efficiency.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
The structures, ratios, sizes, and the like shown in the present specification are only used for matching with the contents disclosed in the specification, so that those skilled in the art can understand and read the present invention, and do not limit the conditions for implementing the present invention, so that the present invention has no technical significance, and any structural modifications, changes in the ratio relationship, or adjustments of the sizes, without affecting the functions and purposes of the present invention, should still fall within the scope covered by the contents disclosed in the present invention.
FIG. 1 is a flow chart of an automated testing method provided by an embodiment of the invention;
fig. 2 is a diagram of an automated testing apparatus and an information flow chart according to an embodiment of the present invention.
Detailed Description
In order to make the objects, features and advantages of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the embodiments described below are only a part of the embodiments of the present invention, and not all of the embodiments. 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 invention.
Referring to fig. 1, the present embodiment provides an automatic testing method, which includes the following steps:
s101, remotely starting proxy service deployed on a remote server by at least one local server, wherein the remote server and the at least one local server are in communication connection;
and S102, the remote server remotely operates the proxy object instance through proxy service.
Specifically, the embodiment remotely services the automatic App Proxy, that is, the Proxy service is deployed at the remote service end, and is managed uniformly at the remote service end, so as to be isolated from the local service end.
The proxy service is arranged at the remote server, so that the resource occupation of the local server during the automatic test can be reduced, the stability of the automatic test is improved, and the proxy service data can be shared by all the local servers, thereby facilitating the unified management, reducing the test workload and improving the test efficiency.
Specifically, please refer to fig. 2, in which the Client Side represents a local Server, the Web Server represents a remote Server, and the local Server and the remote Server have a communication connection.
The local server may initiate the proxy service by issuing a test access request at Step1 in fig. 2, i.e. HTTP Post.
The proxy service comprises Step2 and Step3 in fig. 2, and comprises the following steps:
the proxy service encapsulates the test data operation rules into a Groovy script, directly compiles the Groovy script into a Class at a remote service end, and remotely operates the proxy object instance in real time through a Class loader of the Groovy.
As an optional implementation, the Class is loaded through a GroovyClassLoader Class loader, and the GroovyClassLoader is a customized Class loader and is responsible for interpreting the Groovy Class used in loading the Java Class.
Specifically, loading a Class through a GroovyClassLoader Class loader includes:
dynamically loading an App Proxy script and executing the behavior thereof;
caching Class;
the target method is then acquired by reflection, passing parameters (App Proxy Instance). Thus, the ability to perform proxy services through proxy instances is similar to a locally operated proxy service.
As a specific implementation manner of this embodiment, the remote service may be started through the following codes:
HttpServer server=HttpServer.create(new InetSocketAddress(8080),0);
server.createContext("/appProxy",new AppProxyHandler());
server.start();
and dynamically loading an App Proxy script through the App ProxHandler and executing the behavior of the service instance:
private static AppProxy appProxy=new AppProxy();
@Override
public void handle(HttpExchange httpExchange)throws IOException{
DataRule r=DataRuleGenerator.by("Proxy.groovy");
String executedResult=r.apply(appProxy);
httpExchange.sendResponseHeaders(200,0);
OutputStream out=httpExchange.getResponseBody();
out.write(executedResult.getBytes());
out.close();
}
GroovyClassLoader loader=new
GroovyClassLoader(Thread.currentThread().getContextClassLoader());
try{
Class clazz=loader.parseClass(new File(ruleGroovyFile));
DataRule r=(DataRule)clazz.newInstance();
return r;
}catch(IOException e){
e.printStackTrace();
}catch(IllegalAccessException e){
e.printStackTrace();
}catch(InstantiationException e){
e.printStackTrace();
}finally{
}
referring to fig. 2, in another embodiment of the present application, an automatic testing apparatus is provided, which can be applied to implement the automatic testing method provided in the foregoing embodiment.
The automatic testing device comprises a remote Server Web Server and at least one local Server Client Side, wherein the remote Server and the at least one local Server are in communication connection.
In this embodiment, fig. 2 includes a local server, and the local server includes N Test terminals, such as Test Client 1, Test Client 2 … … Test Client N. Alternatively, the test terminal may be a mobile phone based on IOS (apple mobile operating System).
The remote server is provided with a proxy server, and when the local server remotely starts the proxy server, the remote server remotely operates the proxy object instance through the proxy server.
For example, the local server includes a test module, and the test module is used for sending a test access request to the remote server; the remote server comprises a starting module, and the starting module is used for starting the proxy server after receiving the test access request.
In this embodiment, a specific structure of a proxy server is disclosed, which includes:
the packaging module is used for packaging the test data operation rules into a Groovy script;
the compiling module is used for compiling the Groovy script into a Class;
the loading module is used for loading the Class; optionally, the load module is a GroovyClassLoader class loader.
As an optional implementation manner of this embodiment, the loading module includes:
the loading unit is used for dynamically loading the App Proxy script and executing the behavior of the App Proxy script;
the caching unit is used for caching the Class;
and the transmission unit is used for acquiring a target method through reflection and transmitting parameters.
Since the testing principle has been explained in detail in the embodiment of the automated testing method, the testing principle of the automated testing apparatus will not be described herein.
The automated testing device provided by the embodiment changes the automated testing proxy service from the local service to the remote service, so that the resource occupation of the local service terminal during the automated testing can be reduced, the stability of the automated testing is improved, and the proxy service data can be shared by each local service terminal, thereby facilitating the unified management, reducing the testing workload and improving the testing efficiency.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. An automated testing method, comprising:
remotely starting proxy service deployed on a remote server by at least one local server, wherein the remote server and the at least one local server are in communication connection;
and the remote server remotely operates the proxy object instance through the proxy service.
2. The automated testing method of claim 1, wherein the proxy service comprises:
packaging the test data operation rule into a Groovy script;
compiling the Groovy script into a Class;
and loading the Class.
3. The automated testing method of claim 2, wherein the Class loading method comprises:
and loading the Class through a GroovyClassLoader Class loader.
4. The automated testing method of claim 3, wherein said loading said Class by a GroovyClassLoader Class loader comprises:
dynamically loading an App Proxy script and executing the behavior thereof;
caching the Class of the Class;
and acquiring a target method through reflection, and transmitting parameters.
5. The automated testing method of any one of claims 1 to 4, wherein the at least one local server remotely initiates a proxy service deployed at a remote server, comprising:
at least one local server sends a test access request to the remote server;
and after receiving the test access request, the remote server starts the proxy service.
6. An automatic testing device is characterized by comprising a remote server and at least one local server, wherein the remote server and the at least one local server are in communication connection;
the remote server is provided with a proxy server, and when the proxy server is remotely started by at least one local server, the remote server remotely operates the proxy object instance through the proxy server.
7. The automated testing apparatus of claim 6, wherein the proxy server comprises:
the packaging module is used for packaging the test data operation rules into a Groovy script;
the compiling module is used for compiling the Groovy script into a Class;
and the loading module is used for loading the Class.
8. The automated testing device of claim 7, wherein the load module is a GroovyClassLoader class loader.
9. The automated testing apparatus of claim 8, wherein the loading module comprises:
the loading unit is used for dynamically loading the App Proxy script and executing the behavior of the App Proxy script;
the caching unit is used for caching the Class;
and the transmission unit is used for acquiring a target method through reflection and transmitting parameters.
10. The automated testing device of any one of claims 6 to 9, wherein the local server comprises a testing module, the testing module being configured to issue a test access request to the remote server;
the remote server comprises a starting module, and the starting module is used for starting the proxy server after receiving the test access request.
CN202011606411.7A 2020-12-28 2020-12-28 Automatic testing method and device Pending CN112711534A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011606411.7A CN112711534A (en) 2020-12-28 2020-12-28 Automatic testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011606411.7A CN112711534A (en) 2020-12-28 2020-12-28 Automatic testing method and device

Publications (1)

Publication Number Publication Date
CN112711534A true CN112711534A (en) 2021-04-27

Family

ID=75547106

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011606411.7A Pending CN112711534A (en) 2020-12-28 2020-12-28 Automatic testing method and device

Country Status (1)

Country Link
CN (1) CN112711534A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102707943A (en) * 2012-04-12 2012-10-03 广东欧珀移动通信有限公司 Implementation method of remote control automation tool
CN103023857A (en) * 2011-09-20 2013-04-03 腾讯科技(深圳)有限公司 Method and system for remote deployment of information resources
CN106547689A (en) * 2016-10-20 2017-03-29 金航数码科技有限责任公司 A kind of automatic test cases development system and method based on web
CN106933729A (en) * 2015-12-29 2017-07-07 苏宁云商集团股份有限公司 A kind of method of testing and system based on cloud platform
CN110650061A (en) * 2018-06-27 2020-01-03 苏州宏控软件***有限公司 Distributed cooperative cloud testing system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103023857A (en) * 2011-09-20 2013-04-03 腾讯科技(深圳)有限公司 Method and system for remote deployment of information resources
CN102707943A (en) * 2012-04-12 2012-10-03 广东欧珀移动通信有限公司 Implementation method of remote control automation tool
CN106933729A (en) * 2015-12-29 2017-07-07 苏宁云商集团股份有限公司 A kind of method of testing and system based on cloud platform
CN106547689A (en) * 2016-10-20 2017-03-29 金航数码科技有限责任公司 A kind of automatic test cases development system and method based on web
CN110650061A (en) * 2018-06-27 2020-01-03 苏州宏控软件***有限公司 Distributed cooperative cloud testing system

Similar Documents

Publication Publication Date Title
US8504809B2 (en) Automated communication configuration
US20090007091A1 (en) Techniques for automatic software provisioning
CN110226308B (en) Network slice management method, management unit and system
KR101139836B1 (en) Method and system for two-phase mechanism for discovering web services based management service
CN113517985B (en) File data processing method and device, electronic equipment and computer readable medium
WO2012089166A1 (en) Software downloading method and device
CN110661673B (en) Heartbeat detection method and device
CN110716734A (en) Software upgrading method and device, electronic equipment and medium
CN112954717A (en) Household appliance network distribution method and device based on H5 page
US20090031177A1 (en) Method for providing download and upload service in network control system
US20040177353A1 (en) Electronic device network having graceful denial of service
CN108600378B (en) File downloading method, device, terminal and storage medium
CN112711534A (en) Automatic testing method and device
CN110365839B (en) Shutdown method, shutdown device, shutdown medium and electronic equipment
CN114286293B (en) Message push management method, device, system, computer equipment and storage medium
CN105827567B (en) Service management and control method and capability opening platform
CN114051030A (en) Communication method, communication device, smart community system and storage medium
CN114143903A (en) Method, device, equipment and medium for configuring network slice PDU session
CN114244758A (en) Network diagnosis method, storage medium, electronic device and system of android platform
CN112306791B (en) Performance monitoring method and device
CN110336856B (en) Interface calling method and device, electronic equipment and storage medium
CN110650071B (en) Access management method and device of user equipment and management server
CN113079036A (en) Method and device for determining management VLAN (virtual local area network) of access point equipment and access point equipment
CN106533716A (en) Method and system for managing northbound interface
CN110098981A (en) TCP connection method, network delay determine method, apparatus and server

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