CN106302002A - Method of testing and device - Google Patents
Method of testing and device Download PDFInfo
- Publication number
- CN106302002A CN106302002A CN201610616928.1A CN201610616928A CN106302002A CN 106302002 A CN106302002 A CN 106302002A CN 201610616928 A CN201610616928 A CN 201610616928A CN 106302002 A CN106302002 A CN 106302002A
- Authority
- CN
- China
- Prior art keywords
- server
- file
- list
- test
- domain name
- 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.)
- Granted
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/08—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
- H04L43/0805—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
- H04L43/0811—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking connectivity
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/08—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
- H04L43/0805—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
- H04L43/0817—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking functioning
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/08—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
- H04L43/0823—Errors, e.g. transmission errors
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/16—Threshold monitoring
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/10—Network architectures or network communication protocols for network security for controlling access to devices or network resources
- H04L63/101—Access control lists [ACL]
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Environmental & Geological Engineering (AREA)
- Computer Hardware Design (AREA)
- Computer Security & Cryptography (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The disclosure discloses a kind of method of testing and device, belongs to field tests.Described method includes: obtain server list, server list includes the server identification of N number of server, the domain name of N number of server is the target domain name of website to be tested, N >=2, according to each server identification in server list, test by the file in the website to be tested of the server access corresponding to server identification;Solve Test Engineer only treated by a server test website in file test time, the problem that user passes through still cannot access during other server access this documents may be caused;Reach the server identification corresponding with the target domain name of website to be tested for each, test terminal is all tested by this server identification access file, reached guarantee user by each server can successful access to this document, improve the effect of the reliability of test.
Description
Technical Field
The present disclosure relates to the field of testing, and in particular, to a testing method and device.
Background
A web site may be served by multiple servers, one of which a user accesses files in the web site. The domain name of each server is the same as that of the website, but the IP (internet protocol) addresses of different servers are different.
To ensure that each file in the website is accessible and accessible to the user, the test engineer needs to test the accessibility of each file. In the process of testing the accessibility of a file in a website, a test engineer inputs a domain name of the website in a browser, requests an IP address corresponding to the domain name from a domain name server through the browser, the domain name server randomly selects one IP address to return to the browser, the test engineer accesses the file through a server corresponding to the IP address received by the browser, and if the access is successful, the next file can be continuously tested; if the access fails, the test fails. However, the success of the test only indicates that the user can successfully access the file using the server used in the test, and when the user accesses the file using another server, it is still not guaranteed that the user can access and acquire the file.
Disclosure of Invention
In order to solve the problem that a test engineer may not access a file through other servers because a test engineer only uses one server to test the accessibility of the file, the disclosure provides a test method and a test device. The technical scheme is as follows:
according to a first aspect of embodiments of the present disclosure, there is provided a test method, the method including:
acquiring a server list, wherein the server list comprises server identifications of N servers, domain names of the N servers are all target domain names of websites to be tested, and N is more than or equal to 2;
and testing the files in the websites to be tested accessed by the server corresponding to the server identifier according to each server identifier in the server list.
Optionally, the testing the file in the website to be tested accessed through the server corresponding to the server identifier includes:
acquiring a file list corresponding to a website to be tested, wherein the file list comprises all files in the website to be tested;
and for each file in the file list, testing the server access file corresponding to the server identification.
Optionally, the testing the server access file corresponding to the server identifier includes:
accessing the file through a server corresponding to the server identifier;
if the access is successful, the file accessed by the server is tested successfully;
if the access fails, the test fails for the file accessed by the server.
Optionally, the method further includes:
if the test on the file accessed by the server fails, detecting whether the number of times of accessing the file by the server reaches a number threshold value;
if the number of times of accessing the file through the server does not reach the threshold value of the number of times, the step of testing the server access file corresponding to the server identifier is executed again;
and if the times of accessing the file through the server reach the time threshold value, determining that the test on the file accessed through the server fails.
Optionally, the obtaining the server list includes:
receiving a pre-generated server list, wherein the server list is generated according to the received server identification when the number of the server identifications corresponding to the target domain name randomly returned by the domain name server reaches a preset threshold value, and the domain name server stores the corresponding relation between the domain name and the server identification;
or sending an acquisition request to the domain name server, and receiving a server list corresponding to the target domain name returned by the domain name server, wherein the acquisition request at least comprises the target domain name, and the domain name server stores the corresponding relation between the domain name and the server list.
According to a second aspect of embodiments of the present disclosure, there is provided a test apparatus, the apparatus comprising:
the acquisition module is configured to acquire a server list, the server list comprises server identifications of N servers, domain names of the N servers are all target domain names of the to-be-tested websites, and N is larger than or equal to 2;
and the testing module is configured to test the file in the website to be tested accessed by the server corresponding to the server identifier according to each server identifier in the server list.
Optionally, the test module includes:
the acquisition submodule is configured to acquire a file list corresponding to the to-be-tested website, and the file list comprises all files in the to-be-tested website;
and the testing submodule is configured to test the server access file corresponding to the server identification for each file in the file list.
Optionally, the test sub-module is further configured to:
accessing the file through a server corresponding to the server identifier;
when the access is successful, the file access through the server is tested successfully;
and when the access fails, the test fails on the file accessed by the server.
Optionally, the apparatus further comprises:
the detection module is configured to detect whether the number of times of accessing the file through the server reaches a number threshold value if the test on the file accessed through the server fails;
the test module is also configured to execute the step of testing the server access file corresponding to the server identifier again if the number of times of accessing the file through the server does not reach the threshold value of the number of times;
the determining module is configured to determine that the test fails to access the file through the server if the number of times of accessing the file through the server reaches a threshold number of times.
Optionally, the obtaining module is further configured to obtain a pre-generated server list, where the server list is generated according to the received server identifier when the number of server identifiers corresponding to the target domain name randomly returned by the domain name server reaches a predetermined threshold, and a corresponding relationship between the domain name and the server identifier is stored in the domain name server;
or,
the acquisition module is further configured to send an acquisition request to the domain name server, and receive a server list corresponding to the target domain name returned by the domain name server, where the acquisition request at least includes the target domain name, and the domain name server stores a corresponding relationship between the domain name and the server list.
According to a third aspect of embodiments of the present disclosure, there is provided a test apparatus, the apparatus comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to:
acquiring a server list, wherein the server list comprises server identifications of N servers, domain names of the N servers are all target domain names of websites to be tested, and N is more than or equal to 2;
and testing the files in the websites to be tested accessed by the server corresponding to the server identifier according to each server identifier in the server list.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects:
by acquiring a server list which comprises server identifications of N servers, wherein the domain names of the N servers are all target domain names of the to-be-tested websites, N is more than or equal to 2, and the server corresponding to the server identification accesses files in the to-be-tested websites according to each server identification in the server list; the problem that when a test engineer tests the file in the website to be tested through only one server, a user can still not access the file when accessing the file through other servers is solved; the server access file testing method has the advantages that for each server identification corresponding to the target domain name of the website to be tested, the testing terminal tests the server access file corresponding to the server identification, so that the user can successfully access the file through each server, and the testing reliability is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
FIG. 1A is a schematic illustration of an implementation environment involved in a testing method according to some exemplary embodiments;
FIG. 1B is a schematic illustration of an implementation environment involved in a testing method according to some exemplary embodiments;
FIG. 2 is a flow chart illustrating a testing method according to an exemplary embodiment;
FIG. 3 is a flow chart illustrating a testing method according to another exemplary embodiment;
FIG. 4A is a schematic flow chart diagram illustrating a testing method in accordance with another exemplary embodiment;
FIG. 4B is a schematic flow chart diagram illustrating a testing method in accordance with another exemplary embodiment;
FIG. 5 is a flow chart illustrating a testing method according to another exemplary embodiment;
FIG. 6 is a block diagram illustrating a test apparatus in accordance with an exemplary embodiment;
FIG. 7 is a block diagram illustrating a test apparatus in accordance with another exemplary embodiment;
FIG. 8 is a block diagram illustrating a test terminal according to another exemplary embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
Fig. 1A is a diagram of an implementation environment of a testing method according to various exemplary embodiments of the present disclosure, as shown in fig. 1A, the implementation environment at least includes: test terminal 110, server 120, and database 130.
The test terminal 110 is a test terminal such as a smart phone, a tablet computer, an e-book reader, an MP3 player (Moving Picture Experts Group Audio Layer III, motion Picture Experts Group Audio Layer IV, motion Picture Experts Group Audio Layer 4), an MP4 player, a desktop computer, and a portable computer.
The server 120 is a server that provides background services for the websites to be tested. Optionally, the website to be tested is a CDN (Content Delivery Network) -based website, and the servers 120 that provide background servers for the website to be tested generally include N servers, where N is greater than or equal to 2, and fig. 1A exemplarily shows 3 servers 120.
The domain names of N servers providing background services for the website to be tested are all target domain names of the website to be tested, the server identifier is used for uniquely identifying the server, and optionally, the server identifier is an IP (internet protocol) address and an MAC (Media Access Control) address of the server.
The database 130 includes a disk array for storing one or more files in the website to be tested, and fig. 1A exemplarily shows 5 files in the database 130. Optionally, the database 130 is a NAS (Network attached storage) device. The file identifier is used to uniquely identify a file. Optionally, the file identifier is a URL (Uniform Resource Locator) of the file.
The test terminal 110 performs data communication with the server 120 through a WIreless network manner such as bluetooth or WiFi (WIreless Fidelity) or a wired network manner, the server 120 establishes a connection with the database 130 through the wired network manner, and the test terminal 110 can access any file included in the database 130 through any one of the servers 120.
It should be noted that the files in the websites to be tested may all be stored in a special external storage device, and the implementation environment is shown in fig. 1A. However, in actual implementation, files in the website to be tested may also be stored in internal or external storage devices of different servers, respectively, so that the implementation environment may be as shown in fig. 1B, data communication is established between the servers 120, and the test terminal may access files stored in other servers through any one of the servers.
For example, the website to be tested includes file 1, file 2 and file 3, file 1 and file 2 are stored in server 1 providing background service for the website to be tested, and file 3 is stored in server 2 providing background service for the website to be tested, so that the test terminal can access file 1 and file 2 through server 1, and can also access file 3 stored on server 2, and similarly, the test terminal can access file 3 through server 2, and can also access file 1 and file 2 stored on server 1.
The embodiment of the present disclosure is not limited to this, and the embodiment of the present disclosure is described by taking the implementation environment shown in fig. 1A as an example.
FIG. 2 is a flow chart illustrating a testing method according to an exemplary embodiment, which may be used in the implementation environment shown in FIG. 1A, as shown in FIG. 2, and which includes the following steps:
in step 201, a server list is obtained.
The server list comprises server identifications of N servers, the domain names of the N servers are all target domain names of the to-be-tested websites, and N is larger than or equal to 2.
In step 202, according to each server identifier in the server list, a file in a website to be tested accessed by a server corresponding to the server identifier is tested.
It should be noted that the test terminal provided in the embodiment of the present disclosure is provided with a test system for testing a file accessed through a server, and the test method provided in the embodiment of the present disclosure may be implemented by the test system in the test terminal.
To sum up, in the testing method provided by the embodiment of the present disclosure, a server list is obtained, where the server list includes server identifiers of N servers, domain names of the N servers are all target domain names of websites to be tested, where N is greater than or equal to 2, and a file in the website to be tested is accessed by a server corresponding to the server identifier is tested according to each server identifier in the server list; the problem that when a test engineer tests the file in the website to be tested through only one server, a user can still not access the file when accessing the file through other servers is solved; the server identification corresponding to the target domain name of the website to be tested is tested by the test terminal, the file is accessed through the server identification, the user can successfully access the file through each server, and the test reliability is improved.
FIG. 3 is a flow chart illustrating a testing method according to an exemplary embodiment, which may be used in the implementation environment shown in FIG. 1A, as shown in FIG. 3, and which includes the following steps:
in step 301, a server list is obtained.
The server list comprises server identifications of N servers, the domain names of the N servers are all target domain names of the to-be-tested websites, and N is larger than or equal to 2.
This step can be implemented by any of two possible implementations:
in a first possible implementation manner, the test terminal obtains a pre-generated server list, where the server list is generated according to the received server identifier when the number of server identifiers corresponding to the target domain name randomly returned by the domain name server reaches a predetermined threshold.
The domain name server stores the corresponding relation between the domain name and the server identification, the preset threshold is a system preset value or a user-defined value, and the preset threshold is far larger than N.
Optionally, the test engineer generates a server list in the test terminal in advance and stores the server list in the test terminal, where the server list is generated by the test terminal according to the received server identifier when the number of server identifiers corresponding to the target domain name randomly returned by the domain name server received by the test terminal reaches a predetermined threshold.
Optionally, the test engineer generates a server list in the terminal device different from the test terminal in advance, and the test terminal receives the server list sent by the terminal device or receives the server list input by the test engineer, and the server list is generated according to the received server identifier when the number of the server identifiers corresponding to the target domain name randomly returned by the domain name server received by the terminal device reaches a predetermined threshold.
In this embodiment, a server list is generated in a test terminal in advance by a test engineer as an example, the test engineer inputs a target domain name of a website to be tested in a browser of the test terminal, the test terminal is connected to a domain name server, the browser sends the target domain name to the domain name server through the test terminal, the domain name server queries a server identifier corresponding to the stored target domain name and randomly returns a server identifier to the browser, and the test engineer acquires a server identifier corresponding to the target domain name from the browser. And inputting the target domain name of the website to be tested in the browser for many times by a test engineer, and thus receiving a plurality of server identifications corresponding to the target domain name, which are returned by the domain name server.
When the number of the server identifications returned by the domain name server received by the test engineer reaches a predetermined threshold, since the predetermined threshold is much larger than N, it can be considered that all the server identifications corresponding to the target domain name are already included in the server identifications returned by the domain name server. However, since the domain name server randomly returns the server identifier, the server identifier received by the test engineer may have a duplicate server identifier, so that the test engineer performs deduplication processing on the received server identifier and generates a server list according to the received server identifier, where the server list includes the server identifier subjected to deduplication processing. After the test engineer generates the server list, the server list is stored in the test terminal, and when the test terminal performs a test, the stored server list is acquired.
For example, N is 3, the server identities corresponding to the target domain name are server identity 1, server identity 2, and server identity 3, respectively, and the predetermined threshold is 15. The server identifiers returned by the domain name server received by the test engineer include 3 server identifiers 1, 7 server identifiers 2 and 5 server identifiers 3, and then the test engineer performs deduplication processing on the received server identifiers, and a generated server list includes the server identifiers 1, the server identifiers 2 and the server identifiers 3.
In a second possible implementation manner, the test terminal sends an acquisition request to the domain name server, and receives a server list corresponding to the target domain name returned by the domain name server, where the acquisition request at least includes the target domain name.
The domain name server stores the corresponding relation between the domain name and the server list.
In step 302, a file list corresponding to a website to be tested is obtained.
The test terminal receives a file list input by a test engineer, where the file list includes each file in a website to be tested.
Optionally, the file in the website to be tested includes at least one of a picture file, a text file, an animation file, a video file, and a web page file, where the web page file includes at least one of a CSS (Cascading Style Sheet) file and a JavaScript script file.
For example, when the website to be tested is a video playing website, the file list acquired by the test terminal may include video files of videos in the video playing website.
In actual implementation, this step is usually performed simultaneously with step 301.
In step 303, according to each server identifier in the server list, for each file in the file list, the file is accessed through the server corresponding to the server identifier.
And the test terminal accesses the file according to the file identifier of the file through the server identifier.
In step 304, if the access is successful, the test for access to the file by the server is successful.
In step 305, if the access fails, the test fails for the file being accessed by the server.
The above steps 303-305 may include the following possible implementations:
in a first possible implementation manner, for the ith server identifier in the server list, the test terminal accesses the jth file in the file list through the server corresponding to the ith server identifier, where i is greater than or equal to 1 and less than or equal to N, j is greater than or equal to 1 and less than or equal to M, the starting value of i is 1, and the starting value of j is 1.
When the access is successful and i is not more than N, j and is less than M, making j equal to j +1, and executing the step that the test terminal accesses the jth file in the file list through the server corresponding to the ith server identifier again;
when the access is successful and i is less than N, j and M is equal to the access request, i is equal to i +1, j is equal to 1 again, and the test terminal accesses the jth file in the file list through the server corresponding to the ith server identifier;
when the access is successful and i N, j M, the test is ended and a successful response is returned.
When the access fails, returning a failure response and finishing the test; or, the test terminal returns a failure response and continues the test, and the method for continuing the test may be combined with the method involved in successful access, which is not described in this embodiment again.
Taking the first possible implementation as an example, assuming that when the access fails, the test terminal directly returns a failure response and ends the test, a flowchart of the first possible implementation may be as shown in fig. 4A.
In a second possible implementation manner, for the ith server identifier in the server list, the test terminal accesses the jth file in the file list through the server corresponding to the ith server identifier, where i is greater than or equal to 1 and less than or equal to N, j is greater than or equal to 1 and less than or equal to M, the starting value of i is N, and the starting value of j is M.
When the access is successful, i is more than or equal to 1, and j is more than 1, making j equal to j-1, and executing the step that the test terminal accesses the jth file in the file list through the server corresponding to the ith server identifier again;
when the access is successful, i is greater than 1, and j is 1, making i equal to i-1, and making j equal to M again, and executing the step that the test terminal accesses the jth file in the file list through the server corresponding to the ith server identifier again;
when the access is successful and i is 1 and j is 1, the test is ended and a successful response is returned.
When the access fails, returning a failure response and finishing the test; or the test terminal returns a failure response and continues the test.
In a third possible implementation manner, for the ith server identifier in the server list, the test terminal accesses the jth file in the file list through the server corresponding to the ith server identifier, where i is greater than or equal to 1 and less than or equal to N, j is greater than or equal to 1 and less than or equal to M, the starting value of i is 1, and the starting value of j is M.
When the access is successful and i is not more than N, j and is more than 1, making j equal to j-1, and executing the step that the test terminal accesses the jth file in the file list through the server corresponding to the ith server identifier again;
when the access is successful and i is less than N, j and is equal to 1, making i equal to i +1 and making j equal to M again, and executing the step that the test terminal accesses the jth file in the file list through the server corresponding to the ith server identifier again;
when the access is successful and i N, j is 1, the test is ended and a successful response is returned.
When the access fails, returning a failure response and finishing the test; or the test terminal returns a failure response and continues the test.
In a fourth possible implementation manner, for the ith server identifier in the server list, the test terminal accesses the jth file in the file list through the server corresponding to the ith server identifier, where i is greater than or equal to 1 and less than or equal to N, j is greater than or equal to 1 and less than or equal to M, the starting value of i is N, and the starting value of j is 1.
When the access is successful, i is more than or equal to 1, and j is less than M, making j equal to j +1, and executing the step that the test terminal accesses the jth file in the file list through the server corresponding to the ith server identifier again;
when the access is successful and i is greater than 1 and j is equal to M, making i equal to i-1 and making j equal to 1 again, and executing the step that the test terminal accesses the jth file in the file list through the server corresponding to the ith server identifier again;
when the access is successful and i is 1 and j is M, the test is ended and a successful response is returned.
When the access fails, returning a failure response and finishing the test; or the test terminal returns a failure response and continues the test.
To sum up, in the testing method provided by the embodiment of the present disclosure, a server list is obtained, where the server list includes server identifiers of N servers, domain names of the N servers are all target domain names of websites to be tested, where N is greater than or equal to 2, and a file in the website to be tested is accessed by a server corresponding to the server identifier is tested according to each server identifier in the server list; the problem that when a test engineer tests the file in the website to be tested through only one server, a user can still not access the file when accessing the file through other servers is solved; the server identification corresponding to the target domain name of the website to be tested is tested by the test terminal, the file is accessed through the server identification, the user can successfully access the file through each server, and the test reliability is improved.
According to the method provided by the embodiment of the disclosure, the test terminal can test the files accessed by the server according to the obtained server list and the file list, so that the test is not required to be performed manually by a test engineer, only the test is required to be performed automatically by the test terminal, and the test efficiency is improved.
Based on the first possible implementation manner shown in fig. 4A, in an exemplary example, taking the server identifier included in the server list as the IP address of the server, and the file identifier of the file included in the file list as the URL, the test flow diagram of the test terminal may be as shown in fig. 4B. In the illustrative example, the test terminal receives a server list corresponding to a target domain name and input by a test engineer, the server list comprises a plurality of IP addresses, the test terminal judges whether all the IP addresses in the server list are tested, if the IP addresses in the server list are tested, the test is successful, a successful response is returned, and the test flow is exited; and if the IP address which is not tested is judged to exist, acquiring the next IP address which is not tested for testing. The test terminal also receives a file list corresponding to the to-be-tested website input by the test engineer, wherein the file list comprises a plurality of files. The test terminal judges whether the file list has files to be accessed; if all the files are judged to be completely accessed, judging whether all the IP addresses in the server list are tested or not again; if the file list still has the file which is not accessed, directly accessing the file according to the URL of the next file which is not accessed through the server corresponding to the obtained IP address, and if the access is successful, judging whether the file list has the file which is not accessed; if the access fails, the test fails, and a failure response is returned and the test flow is exited.
For example, the server list received by the test terminal includes IP address 1 and IP address 2, and the received file list includes file 1 and file 2. When a test terminal starts to test, judging that the IP address 1 and the IP address 2 are not tested, acquiring the IP address 1, judging that the file 1 and the file 2 in a file list are both to be accessed by the test terminal, accessing the file 1 through a server corresponding to the IP address 1, judging that the file 2 is to be accessed by the test terminal if the access is successful, accessing the file 2 through the server corresponding to the IP address 1 again, judging that the files in the file list are all accessed by the test terminal if the access is successful, judging that the IP address 2 is not tested in the server list again, acquiring the IP address 2 by the test terminal, accessing the file 1 through the server corresponding to the IP address 2, and returning a failure response and exiting the test process if the access is failed.
Optionally, in another optional embodiment based on the foregoing embodiment, when the test terminal fails to test the file accessed by the server, the test terminal may be caused by failing to access the file by the server, or may be caused by a temporary unstable network connection between the server and the database, and therefore, when the test terminal fails to test the file accessed by the server, the method further includes the following steps, as shown in fig. 5:
in step 501, if the test for accessing the file through the server fails, it is detected whether the number of times of accessing the file through the server reaches a threshold number of times.
The time threshold is a system preset value or a user-defined value.
In step 502, if the number of times of accessing the file through the server does not reach the threshold number of times, the step of testing the file accessed through the server corresponding to the server identifier is executed again.
In step 503, if the number of times of accessing the file through the server reaches the threshold number of times, it is determined that the test for accessing the file through the server fails.
When the failure times of the test terminal for accessing the file through the server reach the time threshold, the test terminal can determine that the network connection between the server and the database is stable, and the access failure is that the server cannot access the file, and the test terminal determines that the test for accessing the file through the server fails.
In summary, the test method provided by the embodiment of the present disclosure determines that the server fails to test the access file when the server fails to test the access file for multiple times, thereby avoiding false alarm of the test failure caused by network instability or other external factors.
The following are embodiments of the disclosed apparatus that may be used to perform embodiments of the disclosed methods. For details not disclosed in the embodiments of the apparatus of the present disclosure, refer to the embodiments of the method of the present disclosure.
FIG. 6 is a block diagram illustrating a testing device, which may be implemented as a test terminal in the implementation environment shown in FIG. 1A by software, hardware, or a combination of both, according to an exemplary embodiment, including but not limited to: an acquisition module 610 and a testing module 620.
The obtaining module 610 is configured to obtain a server list, where the server list includes server identifiers of N servers, domain names of the N servers are all target domain names of websites to be tested, and N is greater than or equal to 2.
The testing module 620 is configured to test, according to each server identifier in the server list acquired by the acquiring module 610, that the server corresponding to the server identifier accesses the file in the website to be tested.
To sum up, in the testing device provided by the embodiment of the present disclosure, a server list is obtained, where the server list includes server identifiers of N servers, domain names of the N servers are all target domain names of websites to be tested, where N is greater than or equal to 2, and a file in the website to be tested is accessed by a server corresponding to the server identifier is tested according to each server identifier in the server list; the problem that when a test engineer tests the file in the website to be tested through only one server, a user can still not access the file when accessing the file through other servers is solved; the server identification corresponding to the target domain name of the website to be tested is tested by the test terminal, the file is accessed through the server identification, the user can successfully access the file through each server, and the test reliability is improved.
FIG. 7 is a block diagram illustrating a testing device, which may be implemented as a test terminal in the implementation environment shown in FIG. 1A by software, hardware, or a combination of both, according to an exemplary embodiment, including but not limited to:
the obtaining module 710 is configured to obtain a server list, where the server list includes server identifiers of N servers, domain names of the N servers are all target domain names of websites to be tested, and N is greater than or equal to 2.
The obtaining module 710 is further configured to obtain a pre-generated server list, where the server list is generated according to the received server identifier when the number of the server identifiers corresponding to the target domain name randomly returned by the domain name server reaches a predetermined threshold, and a corresponding relationship between the domain name and the server identifier is stored in the domain name server.
Or, the obtaining module 710 is further configured to send an obtaining request to the domain name server, and receive a server list corresponding to the target domain name returned by the domain name server, where the obtaining request at least includes the target domain name, and a corresponding relationship between the domain name and the server list is stored in the domain name server.
The testing module 720 is configured to test that the server corresponding to the server identifier accesses the file in the website to be tested according to each server identifier in the server list acquired by the acquiring module 710.
Optionally, the test module 720 includes:
the obtaining sub-module 721 is configured to obtain a file list corresponding to the to-be-tested website, where the file list includes each file in the to-be-tested website.
The testing sub-module 722 is configured to, for each file in the file list acquired by the acquiring sub-module 721, test a server access file corresponding to the server identifier.
Optionally, the test sub-module 722 is further configured to:
accessing the file through a server corresponding to the server identifier;
when the access is successful, the file access through the server is tested successfully;
and when the access fails, the test fails on the file accessed by the server.
The detecting module 730 is configured to detect whether the number of times of accessing the file through the server reaches the number threshold if the test of accessing the file through the server by the testing submodule 722 fails.
The testing module 720 is further configured to, if the number of times of accessing the file through the server, which is detected by the detecting module 730, does not reach the number threshold, perform the step of testing the file accessed by the server corresponding to the server identifier again.
A determining module 740 configured to determine that the test for the file accessed by the server fails if the number of times of accessing the file by the server detected by the detecting module 730 reaches the number threshold.
To sum up, in the testing device provided by the embodiment of the present disclosure, a server list is obtained, where the server list includes server identifiers of N servers, domain names of the N servers are all target domain names of websites to be tested, where N is greater than or equal to 2, and a file in the website to be tested is accessed by a server corresponding to the server identifier is tested according to each server identifier in the server list; the problem that when a test engineer tests the file in the website to be tested through only one server, a user can still not access the file when accessing the file through other servers is solved; the server identification corresponding to the target domain name of the website to be tested is tested by the test terminal, the file is accessed through the server identification, the user can successfully access the file through each server, and the test reliability is improved.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
An exemplary embodiment of the present disclosure provides a testing apparatus, which can implement the testing method provided by the present disclosure, and the apparatus includes: a processor, a memory for storing processor-executable instructions;
wherein the processor is configured to:
acquiring a server list, wherein the server list comprises server identifications of N servers, domain names of the N servers are all target domain names of websites to be tested, and N is more than or equal to 2;
and testing the files in the websites to be tested accessed by the server corresponding to the server identifier according to each server identifier in the server list.
FIG. 8 is a block diagram illustrating a test apparatus according to an exemplary embodiment. For example, the apparatus 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 8, the apparatus 800 may include one or more of the following components: a processing component 802, a memory 804, a power component 806, a multimedia component 808, an audio component 810, an input/output (I/O) interface 812, a sensor component 814, and a communication component 816.
The processing component 802 generally controls overall operation of the device 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 802 may include one or more processors 818 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 802 can include one or more modules that facilitate interaction between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
The memory 804 is configured to store various types of data to support operations at the apparatus 800. Examples of such data include instructions for any application or method operating on device 800, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 804 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
Power components 806 provide power to the various components of device 800. The power components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the apparatus 800.
The multimedia component 808 includes a screen that provides an output interface between the device 800 and the user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the device 800 is in an operating mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a Microphone (MIC) configured to receive external audio signals when the apparatus 800 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 804 or transmitted via the communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
The I/O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 814 includes one or more sensors for providing various aspects of state assessment for the device 800. For example, the sensor assembly 814 may detect the open/closed status of the device 800, the relative positioning of the components, such as a display and keypad of the device 800, the sensor assembly 814 may also detect a change in the position of the device 800 or a component of the device 800, the presence or absence of user contact with the device 800, the orientation or acceleration/deceleration of the device 800, and a change in the temperature of the device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 816 is configured to facilitate communications between the apparatus 800 and other devices in a wired or wireless manner. The device 800 may access a wireless network based on a communication standard, such as Wi-Fi, 2G, or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, communications component 816 further includes a Near Field Communications (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the apparatus 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described test methods.
In an exemplary embodiment, a non-transitory computer-readable storage medium comprising instructions, such as the memory 804 comprising instructions, executable by the processor 818 of the device 800 to perform the testing method described above, is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims (11)
1. A method of testing, the method comprising:
acquiring a server list, wherein the server list comprises server identifications of N servers, domain names of the N servers are all target domain names of websites to be tested, and N is more than or equal to 2;
and testing the files in the websites to be tested accessed by the server corresponding to the server identification according to each server identification in the server list.
2. The method of claim 1, wherein the testing the file in the website to be tested accessed through the server corresponding to the server identifier comprises:
acquiring a file list corresponding to the to-be-tested website, wherein the file list comprises all files in the to-be-tested website;
and for each file in the file list, testing the access of the server corresponding to the server identification to the file.
3. The method of claim 2, wherein testing the access to the file by the server corresponding to the server identification comprises:
accessing the file through the server corresponding to the server identifier;
if the access is successful, the file accessed by the server is tested successfully;
and if the access fails, the test fails on the file accessed by the server.
4. A method according to claim 2 or 3, characterized in that the method further comprises:
if the test on the file accessed by the server fails, detecting whether the number of times of accessing the file by the server reaches a number threshold value;
if the number of times of accessing the file through the server does not reach the number threshold, the step of testing the file accessed through the server corresponding to the server identifier is executed again;
and if the number of times of accessing the file through the server reaches the number threshold, determining that the test on accessing the file through the server fails.
5. The method of claim 1, wherein obtaining the list of servers comprises:
acquiring a pre-generated server list, wherein the server list is generated according to the received server identifier when the number of the server identifiers corresponding to the target domain name randomly returned by a domain name server reaches a preset threshold value, and the domain name server stores the corresponding relation between the domain name and the server identifier;
or,
sending an acquisition request to a domain name server, and receiving the server list corresponding to the target domain name returned by the domain name server, wherein the acquisition request at least comprises the target domain name, and the domain name server stores the corresponding relation between the domain name and the server list.
6. A test apparatus, the apparatus comprising:
the acquisition module is configured to acquire a server list, the server list comprises server identifications of N servers, domain names of the N servers are all target domain names of the to-be-tested websites, and N is larger than or equal to 2;
and the testing module is configured to test the file in the website to be tested accessed through the server corresponding to the server identifier according to each server identifier in the server list.
7. The apparatus of claim 8, wherein the test module comprises:
the acquisition submodule is configured to acquire a file list corresponding to the to-be-tested website, and the file list comprises all files in the to-be-tested website;
and the testing sub-module is configured to test that the server corresponding to the server identifier accesses the file for each file in the file list.
8. The apparatus of claim 7, wherein the test sub-module is further configured to:
accessing the file through the server corresponding to the server identifier;
when the access is successful, the file is tested successfully by the server;
and when the access fails, the test fails on the file accessed by the server.
9. The apparatus of claim 7 or 8, further comprising:
a detection module configured to detect whether a number of times the file is accessed by the server reaches a number threshold if the test fails for accessing the file by the server;
the test module is further configured to perform the step of testing the file accessed by the server corresponding to the server identifier again if the number of times of accessing the file by the server does not reach the number threshold;
a determination module configured to determine that the test fails for accessing the file by the server if the number of times the file is accessed by the server reaches the number threshold.
10. The apparatus of claim 6,
the obtaining module is further configured to obtain a pre-generated server list, where the server list is generated according to a received server identifier when the number of server identifiers corresponding to the target domain name randomly returned by a domain name server reaches a predetermined threshold, and a corresponding relationship between the domain name and the server identifier is stored in the domain name server;
or,
the obtaining module is further configured to send an obtaining request to a domain name server, and receive the server list corresponding to the target domain name returned by the domain name server, where the obtaining request at least includes the target domain name, and a corresponding relationship between the domain name and the server list is stored in the domain name server.
11. A test apparatus, the apparatus comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to:
acquiring a server list, wherein the server list comprises server identifications of N servers, domain names of the N servers are all target domain names of websites to be tested, and N is more than or equal to 2;
and testing the files in the websites to be tested accessed by the server corresponding to the server identification according to each server identification in the server list.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610616928.1A CN106302002B (en) | 2016-07-29 | 2016-07-29 | Test method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610616928.1A CN106302002B (en) | 2016-07-29 | 2016-07-29 | Test method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106302002A true CN106302002A (en) | 2017-01-04 |
CN106302002B CN106302002B (en) | 2019-10-01 |
Family
ID=57663454
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610616928.1A Active CN106302002B (en) | 2016-07-29 | 2016-07-29 | Test method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106302002B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108574604A (en) * | 2017-03-07 | 2018-09-25 | 北京京东尚科信息技术有限公司 | test method and device |
CN110519779A (en) * | 2019-08-26 | 2019-11-29 | Oppo(重庆)智能科技有限公司 | Mobile terminal testing method, device, system and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050240372A1 (en) * | 2004-04-23 | 2005-10-27 | Monk John M | Apparatus and method for event detection |
CN101102288A (en) * | 2006-07-06 | 2008-01-09 | 阿里巴巴公司 | A method and system for realizing large-scale instant message |
CN103152215A (en) * | 2011-12-06 | 2013-06-12 | 鸿富锦精密工业(深圳)有限公司 | Testing system and testing method of data center |
CN103716398A (en) * | 2013-12-30 | 2014-04-09 | 北京奇虎科技有限公司 | Method and system for monitoring CDN server |
CN103825919A (en) * | 2012-11-16 | 2014-05-28 | 中国移动通信集团北京有限公司 | Method, device and system for data resource caching |
-
2016
- 2016-07-29 CN CN201610616928.1A patent/CN106302002B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050240372A1 (en) * | 2004-04-23 | 2005-10-27 | Monk John M | Apparatus and method for event detection |
CN101102288A (en) * | 2006-07-06 | 2008-01-09 | 阿里巴巴公司 | A method and system for realizing large-scale instant message |
CN103152215A (en) * | 2011-12-06 | 2013-06-12 | 鸿富锦精密工业(深圳)有限公司 | Testing system and testing method of data center |
CN103825919A (en) * | 2012-11-16 | 2014-05-28 | 中国移动通信集团北京有限公司 | Method, device and system for data resource caching |
CN103716398A (en) * | 2013-12-30 | 2014-04-09 | 北京奇虎科技有限公司 | Method and system for monitoring CDN server |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108574604A (en) * | 2017-03-07 | 2018-09-25 | 北京京东尚科信息技术有限公司 | test method and device |
CN110519779A (en) * | 2019-08-26 | 2019-11-29 | Oppo(重庆)智能科技有限公司 | Mobile terminal testing method, device, system and storage medium |
CN110519779B (en) * | 2019-08-26 | 2022-05-13 | Oppo(重庆)智能科技有限公司 | Mobile terminal testing method, device, system and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN106302002B (en) | 2019-10-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9693296B2 (en) | Network connection method and apparatus | |
EP2975821B1 (en) | Network connection method and apparatus | |
CN113364818B (en) | Data processing method and device and electronic equipment | |
CN106603667B (en) | Screen information sharing method and device | |
US10608988B2 (en) | Method and apparatus for bluetooth-based identity recognition | |
CN106209800B (en) | Equipment Authority sharing method and apparatus | |
CN106375096B (en) | short message verification method and device | |
CN104111979A (en) | Search recommendation method and device | |
CN112312222A (en) | Video sending method and device and electronic equipment | |
CN109547480A (en) | A kind of login method and device | |
US20170004212A1 (en) | Method and apparatus for acquiring search results | |
CN105392141A (en) | Device control method and device | |
CN109525652B (en) | Information sharing method, device, equipment and storage medium | |
CN108737588B (en) | Domain name resolution method and device | |
CN107395624B (en) | Information processing method and device | |
CN104050236B (en) | Web site contents update reminding method, server and client side | |
US20160241674A1 (en) | Method and device of filtering address | |
CN110928425A (en) | Information monitoring method and device | |
CN106302002B (en) | Test method and device | |
CN108984417B (en) | Software testing method, device, terminal and storage medium | |
CN109359252B (en) | Browser selection method and device | |
CN104618987B (en) | Access the method and device of network | |
CN111526129B (en) | Information reporting method and device | |
CN109831416A (en) | A kind of login method and device | |
CN105630948B (en) | Network page display method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |