CN110781424A - Method for intelligently clearing browser cache for Web project automation test - Google Patents

Method for intelligently clearing browser cache for Web project automation test Download PDF

Info

Publication number
CN110781424A
CN110781424A CN201910970824.4A CN201910970824A CN110781424A CN 110781424 A CN110781424 A CN 110781424A CN 201910970824 A CN201910970824 A CN 201910970824A CN 110781424 A CN110781424 A CN 110781424A
Authority
CN
China
Prior art keywords
version number
interface
database
return value
project
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910970824.4A
Other languages
Chinese (zh)
Inventor
石佳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan Changhong Electric Co Ltd
Original Assignee
Sichuan Changhong Electric 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 Sichuan Changhong Electric Co Ltd filed Critical Sichuan Changhong Electric Co Ltd
Priority to CN201910970824.4A priority Critical patent/CN110781424A/en
Publication of CN110781424A publication Critical patent/CN110781424A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Abstract

The invention discloses a method for intelligently clearing browser cache for Web project automation test, which is characterized in that a table is created in a database to store a front-end project version number acquired last time, then an interface is realized, parameters are transmitted into an address, a user name and a password of a version control tool, the version number of the current front-end project is acquired and compared with the front-end project version number in the database, the realized interface is quoted in a Web automation test script before a test case is executed, the browser is cleared by calling a DOS command before the test case is executed according to the return value of the interface as True, and the cache is not cleared when the return value of the interface is false. The method and the device not only keep the advantages brought by caching in the Web project, but also effectively avoid the problem that testers cannot see the latest page effect when carrying out automatic testing due to the update of the front-end code, and improve the testing experience.

Description

