CN113448835B - 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
CN113448835B
CN113448835B CN202011025648.6A CN202011025648A CN113448835B CN 113448835 B CN113448835 B CN 113448835B CN 202011025648 A CN202011025648 A CN 202011025648A CN 113448835 B CN113448835 B CN 113448835B
Authority
CN
China
Prior art keywords
static resource
website
information
resource information
mirror image
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.)
Active
Application number
CN202011025648.6A
Other languages
Chinese (zh)
Other versions
CN113448835A (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.)
Beijing New Oxygen World Wide Technology Consulting 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

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application provides a static resource testing method, a static resource testing device, electronic equipment and a storage medium, wherein the method comprises the following steps: receiving test configuration information of a website to be tested, wherein the test configuration information comprises a home address, a mirror image library address and operation platform parameters of the website to be tested, which are sent by a terminal; acquiring a static resource mirror image library corresponding to the website to be tested according to the mirror image library address and the operation platform parameters, wherein the static resource mirror image library comprises static resource information of the website to be tested which passes the test; and 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. According to the application, the test server automatically judges whether the static resource information included in each webpage of the website to be tested can be normally accessed, and tests the static resource information which can be normally accessed according to the static resource mirror image information which has passed the test, so that the test efficiency is improved, errors caused by artificial subjective judgment are reduced, the accuracy of test results 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, a static resource testing device, electronic equipment and a storage medium.
Background
The web pages of the web site contain many static resources, and the static resources include web page contents such as files or pictures in the format of HTML (Hyper Text Markup Language ), CSS (Cascading Style Sheets, cascading style sheets), JS (JavaScript), and the like. In the web site development process, static resources included in the web site need to be tested.
Currently, in the related art, a tester browses each web page of a website through a browser, and manually judges whether static resources included in each web page are normal. Therefore, a great deal of manpower and time are required to be consumed for traversing each webpage of the test website, the test result is greatly influenced by human factors, subjectivity is high, and the accuracy of static resource test is poor.
Disclosure of Invention
The application provides a static resource testing method, a device, electronic equipment and a storage medium, wherein a testing server automatically judges whether static resource information included in each webpage of a website to be tested can be normally accessed, and tests the static resource information which can be normally accessed according to the static resource mirror image information which has passed the test, 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.
An embodiment of a first aspect of the present application provides a static resource testing method, including;
receiving test configuration information corresponding to a website to be tested, which is 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 website to be tested;
acquiring a static resource mirror image library corresponding to the website to be tested according to the mirror image library address and the operation 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 image library and the home page address.
In some embodiments of the present application, the obtaining, according to the image library address and the operation platform parameter, the static resource image library corresponding to the website to be tested 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 operation platform parameter and the mirror image library address;
receiving a static resource mirror image library corresponding to the mirror image library address returned by the mirror image library server;
And determining the received static resource mirror image library as a static resource mirror image 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:
requesting to download static resource information included in each webpage of the website to be tested from a website server corresponding to the website to be tested according to the home page address, and obtaining a request downloading result corresponding to each static resource information;
according to the request downloading result of the first static resource information, a preset downloading rule is met, 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 image library is compared, and the first static resource information is any static resource information in each 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 fact that the request downloading result of the first static resource information does not meet the preset downloading rule or 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 static resource information included in each web page of the website to be tested from a website server corresponding to the website to be tested, to obtain a request downloading 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 jump port in the home page;
respectively acquiring webpages corresponding to each webpage address from the website server;
and screening out the static resource information from each acquired webpage according to a preset static file format.
In some embodiments of the present application, before comparing whether the first static resource information is consistent with static resource image information corresponding to the first static resource information in the static resource image 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 image information which passes the test and corresponds to the first static resource information from the static resource 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 static resource image information corresponding to the first static resource information in the static resource image library includes:
calculating a first hash value corresponding to the first static resource information and a second hash value corresponding to the static resource mirror 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 successful.
In some embodiments of the application, the method further comprises:
generating a test report according to a test result corresponding to each piece of 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.
Embodiments of the second aspect of the present application provide a static resource testing device, the device comprising;
the system comprises a receiving module, a testing module and a testing module, wherein the receiving module is used for receiving testing configuration information corresponding to a website to be tested, which is sent by a terminal, and the testing configuration information comprises a home page address, a mirror image library address and an operation platform parameter corresponding to the website to be tested;
the acquisition module is used for acquiring a static resource mirror image library corresponding to the website to be tested according to the mirror image library address and the operation 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 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.
An embodiment of a third aspect of the present application provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor running the computer program to implement the method of the first aspect.
An embodiment of the fourth aspect of the present application provides a computer-readable storage medium having stored thereon a computer program for execution by a processor to perform the method of the first aspect described above.
The technical scheme provided by the embodiment of the application has at least 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 static resource information included in each webpage can be normally accessed. And the test server also acquires a static resource mirror image library corresponding to the website to be tested according to the mirror image library address included in the test configuration information. And further testing the static resource information which can be normally accessed according to the static resource image information which passes the test and is 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 the testing result is improved, the online defects of the website are reduced, and the competitiveness of the website is enhanced.
Additional aspects and advantages of the 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 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 designate like parts throughout the figures. In the drawings:
FIG. 1 is a schematic diagram of a network architecture according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a selenium installation interface according to one embodiment of the present application;
FIG. 3 illustrates another mounting interface schematic of selenium provided by an embodiment of the present application;
FIG. 4 is a schematic diagram of a test configuration interface provided by an embodiment of the present application;
FIG. 5 is a flow chart illustrating a static resource testing method according to an embodiment of the present application;
FIG. 6 is a schematic diagram illustrating a static resource testing device according to an embodiment of the present application;
FIG. 7 is a schematic diagram of an electronic device according to an embodiment of the present application;
fig. 8 is a schematic diagram of a storage medium according to 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 application to those skilled in the art.
It is noted that unless otherwise indicated, technical or scientific terms used herein should be given the ordinary meaning as understood by one of ordinary skill in the art to which this application belongs.
The following describes a static resource testing method, a static resource testing device, an electronic device and a storage medium according to an embodiment of the present application 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 checking 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 high. The static resource information may include web page content such as files or pictures in the format HTML, CSS, JS, etc.
In the related art, static resource information in web pages is tested, and a tester usually browses each web page of a website through a browser to manually judge whether the static resource information included in each web page can be normally accessed. Therefore, a great deal of manpower and time are required to traverse each webpage of the website, the test result is greatly influenced by human factors, subjectivity is high, and accuracy of static resource test is poor.
The embodiment of the application provides a static resource testing method, which is based on a network architecture shown in figure 1, wherein the network architecture comprises a terminal, a testing server, a website server and a mirror image library server, and the terminal, the testing server, the website server and the mirror image library server are in communication connection through the Internet. The terminal is provided with an application program for static resource test, and the server terminal corresponding to the application program by the test server can be a mobile phone or a computer. The application may be a test software such as selenium or waiter. The mirror image library server is a server for storing static resource information which corresponds to the website and passes the test under the test environment.
In the embodiment of the application, the static resource mirror image library corresponding to the website to be tested is stored in the mirror image library server. As an example, the mirror library server may be a GitLab server, which is an open source item for a warehouse management system. In the embodiment of the application, after a technician finishes development and test work of a website to be tested, all static resource information included in the website to be tested passes the test, and the static resource information which passes the test in the website to be tested is stored in the GitLab server. The method comprises the steps that a GitLab server distributes a storage address for static resource information which passes through a test in a website to be tested, the storage address is called a mirror image library address, the static resource information which passes through 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 through the test of the website is called static resource mirror image information and corresponds to the static resource mirror image library of the website. Because the operation platform of the website to be tested may be a Web end or a mobile end, the same website operates on the Web end and the mobile end, and static resource information may have some differences, as the size of one static resource information operating on the Web end may be larger than the size of one static resource information operating on the mobile end. Therefore, static resource image information corresponding to the website to be tested in the GitLab server is stored in a classified mode according to different operation platforms.
The method provided by the embodiment of the application not only judges whether each piece of static resource information included in the website to be tested can be normally accessed. And comparing the static resource information which can be normally accessed with the static resource image information which is included in the static resource image library corresponding to the website to be tested and passes the test, if the static resource information and the static resource image information are consistent, the static resource information passes the test, otherwise, the static resource information fails the test. The method automatically tests the static resources, shortens the test time, improves the test efficiency, reduces errors caused by artificial subjective judgment, improves the accuracy of test results, reduces online defects of websites, and enhances the competitiveness of the websites.
Taking the application program as selenium as an example, the terminal firstly 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. Exe obtained by decompression. In the installation process, the start service interface shown in fig. 2 is popped up, and 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, the IP address is used as a start parameter to be transmitted into a selenium start command, and then the selenium start command is executed to complete the selenium start process, 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 provided 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 the user needs to test the static resource information of the website to be tested, the user logs in the website to be tested through the browser of the terminal, and clicks a test entry in the website to be tested. When the terminal detects that the test entrance is clicked, a test configuration interface is displayed, wherein the test configuration interface comprises a plurality of test parameter interfaces, the test parameter interfaces can comprise an operation environment interface, an operation platform interface, a local IP interface, a home page address interface, a mirror image library address interface, a mail address interface and the like, and the test configuration interface can be an interface shown in FIG. 4.
The running environment interface is used for receiving running environment parameters input by a user, the running environment parameters indicate whether the running environment of the current website to be tested is a test environment or a normal user access environment, if the running environment parameters are test, the current running environment is the test environment, and if the running environment parameters are user, the current running 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 but is used in the local area network, the user can automatically acquire the preset operation platform parameters from the website to be tested by the terminal without 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 input by a user and used for receiving a test result.
The test configuration interface may also include an execution user ID interface, a screen resolution interface, and the like. The execution user ID interface corresponds to a user account, the authority of the user is determined by executing the user ID, for example, only a tester can have the authority to test the static resource, and whether the current user is the tester with the authority is identified by executing the user ID. Because some websites can be tested for static resources after logging in, a program can be written in a development stage to enable the position of a login window in a screen to have a certain quantitative relation with screen resolution. After the user inputs screen resolution in the test configuration interface in the test stage, the position of the login window can be determined through the screen resolution, and information such as an account number, a password and the like input by the user is acquired from the login window so as to complete login operation. The execution user ID interface is shown in the test configuration interface shown in fig. 4, as well as the screen resolution interfaces "resolution screen width" and "resolution screen height".
In the embodiment of the application, the test configuration interface does not need to include a home page address interface, and a user does not need to manually input a home page address corresponding to the website to be tested. And 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 operation platform parameters and 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-in website page. And automatically generating a home page address of the website to be tested according to the operation platform parameters and the operation environment parameters of the website to be tested and the acquired domain name. For example, assuming "www" and test as the running environment parameter, and "wangzhan1.Com" as the acquired domain name, the first page address "http:// www.sy.wangzhan1.com" of the website wangzhan1 to be tested may be automatically generated.
After the terminal obtains each test parameter through the test configuration interface, the received test parameters form test configuration information, and the test configuration information is sent to a test server corresponding to test software installed on the terminal. The test server tests each piece of 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 the website to be tested, which is sent by the terminal, wherein the website to be tested comprises a home page address, a mirror image library address and operation platform parameters corresponding to the website to be tested.
The execution main body of the embodiment of the application is a test server, the test server receives test configuration information corresponding to a website to be tested, which is sent by a terminal, wherein the test configuration information can comprise a home page address, a mirror image library address, an operation platform parameter, an IP address of the terminal, a mail address for receiving a test result and the like, which correspond to the website to be tested.
Step 102: and acquiring a static resource mirror image library corresponding to the website to be tested according to the mirror image library address and the operation platform parameters, wherein the static resource mirror image library comprises static resource information which passes the test and corresponds to the website to be tested.
And 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 operation platform parameters and the mirror image library address. 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. And acquiring static resource image information corresponding to the running platform parameters from all the queried static resource image information according to the running platform parameters included in the image downloading request, and determining the acquired static resource image information as a static resource image library corresponding to the website to be tested. And the mirror image library server sends a static resource mirror image library corresponding to the website to be tested to the test server.
For example, assuming that the mirror library server is a GitLab server, the mirror library address may be "http:// GitLab. Wangzhan1.Com/". And sending an image download request to the GitLab server according to the image library address, wherein the image download request can comprise an image library address of 'http:// gitlab.wangzhan1. Com/' and an operation platform parameter of 'www'. After receiving the image downloading request, the image library server inquires all static resource image information corresponding to the image library address 'http:// gitlab. Wangzhan1. Com/'. And acquiring static resource image information corresponding to the running platform parameter 'www' from all the queried static resource image information.
The test server receives the static resource mirror image library corresponding to the mirror image library address returned by the mirror image library server, and determines the received static resource mirror image library as the static resource mirror image 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 image library and the home page address.
The embodiment of the application specifically tests static resource information contained in the website to be tested through the following steps A1-A5, and specifically comprises the following steps:
a1: and requesting to download static resource information included in each webpage of the to-be-tested website from a website server corresponding to the to-be-tested website according to the home page address, and obtaining a request downloading result corresponding to each static resource information.
And acquiring a first page of the website to be tested from a website server corresponding to the website to be tested according to the first page address, wherein the first page comprises a plurality of jump interfaces, and each jump interface corresponds to one webpage address. And acquiring the webpage address corresponding to each webpage included in the website to be tested according to the webpage address corresponding to each jump port in the home page. And respectively acquiring the webpages corresponding to the webpage addresses from the website server.
Because the home page comprises the webpage addresses corresponding to the plurality of jump interfaces, the home page jumps to the webpage corresponding to any one webpage address, and the webpage further comprises the webpage addresses corresponding to the plurality of jump interfaces. Starting from the home page, by traversing the web page address corresponding to each jump port in each web page, any web page included in the web site to be tested can be obtained. 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, & gtCSS, & gtjs, & gtJPG, & gtGIF, & gtPNG, & gtJPEG, etc.
Through the method, static resource information included in each webpage is respectively screened from each webpage of the website to be tested. When the test server obtains the web pages of the to-be-tested web site from the web site server, there may be some cases that the downloading of the static resource information in some web pages fails, and the downloading results of the requests corresponding to the static resource information with the downloading failure are identifiers for identifying the downloading failure, such as 0 or fail. And the request downloading result corresponding to the static resource information with successful downloading is an identifier for identifying the successful downloading, such as 1 or success.
After obtaining the request downloading result corresponding to each piece of static resource information, 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 image library. And for any static resource information included in the website to be tested, the test mode is the same. In the embodiment of the application, any one of the static resource information is taken as an illustration of the testing process of the static resource information, and the static resource information is called as first static resource information.
A2: and judging whether the request downloading result of the first static resource information meets the preset downloading rule, if so, executing the step A3, and if not, executing the step A4.
The preset downloading rule comprises failure in downloading or incomplete downloaded content and the like. And 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 downloading result of the request of the first static resource information is the downloaded part of the content. If the first static resource information is not downloaded, the website server returns an error prompt, such as 404 error prompt information or 505 error prompt information, where the request downloading result corresponding to the first static resource information is the error prompt returned by the website server.
In the embodiment of the application, in the process of transmitting the first static resource information to the test server by the website server, if the content of the first static resource information is completely transmitted, the website server also transmits an identifier for identifying that the transmission is completed to the test server, and the identifier can be 0 or 1. The test server may determine from the identifier that the content of the first static resource information is downloaded entirely.
After obtaining the request downloading result corresponding to the first static resource information, if the request downloading result is an error prompt, or the content of the first static resource information included in the request downloading result does not include an identifier for identifying that transmission is completed, the test server determines that the request downloading result corresponding to the first static resource information meets the preset downloading rule, and then executes step A3. If the test server determines that the content of the first static resource information included in the request downloading result includes an identifier for identifying that the transmission is completed, it determines that the request downloading result corresponding to the first static resource information does not meet the preset downloading rule, and then step A4 is executed.
A3: and determining the test result corresponding to the first static resource information as test failure.
A4: and comparing whether the first static resource information is consistent with the static resource image information corresponding to the first static resource information in the static resource image 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 image information corresponding to the first static resource information in the static resource image library, firstly extracting the static resource image information corresponding to the first static resource information from the static resource 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, wherein the file path is used for indicating the position of the first static resource information in the webpage containing the first static resource information. And acquiring the static resource image information which passes the test and corresponds to the first static resource information from the static resource 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, assuming that the resource address corresponding to the first static resource information is "http:// www.wangzhan1.com/a1/a2/a3", then "a1/a2/a3" 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 the static resource image information which is the same as the file path of the first static resource information is obtained from the static resource image library corresponding to the website to be tested in the above manner, whether the obtained static resource image information is consistent with the first static resource information is compared in any one of the following first or second manners, which specifically comprises:
firstly, calculating a first hash value corresponding to first static resource information and a second hash value corresponding to static resource mirror 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 first static resource information is consistent with the corresponding static resource mirror information, and executing step A5. If the first hash value is different from the second hash value, the first static resource information is inconsistent with the corresponding static resource mirror information, and the step A3 is executed again.
Second, it is first determined whether the file format of the first static resource information is a picture format, which may include JPG, GIF, PNG, JPEG, etc. If the file format of the first static resource information is determined to be the picture format, carrying out hash operation on the first static resource information and the static resource mirror image information corresponding to the first static resource information respectively to obtain a hash value corresponding to the static resource mirror image information and a hash value corresponding to the first static resource information respectively. And C, judging whether the hash values of the first static resource information and the corresponding static resource mirror image information are the same, if so, determining that the first static resource information and the corresponding static resource mirror image information are the same, and executing the step A5. If the hash values of the first static resource information and the corresponding static resource mirror information are different, determining that the first static resource information and the corresponding static resource mirror information are different, and returning to the step A3.
If it is determined that the file format of the first static resource information is not a picture format, but a file format of html, & gtCSS, & gtjs, etc. And (C) comparing the characters of the first static resource information and the corresponding static resource mirror image information, if the characters of the first static resource information and the corresponding static resource mirror image information are the same, determining that 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 executing the step A5. If the characters which are different from the corresponding static resource mirror image information exist in the first static resource information, determining that the information content included in the first static resource information is inconsistent with the information content included in the static resource mirror image information, and returning to the execution step A3.
A5: and determining the test result corresponding to the first static resource information as test success.
And respectively determining the test result corresponding to each piece of static resource information according to any one of the first mode or the second mode for any other piece of static resource information included in the website to be tested. And then generating a test report according to a test result corresponding to each piece of static resource information included in the website to be tested, 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. And for static resource information with failed downloading, the reason of the failed testing is the downloading failure. And for static resource information which is successfully downloaded but inconsistent with the static resource image information, the reason of the test failure is inconsistent with the static resource image information. For static resource information which is successfully downloaded but is inconsistent with the static resource image information, the static resource information and the static resource image information corresponding to the static resource information can be recorded in the test report.
After generating the test report of the website to be tested, the test report can also be sent to the terminal according to the IP address of the terminal included in the test configuration information. And sending the test report to a mailbox of the user according to the mail address included in the test configuration information. The mail address may include a plurality of mail addresses, such as a received mail address, a copy mail address, and the like.
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 static resource information included in each webpage can be normally accessed. And the test server also acquires a static resource mirror image library corresponding to the website to be tested according to the mirror image library address included in the test configuration information. And further testing the static resource information which can be normally accessed according to the static resource image information which passes the test and is 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 the testing result is improved, the online defects of the website are reduced, and the competitiveness of the website is enhanced.
An embodiment of the present application provides a static resource testing device, which is configured to execute the static resource testing method described in the foregoing embodiment, and see fig. 6, where the device includes:
the receiving module 601 is configured to receive test configuration information corresponding to a website to be tested, where the test configuration information includes a home page address, a mirror image library address and an operation platform parameter corresponding to the website to be tested, which are sent by a terminal;
the obtaining module 602 is configured to obtain a static resource mirror image library corresponding to a website to be tested according to a mirror image library address and an operation platform parameter, where the static resource mirror image library includes static resource information that has passed the test and corresponds to the website to be tested;
and 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.
The obtaining module 602 is 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 the mirror image library address; receiving a static resource mirror image library corresponding to the operation platform parameters and the mirror image library address returned by the mirror image library server; and determining the received static resource image library as a static resource image library corresponding to the website to be tested.
The test module 603 includes:
the downloading unit is used for requesting to download static resource information included in each webpage of the website to be tested from a website server corresponding to the website to be tested according to the home page address, and obtaining a request downloading 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 image library according to the fact that the request downloading result of the first static resource information does not meet the preset downloading rule, and the first static resource information is any static resource information in each 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 according to the request downloading result of the first static resource information, the preset downloading rule is met or the first static resource information is inconsistent with the static resource mirror image information, determining that the test result corresponding to the first static resource information is test failure.
The downloading unit is used for acquiring the home page of the website to be tested from the 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 port in the home page; respectively acquiring webpages corresponding to each webpage address from a website server; and screening out the 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 image information which passes the test and corresponds to the first static resource information from the static resource image library according to the file path.
The test result determining unit is specifically configured to calculate a first hash value corresponding to the first static resource information and a second hash value corresponding to the static resource mirror 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 successful.
The apparatus further comprises: the test report generation and transmission module is used for generating a test report according to a test result corresponding to each piece of static resource information included in the website to be tested; 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 embodiment of the application and the static resource testing method provided by the embodiment of the application have the same beneficial effects as the method adopted, operated or realized by the application program stored by the static resource testing device due to the same inventive concept.
The embodiment of the application also provides electronic equipment corresponding to the static resource testing method provided by the embodiment of the application, so as to execute the static resource testing method. The embodiment of the application is not limited.
Referring to fig. 7, a schematic diagram of an electronic device according to some embodiments of the present application is shown. As shown in fig. 7, the electronic device 2 includes: a processor 200, a memory 201, a bus 202 and a communication interface 203, the processor 200, the communication interface 203 and the memory 201 being connected by 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 in any of the foregoing embodiments of the present application when executing the computer program.
The memory 201 may include a high-speed random access memory (RAM: random Access Memory), and may further include a non-volatile memory (non-volatile memory), such as at least one disk memory. The communication connection between the system network element and at least one other network element is implemented via at least one communication interface 203 (which may be wired or wireless), the internet, a wide area network, a local network, a metropolitan area network, etc. may be used.
Bus 202 may be an ISA bus, a PCI bus, an EISA bus, or the like. The buses may be classified as address buses, data buses, control buses, etc. The memory 201 is configured to store 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 with signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in the processor 200 or by instructions in the form of software. The processor 200 may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU for short), a network processor (Network Processor, NP for short), etc.; but may also be a Digital Signal Processor (DSP), application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. The disclosed methods, steps, and logic blocks 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 embodied directly in the execution of a hardware decoding processor, or in the execution of a combination of hardware and software modules in a decoding processor. The software modules may be located in a random access memory, flash memory, read only memory, programmable read only memory, or electrically erasable programmable memory, registers, etc. as 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 in combination with its hardware, performs the steps of the above method.
The electronic equipment provided by the embodiment of the application and the static resource testing method provided by the embodiment of the application have the same beneficial effects as the method adopted, operated or realized by the electronic equipment and the static resource testing method provided by the embodiment of the application due to the same inventive concept.
The embodiment of the present application further provides a computer readable storage medium corresponding to the static resource testing method provided in the foregoing embodiment, referring to fig. 8, the computer readable storage medium is shown as an optical disc 30, on which a computer program (i.e. a program product) is stored, where the computer program when executed by a processor performs 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, a phase change memory (PRAM), a Static Random Access Memory (SRAM), a Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a flash memory, or other optical or magnetic storage medium, which will not be described in detail herein.
The computer readable storage medium provided by the above embodiment of the present application has the same advantages as the method adopted, operated or implemented by the application program stored in the computer readable storage medium, because of the same inventive concept as the static resource testing method provided by the embodiment of the present application.
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 use of the words first, second, third, etc. do not denote any order. These words may be interpreted as names.
The present application is not limited to the above-mentioned embodiments, and any changes or substitutions that can be easily understood by those skilled in the art within the technical scope of the present application are intended to be included in 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 method of static resource testing, the method comprising;
receiving test configuration information corresponding to a website to be tested, which is 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 website to be tested;
acquiring a static resource mirror image library corresponding to the website to be tested according to the mirror image library address and the operation 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;
according to the static resource mirror image library and the home page address, testing the static resource information contained in the website to be tested, including:
requesting to download static resource information included in each webpage of the website to be tested from a website server corresponding to the website to be tested according to the home page address, and obtaining a request downloading result corresponding to each static resource information;
according to the fact that a 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 image library, wherein the first static resource information is any static resource information in each static resource information;
And determining that the test result corresponding to the first static resource information is successful according to the consistency of the first static resource information and the static resource mirror image information.
2. The method of claim 1, wherein the obtaining the static resource mirror library corresponding to the website to be tested according to the mirror library address and the operation 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 operation platform parameter and the mirror image library address;
receiving a static resource mirror image library corresponding to the mirror image library address returned by the mirror image library server;
and determining the received static resource mirror image library as a static resource mirror image library corresponding to the website to be tested.
3. The method of claim 1, wherein the testing the static resource information contained in the website to be tested according to the static resource mirror library and the home address, further comprises:
and according to the request downloading result of the first static resource information, the preset downloading rule is met or the first static resource information is inconsistent with the static resource mirror image information, and the test result corresponding to the first static resource information is determined to be test failure.
4. The method of claim 3, wherein the requesting, according to the home page address, to download 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 request download 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 jump port in the home page;
respectively acquiring webpages corresponding to each webpage address from the website server;
and screening out the static resource information from each acquired webpage according to a preset static file format.
5. The method of claim 3, wherein before comparing whether the first static resource information is consistent with static resource image information corresponding to the first static resource information in the static resource image library, 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 image information which passes the test and corresponds to the first static resource information from the static resource image library according to the file path.
6. The method of claim 3, wherein the comparing whether the first static resource information is consistent with static resource image information corresponding to the first static resource information in the static resource image library comprises:
calculating a first hash value corresponding to the first static resource information and a second hash value corresponding to the static resource mirror 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 successful.
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 piece of 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 device, the device comprising;
the system comprises a receiving module, a testing module and a testing module, wherein the receiving module is used for receiving testing configuration information corresponding to a website to be tested, which is sent by a terminal, and the testing configuration information comprises a home page address, a mirror image library address and an operation platform parameter corresponding to the website to be tested;
the acquisition module is used for acquiring a static resource mirror image library corresponding to the website to be tested according to the mirror image library address and the operation 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;
the test 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, and comprises the following steps:
requesting to download static resource information included in each webpage of the website to be tested from a website server corresponding to the website to be tested according to the home page address, and obtaining a request downloading result corresponding to each static resource information;
According to the fact that a 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 image library, wherein the first static resource information is any static resource information in each static resource information;
and determining that the test result corresponding to the first static resource information is successful according to the consistency of the first static resource information and the static resource mirror image information.
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 runs the computer program to implement the method of any one of claims 1-7.
10. A computer readable storage medium having stored thereon a computer program, wherein the program is executed by a processor to implement the method of 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 CN113448835A (en) 2021-09-28
CN113448835B true 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)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114996122A (en) * 2022-04-26 2022-09-02 北京达佳互联信息技术有限公司 Automatic testing method and device, electronic equipment and storage medium
CN118041824B (en) * 2024-04-12 2024-07-23 杭州优云科技股份有限公司 Method and device for testing bypass mirror function, electronic equipment and storage medium

