CN113448835A - Static resource testing method and device, electronic equipment and storage medium - Google Patents

Static resource testing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113448835A
CN113448835A CN202011025648.6A CN202011025648A CN113448835A CN 113448835 A CN113448835 A CN 113448835A CN 202011025648 A CN202011025648 A CN 202011025648A CN 113448835 A CN113448835 A CN 113448835A
Authority
CN
China
Prior art keywords
static resource
website
information
tested
resource information
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
Application number
CN202011025648.6A
Other languages
Chinese (zh)
Other versions
CN113448835B (en
Inventor
刘志
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Soyoung Technology Beijing Co Ltd
Original Assignee
Soyoung Technology Beijing Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Soyoung Technology Beijing Co Ltd filed Critical Soyoung Technology Beijing Co Ltd
Priority to CN202011025648.6A priority Critical patent/CN113448835B/en
Publication of CN113448835A publication Critical patent/CN113448835A/en
Application granted granted Critical
Publication of CN113448835B publication Critical patent/CN113448835B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs

Abstract

The application provides a static resource testing method, a device, an electronic device and a storage medium, wherein the method comprises the following steps: receiving test configuration information of a to-be-tested website sent by a terminal, wherein the test configuration information comprises a home page address, a mirror image library address and an operation platform parameter of the to-be-tested website; acquiring a static resource mirror library corresponding to a website to be tested according to the mirror library address and the operating platform parameters, wherein the static resource mirror library comprises static resource information that the website to be tested passes the test; and testing the static resource information contained in the website to be tested according to the static resource mirror library and the home page address. According to the method and the device, the test server automatically judges whether the static resource information included in each webpage of the website to be tested can be normally accessed or not, and tests the normally accessed static resource information according to the tested static resource mirror image information, so that the test efficiency is improved, errors caused by artificial subjective judgment are reduced, the accuracy of a test result is improved, and the online defect of the website is reduced.

Description

Static resource testing method and device, electronic equipment and storage medium
Technical Field
The application belongs to the technical field of internet, and particularly relates to a static resource testing method and device, electronic equipment and a storage medium.
Background
The web pages of the website include many static resources, and the static resources include web page contents such as files and pictures in the formats of HTML (Hyper Text Markup Language), CSS (Cascading Style Sheets), js (javascript), and the like. In the website development process, static resources included in the website need to be tested.
Currently, in the related art, a tester browses each web page of a website through a browser and artificially determines whether static resources included in each web page are normal. Therefore, a large amount of manpower and time are consumed for traversing each webpage of the test website, the test result is greatly influenced by human factors, the subjectivity is strong, and the accuracy of static resource test is poor.
Disclosure of Invention
The application provides a static resource testing method, a static resource testing device, electronic equipment and a storage medium, a testing server automatically judges whether static resource information included in each webpage of a website to be tested can be normally accessed, and the normally accessed static resource information can be tested according to tested static resource mirror image information, so that the testing efficiency is improved, errors caused by artificial subjective judgment are reduced, the accuracy of a testing result is improved, and the online defect of the website is reduced.
The embodiment of the first aspect of the present application provides a static resource testing method, where the method includes;
receiving test configuration information corresponding to a to-be-tested website sent by a terminal, wherein the test configuration information comprises a home page address, a mirror image library address and an operation platform parameter corresponding to the to-be-tested website;
acquiring a static resource mirror image library corresponding to the website to be tested according to the mirror image library address and the operating platform parameter, wherein the static resource mirror image library comprises static resource information which corresponds to the website to be tested and passes the test;
and testing the static resource information contained in the website to be tested according to the static resource mirror library and the home page address.
In some embodiments of the present application, the obtaining a static resource mirror library corresponding to the website to be tested according to the mirror library address and the operating platform parameter includes:
sending a mirror image downloading request to a mirror image library server according to the mirror image library address, wherein the mirror image downloading request comprises the parameters of the operating platform and the mirror image library address;
receiving a static resource mirror library corresponding to the mirror library address returned by the mirror library server;
and determining the received static resource mirror library as the static resource mirror library corresponding to the website to be tested.
In some embodiments of the present application, the testing the static resource information included in the website to be tested according to the static resource mirror library and the home page address includes:
according to the home page address, requesting to download the static resource information included in each webpage of the website to be tested from a website server corresponding to the website to be tested, and obtaining a downloading request result corresponding to each static resource information;
according to the condition that the request downloading result of first static resource information meets a preset downloading rule, comparing whether the first static resource information is consistent with static resource mirror image information corresponding to the first static resource information in the static resource mirror library or not, wherein the first static resource information is any one of the static resource information;
according to the consistency of the first static resource information and the static resource mirror image information, determining that a test result corresponding to the first static resource information is successful;
and determining that the test result corresponding to the first static resource information is test failure according to the condition that the request downloading result of the first static resource information does not meet the preset downloading rule or the condition that the first static resource information is inconsistent with the static resource mirror image information.
In some embodiments of the present application, the requesting, according to the home page address, to download, from a website server corresponding to the website to be tested, static resource information included in each webpage of the website to be tested, and obtaining a download request result corresponding to each static resource information includes:
acquiring a home page of the website to be tested from a website server corresponding to the website to be tested according to the home page address;
acquiring a webpage address corresponding to each webpage included in the website to be tested according to the webpage address corresponding to each skip interface in the home page;
respectively acquiring a webpage corresponding to each webpage address from the website server;
and screening out static resource information from each acquired webpage according to a preset static file format.
In some embodiments of the present application, before the comparing whether the first static resource information is consistent with the static resource mirroring information corresponding to the first static resource information in the static resource mirroring library, the method further includes:
acquiring a resource address corresponding to the first static resource information from a webpage containing the first static resource information;
acquiring a file path corresponding to the first static resource information from the resource address;
and acquiring the static resource mirror image information which passes the test and corresponds to the first static resource information from the static resource mirror image library according to the file path.
In some embodiments of the present application, the comparing whether the first static resource information is consistent with the static resource mirroring information corresponding to the first static resource information in the static resource mirroring library includes:
calculating a first hash value corresponding to the first static resource information and a second hash value corresponding to the static resource image information corresponding to the first static resource information; if the first hash value is the same as the second hash value, determining that the test result corresponding to the first static resource information is successful; alternatively, the first and second electrodes may be,
if the file format of the first static resource information is a non-picture format, determining whether the information content included in the first static resource information is consistent with the information content included in the static resource mirror image information, and if so, determining that the test result corresponding to the first static resource information is a test success.
In some embodiments of the present application, the method further comprises:
generating a test report according to a test result corresponding to each static resource information included in the website to be tested;
and sending the test report to a user according to the mail address included in the test configuration information.
An embodiment of a second aspect of the present application provides a static resource testing apparatus, the apparatus comprising;
the system comprises a receiving module, a judging module and a judging module, wherein the receiving module is used for receiving test configuration information corresponding to a to-be-tested website sent by a terminal, and the test configuration information comprises a home page address, a mirror image library address and an operation platform parameter corresponding to the to-be-tested website;
the acquisition module is used for acquiring a static resource mirror library corresponding to the website to be tested according to the mirror library address and the operating platform parameters, wherein the static resource mirror library comprises static resource information which corresponds to the website to be tested and passes the test;
and the testing module is used for testing the static resource information contained in the website to be tested according to the static resource mirror image library and the home page address.
Embodiments of the third aspect of the present application provide an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the computer program to implement the method of the first aspect.
An embodiment of a fourth aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, the program being executable by a processor to implement the method of the first aspect.
The technical scheme provided in the embodiment of the application at least has the following technical effects or advantages:
in the embodiment of the application, the terminal sends the test configuration information to the test server, and the test server can traverse each webpage of the website to be tested and automatically judge whether the static resource information included in each webpage can be normally accessed. And the test server also acquires a static resource mirror library corresponding to the website to be tested according to the mirror library address included in the test configuration information. And further testing the static resource information which can be normally accessed according to the tested static resource image information included in the static resource image library. By automatically testing the static resources, the testing time is shortened, the testing efficiency is improved, errors caused by artificial subjective judgment are reduced, the accuracy of a testing result is improved, the online defect of a website is reduced, and the competitiveness of the website is enhanced.
Additional aspects and advantages of the present application will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the present application.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the application. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a schematic diagram of a network architecture provided by an embodiment of the present application;
FIG. 2 shows a schematic diagram of a mounting interface of a selenium provided in an embodiment of the present application;
FIG. 3 shows another schematic installation interface diagram of a selenium provided in an embodiment of the present application;
FIG. 4 is a schematic diagram illustrating a test configuration interface provided by an embodiment of the present application;
FIG. 5 is a flowchart illustrating a method for testing static resources according to an embodiment of the present application;
fig. 6 is a schematic structural diagram illustrating a static resource testing apparatus according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 8 is a schematic diagram of a storage medium provided in an embodiment of the present application.
Detailed Description
Exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
It is to be noted that, unless otherwise specified, technical or scientific terms used herein shall have the ordinary meaning as understood by those skilled in the art to which this application belongs.
A static resource testing method, a static resource testing apparatus, an electronic device, and a storage medium according to embodiments of the present application are described below with reference to the accompanying drawings.
The web page of the website contains a lot of static resource information, the static resource information is information fixed in the web page, and when the terminal browses the web page, the static resource information can be directly displayed in the web page without searching a database or performing program processing. If the static resource information needs to be modified, the webpage containing the static resource information needs to be modified, and the access efficiency of the static resource information is very high. The static resource information may include web page content such as files or pictures formatted in HTML, CSS, JS, etc.
In the related art, static resource information in a web page is tested, usually a tester browses each web page of a website through a browser, and manually determines whether the static resource information included in each web page can be normally accessed. Therefore, a large amount of manpower and time are consumed for traversing each webpage of the website, the test result is greatly influenced by human factors, the subjectivity is strong, and the accuracy of the static resource test is poor.
The embodiment of the application provides a static resource testing method, a network architecture based on the method is shown in figure 1, the network architecture comprises a terminal, a testing server, a website server and a mirror library server, and the terminal, the testing server, the website server and the mirror library server are in communication connection through the internet. The terminal is provided with an application program for static resource testing, and the server terminal corresponding to the test server for the application program can be a mobile phone or a computer. The application program can be test software such as selenium or waiter. The mirror image library server is used for storing static resource information which passes the test under the test environment and corresponds to the website.
In the embodiment of the application, the static resource mirror library corresponding to the website to be tested is stored in the mirror library server. As an example, the mirror library server may be a GitLab server, which is an open source item for the warehouse management system. In the embodiment of the application, after the technical staff completes the development and test of the to-be-tested website, all static resource information included in the to-be-tested website passes the test, and the static resource information passing the test in the to-be-tested website is stored in the GitLab server. The method comprises the steps that a GitLab server allocates a storage address for static resource information which passes the test in a to-be-tested website, the storage address is called a mirror library address in the embodiment of the application, the static resource information which passes the test and is stored in the GitLab server is called static resource mirror image information, and a set formed by all the static resource information which passes the test of the website is called a static resource mirror image library corresponding to the website. Because the running platform of the website to be tested may be a Web end or a mobile end, and the same website runs on the Web end and the mobile end, the static resource information may have some differences, as if the size of one static resource information running on the Web end is larger than that running on the mobile end. Therefore, the static resource mirror image information corresponding to the website to be tested in the GitLab server is classified and stored according to different running platforms.
The method provided by the embodiment of the application not only judges whether each static resource information included in the website to be tested can be normally accessed. And for the static resource information which can be normally accessed, comparing the static resource information with the static resource mirror image information which passes the test and is included in the static resource mirror image library corresponding to the website to be tested, if the static resource information is consistent with the static resource mirror image information, the static resource information passes the test, otherwise, the static resource information fails to test. The method automatically tests the static resources, shortens the testing time, improves the testing efficiency, reduces errors caused by artificial subjective judgment, improves the accuracy of the testing result, reduces the online defect of the website, and enhances the competitiveness of the website.
Taking an application program as an example, a terminal first downloads an installation package of NetScan software, the installation package is usually a compressed file, the terminal decompresses the installation package, and executes an executable file fescan. In the installation process, the start service interface shown in fig. 2 pops up, the user inputs the IP address of the terminal in a local IP (Internet Protocol) input interface included in the start service interface, and clicks a start service button in the start service interface. When the terminal detects that the start service button is clicked, the terminal acquires the IP address of the terminal from the local IP input interface, transmits the IP address as a start parameter into a start command of the selenium, then executes the start command of the selenium, and completes the start process of the selenium, as shown in fig. 3.
After the test software is downloaded and installed in the terminal, the test software is run directly in the browser on the terminal. In the embodiment of the present application, a test entry is set in the website to be tested, and the test entry may be a key or a hyperlink, for example, the test entry may be a key "FE test execution" shown in fig. 4. When a user needs to test the static resource information of the website to be tested, the user logs in the website to be tested through a browser of the terminal and clicks a test entrance in the website to be tested. When the terminal detects that the test entry is clicked, a test configuration interface is displayed, the test configuration interface includes a plurality of test parameter interfaces, the test parameter interfaces may include a running environment interface, a running platform interface, a local IP interface, a home address interface, a mirror library address interface, a mail address interface, and the like, and the test configuration interface may be an interface shown in fig. 4.
The operation environment interface is used for receiving operation environment parameters input by a user, the operation environment parameters indicate whether the operation environment of the current to-be-tested website is a test environment or a normal user access environment, if the operation environment parameters are test, the current operation environment is the test environment, and if the operation environment parameters are user, the current operation environment is the normal user access environment. The operation platform interface is used for receiving operation platform parameters input by a user, if the operation platform of the website to be tested is a Web end, the operation platform parameters can be 'www' or 'b', and if the operation platform of the website to be tested is a mobile end, the operation platform parameters can be'm'.
In some embodiments of the present application, the running platform parameters of the website to be tested may be preset in the website to be tested. Under the condition that the website to be tested does not need user authentication and is only used inside the local area network, the user can automatically acquire the preset operation platform parameters from the website to be tested by the terminal instead of submitting the operation platform parameters through the test configuration interface.
The local IP interface is used for receiving the IP address of the terminal input by the user. The home page address interface is used for receiving a home page address of a website to be tested, which is input by a user. The mirror image library address interface is used for receiving a storage address of a static resource mirror image library corresponding to a website to be tested, which is input by a user. The mail address interface is used for receiving a feedback address which is input by a user and used for receiving the test result.
The test configuration interface may further include an execution user ID interface, a screen resolution interface, and the like. The user ID is executed to determine the authority of the user, for example, only the tester has the authority to test the static resource, and the user ID is executed to identify whether the current user is the tester with the authority. Because some websites can be tested only after logging in, the position of the login window in the screen and the screen resolution have a certain quantitative relationship by writing a program in the development stage. In the testing stage, after a user inputs the screen resolution in the testing configuration interface, the position of the login window can be determined through the screen resolution, and information such as an account number and a password input by the user is acquired from the login window to complete login operation. The execution user ID interface and the screen resolution interface "resolution screen width" and "resolution screen height" are shown in the test configuration interface shown in fig. 4.
In the embodiment of the application, the test configuration interface may not include a home page address interface, and a user does not need to manually input a home page address corresponding to a website to be tested. But an operation platform parameter interface and an operation environment parameter interface are provided in the test configuration interface, and a user only needs to submit the operation platform parameters and the operation environment parameters of the website to be tested in the operation platform parameter interface. The terminal acquires the domain name of the website to be tested from the currently logged website page. And automatically generating the home page address of the website to be tested according to the operating platform parameters and the operating environment parameters of the website to be tested and the acquired domain name. For example, assuming "www", the operating environment parameter is test, and the obtained domain name is "wangzhan 1. com", the home page address "http:// www.sy.wangzhan1.com" of the website to be tested, wangzhan1, may be automatically generated.
And after the terminal obtains each test parameter through the test configuration interface, the terminal forms the received test parameters into test configuration information and sends the test configuration information to a test server corresponding to the test software installed on the terminal. The testing server tests each static resource information included in the website to be tested through the method provided by the embodiment of the application.
Referring to fig. 5, the method specifically includes the following steps;
step 101: and receiving test configuration information corresponding to a to-be-tested website sent by a terminal, wherein the to-be-tested website comprises a home page address, a mirror image library address and an operation platform parameter corresponding to the to-be-tested website.
The execution main body of the embodiment of the application is the test server, the test server receives test configuration information corresponding to the to-be-tested website sent by the terminal, and the test configuration information can include a home page address, a mirror image library address and an operation platform parameter corresponding to the to-be-tested website, and includes an IP address of the terminal, a mail address for receiving a test result and the like.
Step 102: and acquiring a static resource mirror library corresponding to the website to be tested according to the mirror library address and the operating platform parameters, wherein the static resource mirror library comprises static resource information which corresponds to the website to be tested and passes the test.
And sending an image downloading request to an image library server according to the image library address, wherein the image downloading request comprises the parameters of the operating platform and the image library address. And after receiving the mirror image downloading request, the mirror image library server inquires all the static resource mirror image information corresponding to the mirror image library address. And according to the running platform parameters included in the image downloading request, obtaining the static resource image information corresponding to the running platform parameters from all the inquired static resource image information, and determining the obtained static resource image information as a static resource image library corresponding to the website to be tested. And the mirror image library server sends the static resource mirror image library corresponding to the website to be tested to the test server.
For example, assuming the mirror library server is a GitLab server, the mirror library address may be "http:// GitLab. wangzhan1. com/". And sending an image downloading request to the GitLab server according to the image library address, wherein the image downloading request can comprise an image library address' http:// GitLab. And after receiving the mirror image downloading request, the mirror image library server inquires all static resource mirror image information corresponding to the mirror image library address 'http:// gitlab. wangzhan1. com/'. And acquiring static resource mirror image information corresponding to the operating platform parameter 'www' from all the inquired static resource mirror image information.
And the test server receives the static resource mirror library corresponding to the mirror library address returned by the mirror library server, and determines the received static resource mirror library as the static resource mirror library corresponding to the website to be tested.
Step 103: and testing the static resource information contained in the website to be tested according to the static resource mirror library and the home page address.
The embodiment of the application specifically tests the static resource information contained in the website to be tested through the following steps a1-a5, and specifically includes:
a1: and according to the home page address, requesting to download the static resource information included in each webpage of the website to be tested from the website server corresponding to the website to be tested, and obtaining a downloading request result corresponding to each static resource information.
And acquiring a home page of the website to be tested from a website server corresponding to the website to be tested according to the home page address, wherein the home page comprises a plurality of jump interfaces, and each jump interface corresponds to a webpage address. And acquiring a webpage address corresponding to each webpage included in the website to be tested according to the webpage address corresponding to each jump interface in the home page. And respectively acquiring the webpage corresponding to each webpage address from the website server.
As the home page comprises the webpage addresses corresponding to the plurality of jump interfaces, the webpage jumps to the webpage corresponding to any webpage address from the home page, and the webpage comprises the webpage addresses corresponding to the plurality of jump interfaces. Starting from the home page, the website to be tested including any one webpage can be obtained by traversing the webpage address corresponding to each jump interface in each webpage. When a webpage of a website to be tested is acquired, static resource information included in the webpage is screened out from the acquired webpage according to a preset static file format. The preset static file format may include html,. CSS,. js,. JPG,. GIF,. PNG,. JPEG, and the like.
The static resource information included by each webpage is respectively screened out from each webpage of the website to be tested through the mode. When the test server obtains the web pages of the to-be-tested website from the website server, there may be a case where some static resource information in some web pages fails to be downloaded, and the download request result corresponding to the static resource information that fails to be downloaded is an identifier for identifying the download failure, such as 0 or fail. And the request downloading result corresponding to the successfully downloaded static resource information is an identifier for identifying successful downloading, such as 1 or success.
And after the request downloading result corresponding to each piece of static resource information is obtained, respectively determining the test result corresponding to each piece of static resource information according to the request downloading result corresponding to each piece of static resource information and the static resource mirror library. The testing mode is the same for any static resource information included in the website to be tested. In the embodiment of the present application, a test process of static resource information is described by taking any one of the static resource information as an example, and the static resource information is referred to as first static resource information in the embodiment of the present application.
A2: and judging whether the requested downloading result of the first static resource information meets a preset downloading rule, if so, executing the step A3, and if not, executing the step A4.
The preset downloading rule comprises downloading failure or incomplete downloaded content and the like. If the first static resource information is completely downloaded, the request downloading result of the first static resource information is the complete content of the first static resource information. If only a part of the first static resource information is downloaded, the requested downloading result of the first static resource information is the downloaded part of the content. If the first static resource information fails to be downloaded, the web server returns an error prompt, such as 404 error prompt information or 505 error prompt information, in which case the requested download result corresponding to the first static resource information is the error prompt returned by the web server.
In this embodiment of the application, in the process of transmitting the first static resource information to the test server, if all the contents of the first static resource information are transmitted, the website server further transmits an identifier for identifying that the transmission is completed to the test server, where the identifier may be 0 or 1. The test server may determine from the identifier that the contents of the first static resource information are all downloaded.
After the test server obtains the download request result corresponding to the first static resource information, if the download request result is an error prompt, or if the content of the first static resource information included in the download request result does not include an identifier for identifying that the transmission is completed, it is determined that the download request result corresponding to the first static resource information satisfies the preset download rule, and then step a3 is performed. If the test server determines that the content of the first static resource information included in the request downloading result includes the identifier for identifying that the transmission is completed, it is determined that the request downloading result corresponding to the first static resource information does not satisfy the preset downloading rule, and step a4 is subsequently performed.
A3: and determining that the test result corresponding to the first static resource information is a test failure.
A4: and comparing whether the first static resource information is consistent with the static resource mirror information corresponding to the first static resource information in the static resource mirror library, if so, executing the step A5, and if not, executing the step A3.
Before comparing the first static resource information with the static resource mirror image information corresponding to the first static resource information in the static resource mirror image library, first extracting the static resource mirror image information corresponding to the first static resource information from the static resource mirror image library. Specifically, a resource address corresponding to the first static resource information is obtained from a webpage containing the first static resource information, and a file path corresponding to the first static resource information is obtained from the resource address, where the file path is used to indicate a position of the first static resource information in the webpage containing the first static resource information. And acquiring the static resource mirror image information which passes the test and corresponds to the first static resource information from the static resource mirror image library according to the file path. Each piece of static resource image information stored in the static resource image library comprises a file path corresponding to the static resource image information.
For example, if the resource address corresponding to the first static resource information is "http:// www.wangzhan1.com/a1/a2/a 3", then "a 1/a2/a 3" is the file path corresponding to the first static resource information. And acquiring the static resource image information which is the same as the file path of the first static resource information from the static resource image library according to the file path 'a 1/a2/a 3'.
After obtaining the static resource image information having the same file path as the first static resource information from the static resource image library corresponding to the website to be tested in the above manner, comparing whether the obtained static resource image information is consistent with the first static resource information in any one of the following first or second manners, specifically including:
firstly, calculating a first hash value corresponding to first static resource information and a second hash value corresponding to static resource image information corresponding to the first static resource information; if the first hash value is the same as the second hash value, it is determined that the first static resource information is consistent with the corresponding static resource image information, and step a5 is performed subsequently. If the first hash value is not the same as the second hash value, the first static resource information is inconsistent with the corresponding static resource image information, and the step a3 is executed.
Secondly, firstly, whether the file format of the first static resource information is a picture format is judged, and the picture format can comprise JPG, GIF, PNG, JPEG and the like. And if the file format of the first static resource information is determined to be the picture format, performing hash operation on the first static resource information and the static resource image information corresponding to the first static resource information respectively to obtain a hash value corresponding to the static resource image information and a hash value corresponding to the first static resource information respectively. And B, judging whether the hash values of the first static resource information and the second static resource information are the same, if so, determining that the first static resource information is the same as the corresponding static resource image information, and executing the step A5. If the hash values of the first static resource information and the hash values of the second static resource information are different, determining that the first static resource information is different from the corresponding static resource image information, and returning to execute the step A3.
If the file format of the first static resource information is determined to be a non-picture format, the file format of html, CSS, js and the like. Performing character comparison on the first static resource information and the corresponding static resource mirror image information, if it is determined that each character of the first static resource information is the same as that of the corresponding static resource mirror image information, determining that the information content included in the first static resource information is consistent with that included in the static resource mirror image information, and executing step a 5. If the first static resource information contains the character which is different from the corresponding static resource mirror image information, the information content contained in the first static resource information is determined to be inconsistent with the information content contained in the static resource mirror image information, and the step a3 is returned to.
A5: and determining that the test result corresponding to the first static resource information is successful.
And respectively determining the test result corresponding to each static resource information according to any one of the first mode and the second mode for any other static resource information included in the website to be tested. And then generating a test report according to the test result corresponding to each piece of static resource information included in the to-be-tested website, and recording the resource address of the static resource information which fails in the test, the reason of the test failure and the like in the test report. For the static resource information which fails to be downloaded, the reason of the test failure is the download failure. For the static resource information which is successfully downloaded but is inconsistent with the static resource mirror image information, the reason for the test failure is that the static resource information is inconsistent with the static resource mirror image information. For the static resource information which is successfully downloaded but is inconsistent with the static resource mirror image information, the test report may also record the static resource information and the corresponding static resource mirror image information.
After the test report of the website to be tested is generated, the test report can be sent to the terminal according to the IP address of the terminal included in the test configuration information. And sending a test report to a mailbox of the user according to the mail address included in the test configuration information. The email address may include a plurality of email addresses, such as a receive email address and a carbon copy email address.
In the embodiment of the application, the terminal sends the test configuration information to the test server, and the test server can traverse each webpage of the website to be tested and automatically judge whether the static resource information included in each webpage can be normally accessed. And the test server also acquires a static resource mirror library corresponding to the website to be tested according to the mirror library address included in the test configuration information. And further testing the static resource information which can be normally accessed according to the tested static resource image information included in the static resource image library. By automatically testing the static resources, the testing time is shortened, the testing efficiency is improved, errors caused by artificial subjective judgment are reduced, the accuracy of a testing result is improved, the online defect of a website is reduced, and the competitiveness of the website is enhanced.
An embodiment of the present application provides a static resource testing apparatus, where the apparatus is configured to execute the static resource testing method described in the foregoing embodiment, and referring to fig. 6, the apparatus includes:
the receiving module 601 is configured to receive test configuration information corresponding to a to-be-tested website sent by a terminal, where the test configuration information includes a home page address, a mirror library address, and an operating platform parameter corresponding to the to-be-tested website;
an obtaining module 602, configured to obtain a static resource mirror library corresponding to a website to be tested according to a mirror library address and an operation platform parameter, where the static resource mirror library includes static resource information that has passed a test and corresponds to the website to be tested;
the testing module 603 is configured to test the static resource information included in the website to be tested according to the static resource mirror library and the home page address.
An obtaining module 602, configured to send a mirror image download request to a mirror image library server according to a mirror image library address, where the mirror image download request includes an operation platform parameter and a mirror image library address; receiving a static resource mirror library corresponding to the operation platform parameters and the mirror library address returned by the mirror library server; and determining the received static resource mirror library as the static resource mirror library corresponding to the website to be tested.
The test module 603 includes:
the downloading unit is used for requesting to download the static resource information included in each webpage of the website to be tested from the website server corresponding to the website to be tested according to the home page address to obtain a downloading request result corresponding to each static resource information;
the test result determining unit is used for comparing whether the first static resource information is consistent with the static resource mirror image information corresponding to the first static resource information in the static resource mirror library according to the condition that the request downloading result of the first static resource information does not meet the preset downloading rule, wherein the first static resource information is any one of the static resource information; according to the consistency of the first static resource information and the static resource mirror image information, determining that the test result corresponding to the first static resource information is successful; and determining that the test result corresponding to the first static resource information is test failure according to the condition that the request downloading result of the first static resource information meets the preset downloading rule or the condition that the first static resource information is inconsistent with the static resource mirror image information.
The downloading unit is used for acquiring a home page of the website to be tested from a website server corresponding to the website to be tested according to the home page address; acquiring a webpage address corresponding to each webpage included in a website to be tested according to the webpage address corresponding to each jump interface in the home page; respectively acquiring a webpage corresponding to each webpage address from a website server; and screening out static resource information from each acquired webpage according to a preset static file format.
The test result determining unit is further used for acquiring a resource address corresponding to the first static resource information from the webpage containing the first static resource information; acquiring a file path corresponding to the first static resource information from the resource address; and acquiring the static resource mirror image information which passes the test and corresponds to the first static resource information from the static resource mirror image library according to the file path.
The test result determining unit is specifically used for calculating a first hash value corresponding to the first static resource information and a second hash value corresponding to the static resource image information corresponding to the first static resource information; if the first hash value is the same as the second hash value, determining that the test result corresponding to the first static resource information is successful; or if the file format of the first static resource information is a non-picture format, determining whether the information content included in the first static resource information is consistent with the information content included in the static resource mirror image information, and if so, determining that the test result corresponding to the first static resource information is a test success.
The device also includes: the test report generating and sending module is used for generating a test report according to a test result corresponding to each piece of static resource information included in the to-be-tested website; and sending a test report to the user according to the mail address included in the test configuration information.
The static resource testing device provided by the above embodiment of the present application and the static resource testing method provided by the embodiment of the present application have the same inventive concept and have the same beneficial effects as the method adopted, operated or implemented by the application program stored in the static resource testing device.
The embodiment of the present application further provides an electronic device corresponding to the static resource testing method provided in the foregoing embodiment, so as to execute the static resource testing method. The embodiments of the present application are not limited.
Please refer to fig. 7, which illustrates a schematic diagram of an electronic device according to some embodiments of the present application. As shown in fig. 7, the electronic device 2 includes: the system comprises a processor 200, a memory 201, a bus 202 and a communication interface 203, wherein the processor 200, the communication interface 203 and the memory 201 are connected through the bus 202; the memory 201 stores a computer program that can be executed on the processor 200, and the processor 200 executes the static resource testing method provided by any one of the foregoing embodiments when executing the computer program.
The Memory 201 may include a high-speed Random Access Memory (RAM) and may further include a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. The communication connection between the network element of the system and at least one other network element is realized through at least one communication interface 203 (which may be wired or wireless), and the internet, a wide area network, a local network, a metropolitan area network, and the like can be used.
Bus 202 can be an ISA bus, PCI bus, EISA bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. The memory 201 is used for storing a program, and the processor 200 executes the program after receiving an execution instruction, and the static resource testing method disclosed in any of the foregoing embodiments of the present application may be applied to the processor 200, or implemented by the processor 200.
The processor 200 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 200. The Processor 200 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in the memory 201, and the processor 200 reads the information in the memory 201 and completes the steps of the method in combination with the hardware thereof.
The electronic device provided by the embodiment of the application and the static resource testing method provided by the embodiment of the application have the same inventive concept and have the same beneficial effects as the method adopted, operated or realized by the electronic device.
Referring to fig. 8, the computer readable storage medium is an optical disc 30, and a computer program (i.e., a program product) is stored thereon, and when being executed by a processor, the computer program executes the static resource testing method provided in any of the foregoing embodiments.
It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory, or other optical and magnetic storage media, which are not described in detail herein.
The computer-readable storage medium provided by the above-mentioned embodiment of the present application and the static resource testing method provided by the embodiment of the present application have the same beneficial effects as the method adopted, run or implemented by the application program stored in the computer-readable storage medium.
It should be noted that the above-mentioned embodiments illustrate rather than limit the application, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The application may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.
The above description is only for the preferred embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present application should be covered within the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A static resource testing method is characterized by comprising the following steps of;
receiving test configuration information corresponding to a to-be-tested website sent by a terminal, wherein the test configuration information comprises a home page address, a mirror image library address and an operation platform parameter corresponding to the to-be-tested website;
acquiring a static resource mirror image library corresponding to the website to be tested according to the mirror image library address and the operating platform parameter, wherein the static resource mirror image library comprises static resource mirror image information which corresponds to the website to be tested and passes the test;
and testing the static resource information contained in the website to be tested according to the static resource mirror library and the home page address.
2. The method according to claim 1, wherein the obtaining a static resource mirror library corresponding to the website to be tested according to the mirror library address and the operating platform parameter comprises:
sending a mirror image downloading request to a mirror image library server according to the mirror image library address, wherein the mirror image downloading request comprises the parameters of the operating platform and the mirror image library address;
receiving a static resource mirror library corresponding to the mirror library address returned by the mirror library server;
and determining the received static resource mirror library as the static resource mirror library corresponding to the website to be tested.
3. The method according to claim 1, wherein the testing the static resource information included in the website to be tested according to the static resource mirror library and the home page address comprises:
according to the home page address, requesting to download the static resource information included in each webpage of the website to be tested from a website server corresponding to the website to be tested, and obtaining a downloading request result corresponding to each static resource information;
according to the condition that the request downloading result of first static resource information does not meet a preset downloading rule, comparing whether the first static resource information is consistent with static resource mirror image information corresponding to the first static resource information in the static resource mirror library or not, wherein the first static resource information is any one of the static resource information;
according to the consistency of the first static resource information and the static resource mirror image information, determining that a test result corresponding to the first static resource information is successful;
and determining that the test result corresponding to the first static resource information is a test failure according to the condition that the request downloading result of the first static resource information meets the preset downloading rule or the condition that the first static resource information is inconsistent with the static resource mirror image information.
4. The method according to claim 3, wherein the requesting, according to the home page address, to download the static resource information included in each web page of the website to be tested from the website server corresponding to the website to be tested to obtain a downloading request result corresponding to each static resource information includes:
acquiring a home page of the website to be tested from a website server corresponding to the website to be tested according to the home page address;
acquiring a webpage address corresponding to each webpage included in the website to be tested according to the webpage address corresponding to each skip interface in the home page;
respectively acquiring a webpage corresponding to each webpage address from the website server;
and screening out static resource information from each acquired webpage according to a preset static file format.
5. The method according to claim 3, wherein before the comparing whether the first static resource information is consistent with the static resource mirroring information corresponding to the first static resource information in the static resource mirroring library, the method further comprises:
acquiring a resource address corresponding to the first static resource information from a webpage containing the first static resource information;
acquiring a file path corresponding to the first static resource information from the resource address;
and acquiring the static resource mirror image information which passes the test and corresponds to the first static resource information from the static resource mirror image library according to the file path.
6. The method according to claim 3, wherein the comparing whether the first static resource information is consistent with the static resource mirroring information corresponding to the first static resource information in the static resource mirroring library comprises:
calculating a first hash value corresponding to the first static resource information and a second hash value corresponding to the static resource image information corresponding to the first static resource information; if the first hash value is the same as the second hash value, determining that the test result corresponding to the first static resource information is successful; alternatively, the first and second electrodes may be,
if the file format of the first static resource information is a non-picture format, determining whether the information content included in the first static resource information is consistent with the information content included in the static resource mirror image information, and if so, determining that the test result corresponding to the first static resource information is a test success.
7. The method according to any one of claims 3-6, further comprising:
generating a test report according to a test result corresponding to each static resource information included in the website to be tested;
and sending the test report to a user according to the mail address included in the test configuration information.
8. A static resource testing apparatus, the apparatus comprising;
the system comprises a receiving module, a judging module and a judging module, wherein the receiving module is used for receiving test configuration information corresponding to a to-be-tested website sent by a terminal, and the test configuration information comprises a home page address, a mirror image library address and an operation platform parameter corresponding to the to-be-tested website;
the acquisition module is used for acquiring a static resource mirror library corresponding to the website to be tested according to the mirror library address and the operating platform parameters, wherein the static resource mirror library comprises static resource information which corresponds to the website to be tested and passes the test;
and the testing module is used for testing the static resource information contained in the website to be tested according to the static resource mirror image library and the home page address.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor executes the computer program to implement the method of any one of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, characterized in that the program is executed by a processor to implement the method according to any of claims 1-7.
CN202011025648.6A 2020-09-25 2020-09-25 Static resource testing method and device, electronic equipment and storage medium Active CN113448835B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011025648.6A CN113448835B (en) 2020-09-25 2020-09-25 Static resource testing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011025648.6A CN113448835B (en) 2020-09-25 2020-09-25 Static resource testing method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113448835A true CN113448835A (en) 2021-09-28
CN113448835B CN113448835B (en) 2023-10-20

Family

ID=77808600

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011025648.6A Active CN113448835B (en) 2020-09-25 2020-09-25 Static resource testing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113448835B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8788703B1 (en) * 2013-08-05 2014-07-22 Iboss, Inc. Content caching
CN107526678A (en) * 2016-06-22 2017-12-29 平安科技(深圳)有限公司 The method of testing and device of web application
CN108268370A (en) * 2016-12-30 2018-07-10 中国移动通信集团浙江有限公司 Based on Referer and the matched Website quality analysis method of template library, device and system
US20180234329A1 (en) * 2017-02-16 2018-08-16 International Business Machines Corporation Test building for testing server operation
CN108958890A (en) * 2018-07-25 2018-12-07 北京奇艺世纪科技有限公司 Container microscope testing method, apparatus and electronic equipment
CN110674048A (en) * 2019-09-27 2020-01-10 北京新氧科技有限公司 Buried point test feature acquisition method and related device
CN111368231A (en) * 2020-02-21 2020-07-03 上海红神信息技术有限公司 Method and device for testing heterogeneous redundant architecture website
CN111431767A (en) * 2020-03-26 2020-07-17 深圳壹账通智能科技有限公司 Multi-browser resource synchronization method and device, computer equipment and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8788703B1 (en) * 2013-08-05 2014-07-22 Iboss, Inc. Content caching
CN107526678A (en) * 2016-06-22 2017-12-29 平安科技(深圳)有限公司 The method of testing and device of web application
CN108268370A (en) * 2016-12-30 2018-07-10 中国移动通信集团浙江有限公司 Based on Referer and the matched Website quality analysis method of template library, device and system
US20180234329A1 (en) * 2017-02-16 2018-08-16 International Business Machines Corporation Test building for testing server operation
CN108958890A (en) * 2018-07-25 2018-12-07 北京奇艺世纪科技有限公司 Container microscope testing method, apparatus and electronic equipment
CN110674048A (en) * 2019-09-27 2020-01-10 北京新氧科技有限公司 Buried point test feature acquisition method and related device
CN111368231A (en) * 2020-02-21 2020-07-03 上海红神信息技术有限公司 Method and device for testing heterogeneous redundant architecture website
CN111431767A (en) * 2020-03-26 2020-07-17 深圳壹账通智能科技有限公司 Multi-browser resource synchronization method and device, computer equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
姚昕: "基于Loadrunner技术的Web性能测试的研究与实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》, no. 03, pages 138 - 458 *
徐皓: "某商业银行智能终端手机银行的设计与实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》, no. 10, pages 138 - 330 *

Also Published As

Publication number Publication date
CN113448835B (en) 2023-10-20

Similar Documents

Publication Publication Date Title
US9203720B2 (en) Monitoring the health of web page analytics code
US20190026297A1 (en) Method for detecting and analyzing site quality
US20130054792A1 (en) Cloud-based performance testing of functionality of an application prior to completion of development
US7392321B1 (en) Method and system for evaluating quality of service for transactions over a network
CN108628748B (en) Automatic test management method and automatic test management system
CN109902247B (en) Page rendering method and device and electronic equipment
CN111552632B (en) Interface testing method and device
CN112540924A (en) Interface automation test method, device, equipment and storage medium
CN114546881B (en) Application software testing method, electronic device and computer readable storage medium
CN111258904A (en) Webpage element testing method and related device
CN111694550A (en) Page display control method, device and system
CN113742250A (en) Automatic interface testing method and device
CN113408254A (en) Page form information filling method, device, equipment and readable medium
CN113448835B (en) Static resource testing method and device, electronic equipment and storage medium
CN106998255B (en) Feedback processing server, network system and feedback processing method
CN113934617A (en) Data processing method, device, equipment and storage medium
CN108287813B (en) Information submission method and device and electronic equipment
CN115514677B (en) Method and system for server dial testing
CN115599683A (en) Automatic testing method, device, equipment and storage medium
CN115373885A (en) Fault repairing method and device, storage medium and electronic equipment
CN110297854B (en) APP domain name verification method and system
CN110061864B (en) Method and system for automatically verifying domain name configuration
CN112580334A (en) File processing method, file processing device, server and storage medium
CN109324822B (en) PWA (public warning assistant) item detection method, computer-readable storage medium and terminal device
CN113656739A (en) Website data storage method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant