Detailed Description
Exemplary embodiments of the present invention will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding, and are to be considered merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Under the condition that no network is limited, the intranet server and the extranet server are in normal communication, the intranet server can normally access the extranet server, and the extranet server can also normally access the extranet server.
In order to limit the external network server to access the internal network server, the internal network server is not arranged in the internal network.
There are many reasons for restricting access to intranet servers by extranet servers, one reason being that many users or corporate employees do not have the need to access the intranet through the extranet. Another reason is that even if some employees have a need to access the intranet through the extranet, accessing the intranet through the extranet is laborious and laborious.
The most important reason is that the security of the data and equipment in the intranet is protected. Specifically, the intranet includes a plurality of computers, and each computer stores data. The loss of data in the intranet or illegal intrusion of the computer can bring about no small loss.
But in the course of the test software, the test software needs to be executed in the terminal. The terminal is in an intranet, the intranet cannot be accessed through an extranet, and the technical problem that software is difficult to test in the terminal through the extranet exists.
In order to solve the technical scheme that software is difficult to test in a terminal through an external network, the following technical scheme in the embodiment of the invention can be adopted.
Referring to fig. 1, fig. 1 is a schematic diagram of a main flow of a method for testing software according to an embodiment of the present invention, and a test request is sent to a first network computer through webSocket connection in a second network, and then the test software is executed by a terminal connected with the computer. As shown in fig. 1, the method specifically comprises the following steps:
S101, connecting computers in a first network through webSocket, and receiving a test request generated by a server in a second network according to the type of a test terminal and test software.
In the embodiment of the present invention, in the case where the first network is an intranet, the second network may be an extranet. Accordingly, in the case where the first network is an extranet, the second network may be an intranet. In the embodiments of the present invention described below, the second network is an external network, and the first network is an internal network.
In the external network, the server may determine the test terminal type and test software based on the test requirements. It is mainly considered that the test software is mainly applied in the terminal, and therefore the test software needs to be executed in different test terminal types.
The type of the test terminal comprises parameters such as a software system version of the terminal, a model of the terminal and the like. The software system version of the terminal may include an android version and an IOS version. In particular, different android versions, as well as different IOS versions, may be distinguished digitally. As one example, android version 3.2, version 4.0, and so on.
The model of the terminal may include the brand of the terminal and hardware parameters of the terminal. As one example, the brand of the terminal is brand A, and the hardware parameters of the terminal include memory 128G, screen size 6 inches, CPU signal A00.
Referring to fig. 2, fig. 2 is a schematic diagram of an application scenario according to an embodiment of the present invention. A first network and a second network are included in fig. 2. The server is present in the second network and the computer, terminal 1 and terminal 2 are present in the first network. The terminals 1 and 2 are connected to a computer. As an example, the terminal 1 is connected to a computer through a USB interface, and the terminal 2 is connected to a computer through an HDMI interface.
It will be appreciated that the computer in the first network may be connected to one or more terminals, which may be preset hardware devices, including smart phones, as an example.
The computer in the first network may normally access the server in the second network, but the server in the second network may not normally access the computer in the first network.
Then, after determining the test terminal type and the test software based on the test requirement, the test request may be generated according to the test terminal type and the test software. That is, the test request is generated by the server in the second network according to the test terminal type and the test software.
In one embodiment of the present invention, the server may generate the test request according to a preset data format according to the test terminal type and the test software. The data format is a list comprising test terminal types, test software and test requests. That is, the test request is generated by the server in the second network according to the type of the test terminal and the test software and the preset data format.
As one example, test terminal type A3.1, test software B2.2, test request Q1.3. It is known that the test request can be known based on the test terminal type and the test software. The test terminal type and the test software can be known based on the test request.
In one embodiment of the invention, the data format may be stored in a database in the external network. Thus, the database can be normally accessed in the external network, and the database can be normally accessed in the internal network.
WebSocket is a protocol for full duplex communication over a single transmission control protocol (Transmission Control Pro tocol, TCP) connection. webSocket the communication protocol was set by IETF as standard RFC 6455 in 2011 and is complemented by RFC 7936. WebSo cket API is also defined as W3C.
WebSocket makes the data exchange between the client and the server simpler, and allows the server to actively push data to the client. In webSocket API, the browser and the server only need to complete one handshake, and a persistent connection can be directly created between the two, and bidirectional data transmission can be performed.
In the embodiment of the invention, a server of webSocket is arranged in a server of the external network. As one example, code is written as a server for webSocket based on Java webSocket technology to send messages in real time to computers in the intranet, i.e., local clients.
Through webSocket's service end, the browser/server mode is enabled to have the real-time communication capability of the client/server.
In the embodiment of the invention, the browser sends a request for establishing webSocket connection to the server in the external network, and establishes webSocket connection. That is, the browser of the computer in the intranet sends a request for establishing webSocket connection to the server in the extranet, and after webSocket connection is established successfully, the computer in the intranet and the server in the extranet can transmit data through the TCP connection.
Illustratively, a webSocket connection is initiated on the computer in the intranet and a browser preset page is initiated. After loading the preset page, the intranet computer establishes websocket connection with a server in the extranet. When the external network server sends the information to the internal network computer, the browser in the internal network computer receives the information sent by the external network server through webSocket connection, the information is forwarded to the software of the internal network computer, and thus the technical problem of communication between the internal network computer and the external network server is solved.
In one embodiment of the present invention, the server in the external network is connected through webSocket to send the test request to the computer in the internal network. It can be understood that the server in the external network can be connected through webSocket to send the test request to the preset page in the browser of the internal network computer. As an example, the URL address of the page is set, and the browser loads the URL address of the preset page, so that the external network server can receive the test request sent by the webSocket connection in the preset page.
In this way, the external network server is connected through webSocket, and sends a test request to the internal network computer through a preset page in the browser of the internal network computer.
S102, in the first network, the computer acquires the type of the test terminal and the test software based on the received test request.
The computer in the first network can obtain a test request through a browser, and the purpose of the test request is to execute test software in a terminal connected with the intranet computer. Then, the test request needs to be parsed to learn the test terminal type and the test software.
In one embodiment of the invention, at the external network server, a test request is generated according to a preset data format according to the type of the test terminal and the test software. Correspondingly, in the intranet computer, based on the test request received from the browser, the preset data format is queried, and the type of the test terminal and the test software are known.
The data format may be stored in a database in the external network. In the computers in the intranet, the data format may be obtained in advance from the database in the extranet. That is, the intranet computer stores the data format in advance. As an example, the intranet computer knows the data format through the mobile storage device, so that after receiving the test request, the intranet computer can directly adopt the pre-stored data format to analyze the test request.
Specifically, after a browser of a computer in an intranet receives a test request, the computer calls a pre-stored data format, and queries the pre-stored data format based on the test request. Since the data format is a list including the test terminal type, the test software, and the test request, the test terminal type and the test software can be known based on the test request.
As an example, the test request includes a test request 3.1, and the data format may be queried based on the test request 3.1 to obtain that the test terminal type is a2.3 and the test software B2.1.
And analyzing the forwarded test request by adopting a preset data format, so that the type of the test terminal and the test software can be rapidly known under the condition of ensuring the safety of the data in the intranet.
S103, in the first network, the computer sends a message for executing test software to a terminal of a test terminal type connected with the computer, and the test result is stored in a database.
The computer in the intranet is connected with one or more terminals, and one or more terminals of the test terminal type are selected according to the test terminal type obtained by analyzing the test request. As an example, if the test terminal type a1.3 is the test terminal type a1.3 in the test request, the terminal of the test terminal type may be selected from terminals connected to the computer in the intranet.
In addition, the terminal is selected for testing software, and after the terminal is determined according to the type of the tested terminal, the software to be executed in the terminal can be obtained based on the testing software.
Since the types of the test terminals included in the test request are different and the test software is different, the test request test software can be called.
Referring to fig. 3, fig. 3 is a schematic flow chart of executing test software according to an embodiment of the present invention, which specifically includes:
s301, in a first network, a computer calls a test framework and sends a message for executing test software to a terminal of a test terminal type connected with the computer.
The test framework is a framework for use in automated testing. As one example, the test framework includes any one of Robotium Android Testing tool, UI Automator only for android, appium Android, and MonkeyRunner.
Robotium Android Testing tool a class library is provided for the tester to call, supporting the Java language. UI Automator only for android can support multiple android versions and platforms. Appium Android is a framework capable of supporting ios and android automated testing, supporting multiple languages Java, C# and Ruby. MonkeyRunner supports the scripting language python.
In the embodiment of the invention, the computer can call the test framework, operate the terminal of the test terminal type connected with the computer in the intranet, and send the message for executing the test software. As an example, application software in a computer invokes a test framework, sends a message to a terminal operating a test terminal type to execute the test software through an android debug bridge (Android Debug Bridge, adb) tool, and the terminal executes the test software.
S302, the computer receives a terminal output test result of a test terminal type connected with the computer and stores the test result into the database.
And the terminal is connected with the computer and used for testing the terminal type, and after the test software is executed, the test result is output to the computer. As an example, the purpose of the test terminal is to test whether the various functions of the software can be performed normally. The test results may include a record of whether or not each function can be normally performed. The computer receives a terminal output test result of a test terminal type connected with the computer.
To output the test results to the external network, the computer may store the test results to a database. The database is located in the external network, so that test results can be conveniently obtained from the external network at any time, and the internal network does not need to be accessed again.
Referring to fig. 4, fig. 4 is a schematic flow chart of outputting a test result according to an embodiment of the present invention, which specifically includes:
S401, the computer controls a terminal of a test terminal type connected with the computer, and after executing test software, the computer outputs a test result.
And after the test framework is called to execute the test software, the test result of the test terminal type is output to the computer. It will be appreciated that the test results correspond to the test terminal type and the test software.
S402, uploading the test result, the test terminal type and the test software to a database by the computer.
The test request is sent for the purpose of knowing the test result, which may also be different for different test terminal types and different test software. Then, in order to further learn the relationship between the test result and the test terminal type and the test software, the computer may upload the test result, the test terminal type and the test software to the database through the extranet.
As one example, a test result table is constructed with test results, test terminal types, and test software, and the test result table is uploaded to a database through an external network. The database is located in the external network, so that the database in the external network can be normally accessed from the external network or the internal network. Further, the test results may be invoked in the database from the external network.
In the embodiment, a computer in a first network is connected through webSocket to receive a test request, wherein the test request is generated by a server in a second network according to a test terminal type and test software, the computer in the first network acquires the test terminal type and the test software based on the received test request, and the computer in the first network sends a message for executing the test software to a terminal of the test terminal type connected with the computer and stores a test result in a database. The second network is connected with the terminal connected with the computer in the first network through webSocket, and the control terminal can execute the test software, so that the test software in the terminal of the first network through the second network can be realized.
Referring to fig. 5, fig. 5 is a schematic diagram of a method application of testing software according to an embodiment of the present invention, which specifically includes:
The server is located in a second network and the database is located in the second network. The computer, terminal 1 and terminal 2 are located in a first network. As an example, both terminal 1 and terminal 2 may be smartphones.
First, the server starts webSocket the server and the computer starts the client that has been bound webSocket. The computer starts the browser and a webSocket connection is established between the server and the computer. The browser maintains session control (session) between the server and the computer, where the session is used for communication between the server and the computer.
And secondly, a tester can determine the type of the test terminal based on the actual requirement of the test software, and then the server generates a test request according to the type of the test terminal and the test software. The tester sends a test request to the computer via webSocket connections through the server.
The browser of the computer receives the test request through webSocket connections. The browser of the computer sends the test request, and the computer analyzes the test request to further obtain the type of the test terminal and the test software.
And thirdly, if the terminal types of the terminal 1 and the terminal 2 are consistent with the test terminal types, the computer sends a message for executing the test software to the terminal 1 and the terminal 2, and the test software is executed at the terminal 1 and the terminal 1. The terminal 1 and the terminal 2 output test results, and the computer stores the test results into a database.
Finally, the test results of the terminals 1 and 2 are stored in the database. The test staff can obtain the test result in the database through the server, and likewise, the computer can access the database at any time to obtain the test result.
Referring to fig. 6, fig. 6 is a schematic diagram of a main structure of a device for testing software according to an embodiment of the present invention, where the device for testing software may implement a method for testing software, and as shown in fig. 6, the device for testing software specifically includes:
The receiving module 601 is configured to control a computer in a first network, and receive a test request through webSocket connection, where the test request is generated by a server in a second network according to a test terminal type and test software;
The acquiring module 602 is configured to acquire, in the first network, a test request received by the control computer, a test terminal type and test software;
The control module 603 is configured to, in the first network, control the computer to send a message for executing the test software to a terminal of a test terminal type connected to the computer, and store the test result in the database.
In one embodiment of the invention, the test request is generated by a server in the second network according to a preset data format according to the type of the test terminal and the test software.
In one embodiment of the present invention, the receiving module 601 is specifically configured to control a preset page in a browser of a computer in the first network, and receive a test request through webSocket connection.
In one embodiment of the present invention, the learning module 602 is further configured to control the browser to send a request for establishing webSocket a connection to a server in the second network, and establish webSocket a connection.
In one embodiment of the present invention, the learning module 602 is specifically configured to, in the first network, the control computer queries a preset data format based on the received test request, and learns the test terminal type and the test software.
In one embodiment of the present invention, the control module 603 is specifically configured to control, in the first network, the computer to call the test framework, and send a message for executing the test software to a terminal of a test terminal type connected to the computer;
And the control computer receives the test result output by the terminal of the test terminal type connected with the computer and stores the test result into the database.
In one embodiment of the present invention, the control module 603 is specifically configured to control the computer, and output a test result after controlling the terminal of the test terminal type connected to the computer to execute the test software;
and uploading the test result, the test terminal type and the test software to a database by the control computer.
Fig. 7 illustrates an exemplary system architecture 700 of a method of testing software or an apparatus of testing software to which embodiments of the present invention may be applied.
As shown in fig. 7, a system architecture 700 may include terminal devices 701, 702, 703, a network 704, and a server 705. The network 704 is the medium used to provide communication links between the terminal devices 701, 702, 703 and the server 705. The network 704 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 705 via the network 704 using the terminal devices 701, 702, 703 to receive or send messages or the like. Various communication client applications such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only) may be installed on the terminal devices 701, 702, 703.
The terminal devices 701, 702, 703 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 705 may be a server providing various services, such as a background management server (by way of example only) providing support for shopping-type websites browsed by users using the terminal devices 701, 702, 703. The background management server may analyze and process the received data such as the product information query request, and feedback the processing result (e.g., the target push information, the product information—only an example) to the terminal device.
It should be noted that, the method for testing software provided in the embodiment of the present invention is generally executed by the server 705, and accordingly, the device for testing software is generally disposed in the server 705.
It should be understood that the number of terminal devices, networks and servers in fig. 7 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 8, there is illustrated a schematic diagram of a computer system 800 suitable for use in implementing an embodiment of the present invention. The terminal device shown in fig. 8 is only an example, and should not impose any limitation on the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 8, the computer system 800 includes a Central Processing Unit (CPU) 801 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the system 800 are also stored. The CPU 801, ROM 802, and RAM 803 are connected to each other by a bus 804. An input/output (I/O) interface 805 is also connected to the bus 804.
Connected to the I/O interface 805 are an input section 806 including a keyboard, a mouse, and the like, an output section 807 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker, and the like, a storage section 808 including a hard disk, and the like, and a communication section 809 including a network interface card such as a LAN card, a modem, and the like. The communication section 809 performs communication processing via a network such as the internet. The drive 810 is also connected to the I/O interface 805 as needed. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as needed so that a computer program read out therefrom is mounted into the storage section 808 as needed.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication section 809, and/or installed from the removable media 811. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 801.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of a computer-readable storage medium may include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules involved in the embodiments of the present invention may be implemented in software or in hardware. The described modules may also be provided in a processor, which may be described as, for example, a processor comprising a sending unit, an obtaining unit, a determining unit and a first processing unit. The names of these units do not constitute a limitation on the unit itself in some cases, and for example, the transmitting unit may also be described as "a unit that transmits a picture acquisition request to a connected server".
As a further aspect, the invention also provides a computer readable medium which may be comprised in the device described in the above embodiments or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to include:
The method comprises the steps that a computer in a first network is connected through webSocket and receives a test request, wherein the test request is generated by a server in a second network according to a test terminal type and test software;
In a first network, the computer learns the test terminal type and the test software based on the received test request;
In a first network, the computer sends a message for executing the test software to a terminal of the test terminal type connected with the computer, and stores a test result in a database.
According to the technical scheme of the embodiment of the invention, a computer in a first network is connected through webSocket and receives a test request, the test request is generated by a server in a second network according to a test terminal type and test software, the computer in the first network acquires the test terminal type and the test software based on the test request, and the computer sends a message for executing the test software to a terminal of the test terminal type connected with the computer in the first network and stores a test result in a database. And the second network is connected with a terminal connected with the computer in the first network through webSocket, and the control terminal can execute test software so as to realize the test of the software in the terminal of the first network through the second network.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.