Citations (7)

* 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
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10382313B2 (en) * 2017-02-16 2019-08-13 International Business Machines Corporation Test building for testing server operation

Patent Citations (7)

* 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
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性能测试的研究与实现.《中国优秀硕士学位论文全文数据库 信息科技辑》.2014,(第03期),I138-458. *
某商业银行智能终端手机银行的设计与实现;徐皓;《中国优秀硕士学位论文全文数据库 信息科技辑》(第10期);I138-330 *

Also Published As

Publication number Publication date
CN113448835A (en) 2021-09-28

Similar Documents

Publication Publication Date Title
CN102932197B (en) Testing method and system
CN108628748B (en) Automatic test management method and automatic test management system
US8621613B1 (en) Detecting malware in content items
US7536599B2 (en) Methods and systems for validating a system environment
CN113448835B (en) Static resource testing method and device, electronic equipment and storage medium
CN112199300B (en) Interface testing method and device, electronic equipment and storage medium
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
CN112685211B (en) Error information display method and device, electronic equipment and medium
CN114546881B (en) Application software testing method, electronic device and computer readable storage medium
US20160261623A1 (en) Detecting Malware In Content Items
CN111694550A (en) Page display control method, device and system
CN111258904A (en) Webpage element testing method and related device
CN112379965B (en) Sandbox file mapping system, client device, mapping end device, sandbox file mapping method and electronic equipment
CN113656107A (en) Mobile application loading method and device and electronic equipment
CN117873858A (en) Simulation data generation method and computing device for front-end page test
CN109324822B (en) PWA (public warning assistant) item detection method, computer-readable storage medium and terminal device
CN115514677B (en) Method and system for server dial testing
CN108287813B (en) Information submission method and device and electronic equipment
CN115599683A (en) Automatic testing method, device, equipment and storage medium
CN115373885A (en) Fault repairing method and device, storage medium and electronic equipment
CN112580334A (en) File processing method, file processing device, server and storage medium
CN110061864B (en) Method and system for automatically verifying domain name configuration
CN111651356A (en) Application program testing method, device and system

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
TR01 Transfer of patent right

Effective date of registration: 20240506

Address after: 100102 room 1201, 12 / F, building 8, yard 34, Chuangyuan Road, Chaoyang District, Beijing

Patentee after: Beijing new oxygen world wide Technology Consulting Co.,Ltd.

Country or region after: China

Address before: 100102 room 901, 9 / F, room 1001, 10 / F, building 8, yard 34, Chuangyuan Road, Chaoyang District, Beijing

Patentee before: Beijing New Oxygen Technology Co.,Ltd.

Country or region before: China

TR01 Transfer of patent right