Method for intelligently clearing browser cache for Web project automation test
Technical Field
The invention relates to the technical field of Web automatic testing, in particular to a method for determining whether to clear browser cache according to the judgment of the existence of update of front-end engineering when Web project automatic testing with front-end and back-end separation is carried out.
Background
The Web application program is an application program which can be accessed through Web, and the greatest benefit of the program is that a user can easily access the application program, and the user only needs to have a browser and does not need to install other software. Generally, caching is used in a Web application program, and is a way for optimizing the performance of the Web application. For a data request of a Web application, the method can be divided into three steps of network request initiation, back-end processing and browser response. The browser cache can help us to optimize performance in the first and third steps. For example, if the cache is used directly without initiating a request, or if the data stored in the back-end is consistent with the front-end after initiating a request, then it is not necessary to return the data, and the response data is reduced. However, in the process of performing the Web automation test, if the front-end code is changed, the data returned by the server is still the data in the browser cache under the condition that the cache is not cleared, and the effect of the changed page cannot be seen in time.
Disclosure of Invention
The invention aims to provide a method for intelligently clearing browser cache for Web project automation test, which is used for solving the problem that the effect of front-end code change cannot be seen because the browser cache is not cleared in time when the Web automation test is executed.
The invention realizes the purpose through the following technical scheme:
a method for intelligently clearing browser cache for automated testing of Web items, comprising the steps of:
creating a table in a database for storing the last acquired front-end project version number, then realizing an interface, transmitting parameters into an address, a user name and a password of a version control tool, acquiring the version number of the current front-end project, comparing the version number with the front-end project version number in the database, if the database has no value for the first time, storing the current version number, returning to True, otherwise, taking out the front-end project version number stored in the database, comparing the front-end project version number with the current version number, if the front-end project version number is consistent, returning to False, if the front-end project version number is inconsistent,
in the Web automatic test script, an realized interface is quoted before a test case is executed, before the test case is executed, a browser is cleared by calling a DOS (browser application Server) command when the return value of the interface is True, and the cache is not cleared when the return value of the interface is false.
The further scheme is that the method specifically comprises the following steps:
step one, creating a database table for storing the last acquired front-end engineering version number;
step two, an interface is created, and parameters are transmitted: the address, user name and password of the version control tool used in the project;
step three, acquiring the version number of the front-end project in the forward version control tool;
step four, acquiring the version number in the database;
step five, judging whether the version number in the step four is empty, if so, saving the version number obtained in the step three, and returning to True; if the version number is not empty, entering a sixth step;
step six, comparing whether the version numbers in the step four and the step three are the same, if so, returning to True, and if not, returning to False;
and then determining whether to clear the browser cache according to the interface return value, and executing the following steps:
step A, introducing an interface realized in the steps from one step to six before executing a use case;
step B, determining whether to clear the browser cache according to the return value of the interface, if the return value is False, not clearing the cache, and if the return value is True, calling a DOS command to clear the browser cache;
and C, executing the test case.
The invention has the beneficial effects that:
the method for intelligently clearing the browser cache for the automatic testing of the Web project with the front end and the back end separated is adopted, so that the advantages brought by the cache in the Web project are kept, the problem that a tester cannot see the latest page effect when the tester carries out the automatic testing due to the update of the front end code is effectively solved, and the testing experience is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the embodiments or the drawings that are needed in the prior art description, and it is obvious that the drawings in the following description are only some embodiments of the embodiments, and that other drawings can be obtained by those skilled in the art without inventive efforts.
FIG. 1 is a flow chart of an interface.
FIG. 2 is a flow diagram of automated test script execution.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be described in detail below. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the examples given herein without any inventive step, are within the scope of the present invention.
In any embodiment, as shown in fig. 1-2, the method for intelligently clearing browser cache for Web project automation test of the present invention includes:
creating a table in a database for storing the last acquired front-end engineering version number, then realizing an interface, transmitting parameters into an address, a user name and a password of a version control tool, acquiring the version number of the current front-end engineering, comparing the version number with the front-end engineering version number in the database, if the database has no value for the first time, storing the current version number and returning to True, otherwise, taking out the front-end engineering version number stored in the database to compare with the current version number, if the front-end engineering version number is consistent, returning to False, and if the front-end engineering version number is inconsistent, returning to True;
in the Web automatic test script, an realized interface is quoted before a test case is executed, before the test case is executed, a browser is cleared by calling a DOS (browser application Server) command when the return value of the interface is True, and the cache is not cleared when the return value of the interface is false.
In one embodiment, as shown in fig. 1-2, the method for intelligently clearing browser cache for Web project automation test of the present invention comprises the following steps:
fig. 1 is a flowchart of an interface implementation, which is to determine whether a front-end project is updated in a project with front and rear ends separated. The method comprises the following steps:
step one, creating a database table for storing the last acquired front-end engineering version number;
step two, an interface is created, and parameters are transmitted: the address, user name and password of the version control tool used in the project;
step three, acquiring the version number of the front-end project in the forward version control tool;
step four, acquiring the version number in the database;
step five, judging whether the version number in the step four is empty, if so, saving the version number obtained in the step three, and returning to True;
if the version number is not empty, entering a sixth step;
step six, comparing whether the version numbers in the step four and the step three are the same, if so, returning to True, and if not, returning to False;
FIG. 2 is a flow diagram of automated test script execution that determines whether to flush a browser cache based on interface return values implemented in FIG. 1. The method comprises the following steps:
step one, before executing a use case, introducing an interface realized by the method shown in the figure 1;
step two, determining whether to clear the browser cache according to the return value of the interface, if the return value is False, not clearing the cache, and if the return value is True, calling a DOS command to clear the browser cache;
and step three, executing the test case.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims. It should be noted that the various technical features described in the above embodiments can be combined in any suitable manner without contradiction, and the invention is not described in any way for the possible combinations in order to avoid unnecessary repetition. In addition, any combination of the various embodiments of the present invention is also possible, and the same should be considered as the disclosure of the present invention as long as it does not depart from the spirit of the present invention.

Claims (2)

1. The method for intelligently clearing the browser cache for the Web project automation test is characterized by comprising the following steps of:
creating a table in a database for storing the last acquired front-end engineering version number, then realizing an interface, inputting parameters into an address, a user name and a password of a version control tool, acquiring the version number of the current front-end engineering, comparing the version number with the front-end engineering version number in the database, if the database has no value for the first time, storing the current version number, and returning to True, otherwise, taking out the front-end engineering version number stored in the database to compare with the current version number, if the front-end engineering version number is consistent, returning to False, and if the front-end engineering version number is inconsistent, returning to True;
in the Web automatic test script, an realized interface is quoted before a test case is executed, before the test case is executed, a browser is cleared by calling a DOS (browser application Server) command when the return value of the interface is True, and the cache is not cleared when the return value of the interface is false.
2. The method for intelligently clearing a browser cache for automated testing of Web items of claim 1, comprising the steps of:
step one, creating a database table for storing the last acquired front-end engineering version number;
step two, an interface is created, and parameters are transmitted: the address, user name and password of the version control tool used in the project;
step three, acquiring the version number of the front-end project in the forward version control tool;
step four, acquiring the version number in the database;
step five, judging whether the version number in the step four is empty, if so, saving the version number obtained in the step three, and returning to True; if the version number is not empty, entering a sixth step;
step six, comparing whether the version numbers in the step four and the step three are the same, if so, returning to True, and if not, returning to False;
and then determining whether to clear the browser cache according to the interface return value, and executing the following steps:
step A, introducing an interface realized in the steps from one step to six before executing a use case;
step B, determining whether to clear the browser cache according to the return value of the interface, if the return value is False, not clearing the cache, and if the return value is True, calling a DOS command to clear the browser cache;
and C, executing the test case.
CN201910970824.4A 2019-10-12 2019-10-12 Method for intelligently clearing browser cache for Web project automation test Pending CN110781424A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910970824.4A CN110781424A (en) 2019-10-12 2019-10-12 Method for intelligently clearing browser cache for Web project automation test

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910970824.4A CN110781424A (en) 2019-10-12 2019-10-12 Method for intelligently clearing browser cache for Web project automation test

Publications (1)

Publication Number Publication Date
CN110781424A true CN110781424A (en) 2020-02-11

Family

ID=69385371

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910970824.4A Pending CN110781424A (en) 2019-10-12 2019-10-12 Method for intelligently clearing browser cache for Web project automation test

Country Status (1)

Country Link
CN (1) CN110781424A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112395191A (en) * 2020-11-16 2021-02-23 北京五八信息技术有限公司 Information processing method and device
CN114301607A (en) * 2021-12-30 2022-04-08 山石网科通信技术股份有限公司 Method and device for clearing browser certificate, storage medium and processor

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105302895A (en) * 2015-10-21 2016-02-03 浪潮通用软件有限公司 Data caching synchronization method, server and client side
CN106202104A (en) * 2015-05-07 2016-12-07 阿里巴巴集团控股有限公司 The correlation technique of the opening speed of the optimization aim page and device
CN106294879A (en) * 2016-08-29 2017-01-04 国云科技股份有限公司 A kind of method of quick removing browser rs cache
CN108241689A (en) * 2016-12-26 2018-07-03 广州市动景计算机科技有限公司 Page resource acquisition methods, device and client device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106202104A (en) * 2015-05-07 2016-12-07 阿里巴巴集团控股有限公司 The correlation technique of the opening speed of the optimization aim page and device
CN105302895A (en) * 2015-10-21 2016-02-03 浪潮通用软件有限公司 Data caching synchronization method, server and client side
CN106294879A (en) * 2016-08-29 2017-01-04 国云科技股份有限公司 A kind of method of quick removing browser rs cache
CN108241689A (en) * 2016-12-26 2018-07-03 广州市动景计算机科技有限公司 Page resource acquisition methods, device and client device

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112395191A (en) * 2020-11-16 2021-02-23 北京五八信息技术有限公司 Information processing method and device
CN114301607A (en) * 2021-12-30 2022-04-08 山石网科通信技术股份有限公司 Method and device for clearing browser certificate, storage medium and processor
CN114301607B (en) * 2021-12-30 2024-02-06 山石网科通信技术股份有限公司 Certificate clearing method and device for browser, storage medium and processor

Similar Documents

Publication Publication Date Title
US9680719B2 (en) Communication system, client terminal, and server
CN110781424A (en) Method for intelligently clearing browser cache for Web project automation test
CN113946546B (en) Abnormality detection method, computer storage medium, and program product
CN107665170B (en) Flow testing method and device
CN104320312A (en) Network application safety test tool and fuzz test case generation method and system
CN111984892A (en) Page access method, device, equipment and storage medium
CN108549688B (en) Data operation optimization method, device, equipment and storage medium
CN101930401A (en) Detection object-based software vulnerability model detection method
CN111046106A (en) Cache data synchronization method, device, equipment and medium
CN116723206A (en) Vehicle fault information processing method and device, electronic equipment and storage medium
CN116126719A (en) Interface testing method and device, electronic equipment and storage medium
CN115509931A (en) System-based performance test method and device, electronic equipment and storage medium
CN111539019A (en) Application module processing method, device, equipment and storage medium
CN111159138A (en) Asynchronous data storage method, device, equipment and readable storage medium
US8321844B2 (en) Providing registration of a communication
CN110096555B (en) Table matching processing method and device for distributed system
CN116450487B (en) UFS log analysis method and device, readable storage medium and electronic equipment
CN109213490A (en) A kind of program processing method, device and relevant device
CN110166469B (en) Authentication method, device and storage device
CN113111012B (en) Application data locator generation method and application data locating method
CN116737605B (en) Data prefetching method, device, equipment and medium based on chip multilevel storage
CN114117181B (en) Website page turning logic acquisition method and device and website page turning control method and device
CN117453747A (en) Data quality detection method and device, electronic equipment and storage medium
CN117609084A (en) Class conflict detection method, device and equipment for application program and storage medium
CN113704592A (en) Network request sending method and device, electronic equipment and storage medium

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200211