CN103678105B - A kind of test method and device of page code - Google Patents
A kind of test method and device of page code Download PDFInfo
- Publication number
- CN103678105B CN103678105B CN201210345049.1A CN201210345049A CN103678105B CN 103678105 B CN103678105 B CN 103678105B CN 201210345049 A CN201210345049 A CN 201210345049A CN 103678105 B CN103678105 B CN 103678105B
- Authority
- CN
- China
- Prior art keywords
- page
- test
- response data
- image
- background module
- 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
Links
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The present invention provides a kind of test method of page code and devices, wherein method includes:S1, construction test case, wherein the test case includes:The page test operation and page area benchmark image of construction or the background module response data, recording recorded;S2, the page test operation for playing back the recording intercept the request and the background module response data for returning to the construction or recording to the tested page according to the request for being tested that the page is sent to background module;S3, intercept page domain test image, and by the page area test image and the page area benchmark image comparison test test result.The present invention realizes the automatic test to web page code, while energy Automated inspection test result saves hardware resource and cost of labor, while improving testing efficiency compared with prior art.
Description
【Technical field】
The present invention relates to system testing technology, more particularly to the test method and device of a kind of page code.
【Background technology】
It is to ensure that web page code issues the necessary means of quality to carry out test to web page code being developed.It is existing
Some test methods, which are usually required, builds the corresponding background module of tested web page, is then manually surveyed on a web browser
Examination operation, and the bandwagon effect of web page is directly observed come verification test result by human eye.Such test method exists more
A deficiency:It builds background module to need individually to occupy server, consumes hardware resource, and in exploitation, web page code
When ready, background module is often not yet ready, and the test job of web page code is opened again after background module can only be waited for ready
Exhibition, has delayed the job schedule of web page code tester;The execution of test operation and the inspection of webpage representation effect are required for people
Work complete, increase cost of labor, meanwhile, the desk checking page when showing effect be easy there will be the problem of omit.
【Invention content】
The present invention provides a kind of method and apparatus of the test of page code, can automate to web page code into
Row test and validation test result.
Specific technical solution is as follows:
A kind of test method of page code, this method include:
S1, construction test case, wherein the test case includes:Construction or the background module response data recorded, record
The page test operation and page area benchmark image of system;
S2, the page test operation for playing back the recording intercept the request and basis for being tested that the page is sent to background module
The request returns to the background module response data of the construction or recording to the tested page;
S3, intercept page domain test image, and by the page area test image and the page area reference map
As comparison test test result.
According to one preferred embodiment of the present invention, the background module response data constructs in the following way:
Determine the format of background module response data corresponding with the request that the tested page is sent to background module, root
The value of each parameter in response data is generated according to the format.
According to one preferred embodiment of the present invention, the background module response data is recorded in the following way:
It intercepts the request that the tested page is sent to background module and sends this request to background module after recording the request;
The response data that background module returns is intercepted, the response data is preserved and forms correspondence with the request, and will
The response data returns to the tested page.
According to one preferred embodiment of the present invention, the recording of the page test operation, specially:
It is recorded in the page test operation executed on controlled browser;
The page test operation of the recording is played back in the step S2, specially:It is played back on the controlled browser
The page test operation of the recording.
According to one preferred embodiment of the present invention, the page area benchmark image obtains in the following way:
After having executed page test operation on the controlled browser, the image of specified page area is intercepted, wherein
The specified page area is:The region positioned according to the page elements of selection;Alternatively, the area directly chosen by mouse drag
Domain;
Intercept page domain test image, specifically includes in the step S3:To the tested page return it is described construction or
After the background module response data of recording, the specified page area image is intercepted on the tested page as page area survey
Attempt picture.
According to one preferred embodiment of the present invention, by page area test image and page area reference map in the step S3
As comparison test test result, specifically include:Calculate the page area test image and the page area benchmark image
Similarity, if similarity is more than preset threshold value, then it is assumed that test passes through;Otherwise it is assumed that test does not pass through.
A kind of test device of page code, the device include:
Structural unit, for constructing test case, wherein the test case includes:Construction or the background module recorded
Response data, the page test operation of recording and page area benchmark image;
The test cell of subelement and the second sectional drawing subelement is played back including test operation;
The test operation plays back subelement, the page test operation for playing back the recording, intercept be tested the page to
The request of background module transmission and the background module response data for returning to the construction or recording to the tested page according to the request;
The second sectional drawing subelement is used for intercept page domain test image, and by the page area test image
With the page area benchmark image comparison test test result.
According to one preferred embodiment of the present invention, the structural unit includes response data subelement, response data
Unit for constructing the background module response data in the following way:
Determine the format of background module response data corresponding with the request that the tested page is sent to background module, root
The value of each parameter in response data is generated according to the format.
According to one preferred embodiment of the present invention, the structural unit includes response data subelement, response data
Unit for recording the background module response data in the following way:
It intercepts the request that the tested page is sent to background module and sends this request to background module after recording the request;
The response data that background module returns is intercepted, the response data is preserved and forms correspondence with the request, and will
The response data returns to the tested page.
According to one preferred embodiment of the present invention, the structural unit includes that test operation records subelement, the test behaviour
Make to record subelement for recording the page test operation in the following way:
It is recorded in the page test operation executed on controlled browser;
The test operation playback subelement plays back the page test operation of the recording in the following way:
The page test operation of the recording is played back on the controlled browser.
According to one preferred embodiment of the present invention, the structural unit includes the first sectional drawing subelement, the first sectional drawing
Unit is for intercept page zonal basis image in the following way:
After having executed page test operation on the controlled browser, the image of specified page area is intercepted, wherein
The specified page area is:The region positioned according to the page elements of selection;Alternatively, the area directly chosen by mouse drag
Domain;
Second sectional drawing subelement intercept page domain test image in the following way:
The background module number of responses that subelement returns to the construction to the tested page or records is played back in the test operation
According to rear, the specified page area image is intercepted as page area test image on the tested page.
According to one preferred embodiment of the present invention, the second sectional drawing subelement is in the following way by page area test chart
Picture and page area benchmark image comparison test test result:
The similarity of the page area test image and the page area benchmark image is calculated, if similarity is more than pre-
The threshold value first set, then it is assumed that test passes through;Otherwise it is assumed that test does not pass through.
As can be seen from the above technical solutions, the present invention includes background module response data, recording by constructing one
The test case of page test operation and page area benchmark image plays back test operation in test, is returned to web page
Response data, and sectional drawing contrast verification test result, the automatic test to web page code is realized with this.The present invention carries
The test method and device of confession so that save hardware resource and cost of labor in test, while being obviously improved test effect
Rate.
【Description of the drawings】
Fig. 1 is the test method flow chart for the page code that the embodiment of the present invention one provides;
Fig. 2 is the response data building method flow chart that the embodiment of the present invention one provides;
Fig. 3 is the page test operation and page area benchmark image preparation method for the recording that the embodiment of the present invention one provides
Flow chart;
Fig. 4 is the test case preparation method flow chart that the embodiment of the present invention one provides;
Fig. 5 is the method flow diagram tested page code using test case that the embodiment of the present invention one provides;
Fig. 6 is the test device schematic diagram of page code provided by Embodiment 2 of the present invention.
【Specific implementation mode】
To make the objectives, technical solutions, and advantages of the present invention clearer, right in the following with reference to the drawings and specific embodiments
The present invention is described in detail.
Embodiment one
Fig. 1 is the test method flow chart for the page code that the embodiment of the present invention one provides, as shown in Figure 1, this method can
To include:
S101, construction test case, wherein the test case includes:Construction or record background module response data,
The page test operation and page area benchmark image of recording.
In order to realize the test automation of web page code, it is desirable to be able to the test case that automation executes repeatedly.This hair
The bright response data for exactly utilizing through construction or recording background module records page test operation, intercept page zonal basis
Image come formed one can automated execution test case, and realize with this test automation of web page code.
The acquisition pattern for the background module response data for constructing or recording is described below.
If background module is not yet ready, the response data for constructing background module is needed, as shown in Fig. 2, the process can be with
It is realized by following step S111-S112:
The format of S111, determination background module response data corresponding with page request.
The format of response data corresponding with asking can be managed collectively by a management platform, on the platform,
It may be sent to the request of background module for the web page of each type, record the type of the request and corresponding
The format of response data, the format include:The quantity of parameter in the structure and response data of response data, type, title with
And the value range etc. of each parameter.Later, it just can be determined from the management platform and be sent to backstage mould with each web page
The format of the corresponding response data of request of block.
S112, background module number of responses is generated according to the format of the background module response data corresponding with page request
According to.
After the format that background module response data corresponding with page request is determined, it can be generated according to this format
Response data corresponding with the request that web page is sent to background module.The value of each parameter in response data is firstly generated, this
Invention provides following two kinds of preferred embodiments and generates parameter value:Generate each parameter at random in the value range of each parameter
Value;Alternatively, being needed according to test to set the value of each parameter.Later, the structure of data according to response, the ginseng that will be generated
Array is at a complete response data.
After the format for managing response data corresponding with asking using management platform in step S111, it can be put down by this
Structure of the platform according to response data, the random value for generating each parameter in response data, the automation of response data is completed with this
Construction.If in follow-up test, need to simulate some extreme abnormal conditions, then can be as needed, it is set by tester
The value of each parameter in response data.
It is above-mentioned for background module it is not yet ready in the case of, construct the mode of response data.If background module is ready,
It can then can be, but not limited to realize using following methods with the response data of direct recording background module, this process:
The request that web page is sent to background module is intercepted, the request is recorded, then sends this request to backstage mould
Block preserves after the response data of the return of background module is formed correspondence with the request recorded before later, then by the sound
Data are answered to be back to web page.For the ease of preserving the correspondence between response data and request, sent intercepting web page
To background module request and when being recorded, operations described below can be executed:The url for recording the request, sends this request to
Background module preserves after the response data that background module returns is formed correspondence with the url recorded later;Extraction mark
The field of the request generates unique character string according to the field, background module is sent this request to, later by background module
The response data of return preserves after forming correspondence with the character string generated.
By the above process, it can record to obtain background module and corresponding sound is returned to according to the request that web page is sent
Answer data.
Above-mentioned is the acquisition pattern for the background module response data for constructing or recording in test case, below to test case
The page test operation of middle recording and the acquisition pattern of page area benchmark image are described.
For subsequently can automatic test, need to record the test operation on the page, with test when carry out
Playback, at the same need intercept page zonal basis image with verify follow-up test as a result, as shown in figure 3, this process can be with
It is realized by following step S121-S123:
One S121, configuration controlled browser so that the controlled browser has the work(of recording, playback, positioning and sectional drawing
Energy.
The present invention realizes the recording to page test operation by the way that a controlled browser with recording function is arranged,
The controlled browser can be realized by being loaded into the plug-in unit with corresponding function in a browser.For example, can pass through
The Extension mechanism of Firefox loads a plug-in unit with recording function, and a series of behaviour are defined in the recording plug-in unit
Make, these operations need to cover all operationss that user may execute on web page, after enabling the plug-in unit, in controlled browsing
Any operation executed to web page on device can all trigger the recording plug-in unit, record plug-in unit and obtain performed operation, record
The corresponding action type of the operation, the element finger URL operated and operating parameter etc., and be stored in specified file.
In order to complete subsequent sectional drawing and test operation, controlled browser also need to be loaded into playback plug-in unit, positioning plug-in unit and
Sectional drawing plug-in unit realizes the function of corresponding playback, positioning and sectional drawing.
Playback plug-in unit can from the file for preserving test operation read operation type, the element finger URL that is operated and behaviour
Make parameter, respective operations are executed to the element that need to be operated later.
Plug-in unit and sectional drawing plug-in unit is positioned to complete to position page area the function of sectional drawing jointly.The present invention provides following two kinds
Preferred embodiment carries out positioning sectional drawing to page area:
1, positioning sectional drawing is carried out according to element finger URL, after test operation, the specified element for needing sectional drawing, positioning
Plug-in unit can obtain the Xpath (path expression of element) for being selected element, those elements can be positioned by the Xpath of element
Position in the page, sectional drawing plug-in unit carry out sectional drawing to the element that those are selected, and using institute's truncated picture as page pool
Domain benchmark image is saved in specified file.
2, positioning sectional drawing is carried out according to coordinate, after test operation, mouse drag chooses the region for needing sectional drawing, fixed
Position plug-in unit can obtain the region relative to the abscissa x and ordinate y in the page upper left corner and the height h and width in the region
W is spent, sectional drawing plug-in unit is using abscissa x and ordinate y as starting point later, is that height, w cut this region as width using h
Figure, and be saved in institute's truncated picture as page area benchmark image in specified file.
S122, it is recorded in the page test operation carried out on the controlled browser.
It enables and records plug-in unit, test operation is carried out to web page on controlled browser, as described in step S121, record
Plug-in unit processed can record and preserve performed page test operation.
The image for the page area that S123, interception are specified is as page area benchmark image.
After having executed test operation to web page, the specified region for needing to carry out sectional drawing of tester, such as step S121
Described in, it is possible to specify it needs the element of sectional drawing or directly chooses the region for needing sectional drawing, after being positioned by positioning plug-in unit, sectional drawing
Plug-in unit carries out sectional drawing, truncated picture is preserved and as page area benchmark image.
Method described in S101 through the above steps can form the page behaviour including background module response data, recording
Make and the subsequent automation to web page code may be implemented in the test case of page area benchmark sectional drawing, the test case
Test job.
It should be noted that in practical applications, it may appear that a part of background module is ready, and another part backstage
The not yet ready situation of module, in addition, when background module is ready, record response data process can with step 121 to
The process of recording page test operation and intercept page zonal basis image that step S123 is described is carried out at the same time.So such as Fig. 4
Shown, method described in above-mentioned steps S101 S131-S134 can also be realized in the steps below:
S131, the response data for constructing not yet ready background module.
For not yet ready background module, the response data of those background modules need to be constructed, this process may be used
Identical method is completed with described in step S111 to step S112.
S132, it is recorded in the page test operation carried out on the controlled browser.
Method described in step S121 may be used to configure in controlled browser.Enable the record being loaded into controlled browser
Plug-in unit processed carries out web page to test required operation, and recording plug-in unit can record and preserve performed page test operation.
S133, the request that the page is sent to background module is intercepted, if corresponding with the request with existing in the data constructed
Response data, then returning to the response data to the page;Otherwise, corresponding background module is sent this request to, it will backstage
After the response data that module returns forms correspondence preservation with the request, the response data is returned to the page.
When being operated to web page, web page can send a request to background module, intercept the request, in step S131
Search whether there is response data corresponding with the request in the response data of construction, and if it exists, the sound that then will directly find
Data are answered to be back to web page;If being not present, illustrate that the background module that the request need to call is ready, therefore in step
The response data that the background module is not constructed in S131 needs to send this request to background module at this time, background module is returned
Return response data form correspondence with the request after preserve, response data is back to web page later, this process and
The response data that the foregoing description records background module is identical, and details are not described herein.
The image for the page area that S134, interception are specified is as page area benchmark image.
After completing to the test operation of web page, the specified region for needing to carry out sectional drawing, after being positioned by positioning plug-in unit,
Sectional drawing plug-in unit carries out sectional drawing to this region, truncated picture is preserved and as page area benchmark image.The reality of this step
Applying method can be identical as method described in step S123.
With continued reference to Fig. 1 is returned, there are step S102 later by subsequent steps S101.
S102, test simultaneously verification test result to tested page code using the test case.
This step is test process, is constructing page test operation and page including background module response data, recording
After the test case of this three of face zonal basis image, the test case can be utilized to complete the automation to being tested page code
Test simultaneously verification test result.As shown in figure 5, this process can be realized by following step S141-S143:
S141, recorded page test operation is played back in controlled browser.
Method described in step S121 may be used to configure in controlled browser.Playback plug-in unit is enabled, is played back to web page
The page test operation that plug-in unit is recorded, playback plug-in unit read operation from the file for preserving test operation are recorded in step S122
Type, the element finger URL operated and operating parameter etc., and these information are converted into corresponding operation and are held on web page
Row.
When playing back test operation to web page, web page can send to background module and ask, and the request be intercepted, from survey
Response data corresponding with the request is searched in the response data of example on probation and returns to web page.If the response of test case
Data include the response data of the response data and recording of construction, then can first search and whether there is in constructed response data
Response data corresponding with the request, and if it exists, then return to the response data to web page;Otherwise, background module is being recorded
Response data corresponding with the request is searched in the correspondence preserved when response data, if correspondence is the url with request
Or preserved according to the character string of identification request field generation, then correspondingly being asked with the url of the request or according to this is identified
The character string that field generates is asked to search response data corresponding with the request in correspondence.
The specified page area test image of S142, interception.
After the test operation of playback is finished, sectional drawing is carried out to page area.The page of sectional drawing is needed in this step
Region is identical as the page area specified in step S123, and in step S123, positioning plug-in unit has learned that the page for needing sectional drawing
The location information in face region, so in this step, positioning plug-in unit can directly position the position of the page area, and sectional drawing is inserted later
Part carries out sectional drawing to this page area.
S143, comparison intercepted specified page area image and page area benchmark image and validation test result.
The page area test image that step S142 is intercepted is carried out with the page area benchmark image in test case
Comparison, judges test result according to two images with the presence or absence of difference.The comparison of image can be, but not limited to use following sides
Method:
According to preset cell size, by page area test image with page area benchmark image with identical
Mode cutting is same amount of cell, and it is identical with page area benchmark image to choose page area test image successively
Cell calculates the similarity of image in two selected cells using dot matrix diff algorithms later, if calculating gained
Similarity is not less than preset threshold value, then it is assumed that the image of the two cells is identical, and test passes through;Otherwise it is assumed that this
The image of two cells has differences, and test does not pass through.Using the above method, the page can be judged as unit of cell
Domain test image whether there is difference with page area benchmark image.After the cell for finding to have differences, it can set
Function by the cell automatically to be highlighted, more intuitively tester to be prompted to have differences.If page area is surveyed
The size for attempting picture and page area benchmark image is smaller, then dot matrix diff algorithms can directly be used to calculate the similarity of the two,
And without being cell by image cutting.
The above-mentioned description carried out for the page code test method provided to the embodiment of the present invention one, by the above method,
It can realize the practical exhibition to web page code in a certain region (such as html codes, css codes, Javascript codes)
The automatic test of existing effect.Device provided by the invention is described below by embodiment two, the device is for completing
Flow described in the embodiment of the present invention one.
Embodiment two,
Fig. 6 is the test device schematic diagram of page code provided by Embodiment 2 of the present invention, as shown in fig. 6, the device packet
It includes:Structural unit 10, test cell 20, wherein structural unit 10 further comprises:Response data subelement 11, test operation
It records subelement 12 and the first sectional drawing subelement 13, test cell 20 further comprises:Test operation plays back 21 He of subelement
Second sectional drawing subelement 22.
Structural unit 10, for constructing test case, wherein the test case includes:Construction or the backstage mould recorded
Block response data, the page test operation of recording and page area benchmark image.
Structural unit 10 further comprises:Response data subelement 11, test operation record subelement 12 and first section
Figure subelement 13.
Response data subelement 11 is for constructing or recording background module response data.
For not yet ready background module, response data subelement 11 can execute operations described below to construct those backstages
The response data of module:
The format of background module response data corresponding with page request is determined, later according to described corresponding with page request
Background module response data format generate background module response data.
Response data subelement 11 can be managed collectively response data corresponding with asking by a management platform
Format may be sent to the web page of each type the request of background module on the platform, record the request
Type and corresponding response data format, which includes:Parameter in the structure and response data of response data
The value range etc. of quantity, type, title and each parameter.Later, it just can be determined from the management platform and each web
The page is sent to the format of the corresponding response data of request of background module.Background module corresponding with page request is being determined
After the format of response data, response corresponding with the request that web page is sent to background module can be generated according to this format
Data.The value of each parameter in response data is firstly generated, the present invention provides following two kinds of preferred embodiments and generates parameter value:Every
The value of each parameter is generated in the value range of one parameter at random;Alternatively, being needed according to test to set each parameter
Value.Later, the parameter generated is formed a complete response data by the structure of data according to response.
For ready background module, response data subelement 11 can execute operations described below to record those backstages
The response data of module:
The request that web page is sent to background module is intercepted, the request is recorded, then sends this request to backstage mould
Block preserves after the response data of the return of background module is formed correspondence with the request recorded before later, then by the sound
Data are answered to be back to web page.For the ease of preserving the correspondence between response data and request, sent intercepting web page
To background module request and when being recorded, operations described below can be executed:The url for recording the request, sends this request to
Background module preserves after the response data that background module returns is formed correspondence with the url recorded later;Extraction mark
The field of the request generates unique character string according to the field, background module is sent this request to, later by background module
The response data of return preserves after forming correspondence with the character string generated.
Test operation records subelement 12 for recording page test operation, this process can be by executing operations described below
It realizes:
It is loaded into the recording plug-in unit with recording function in controlled browser, enables the recording plug-in unit, obtains controlled clear
It lookes on device the operation executed to web page, records the corresponding action type of the operation, the element finger URL operated and operation
Parameter etc., and be stored in specified file.
First sectional drawing subelement 13 is used for intercept page zonal basis image, this process can be by executing operations described below
It realizes:
It is loaded into the positioning plug-in unit with positioning function and the sectional drawing plug-in unit with sectional drawing function in controlled browser, is surveying
After the recording that subelement 12 completes page test operation is recorded in examination operation, positioning plug-in unit is enabled, positioning needs the region of sectional drawing to exist
Position in the page enables sectional drawing plug-in unit later, and sectional drawing is carried out using as page area benchmark image to the region that is positioned.The
One sectional drawing subelement 13 can execute the operation of positioning sectional drawing by following two ways:
1, positioning sectional drawing is carried out according to element finger URL, after test operation, the specified element for needing sectional drawing enables
Positioning plug-in unit obtains the Xpath for being selected element, can position position of those elements in the page by the Xpath of element, open
Sectional drawing is carried out to the element that those are selected with sectional drawing plug-in unit, and is preserved institute's truncated picture as page area benchmark image
Into specified file.
2, positioning sectional drawing is carried out according to coordinate, after test operation, mouse drag chooses the region for needing sectional drawing, opens
The region is obtained relative to the abscissa x and ordinate y in the page upper left corner and the height h and width in the region with positioning plug-in unit
Spend w, later enable sectional drawing plug-in unit using abscissa x and ordinate y as starting point, using h be height, w as width to this region into
Row sectional drawing, and be saved in institute's truncated picture as page area benchmark image in specified file.
Test cell 20, the page test operation for playing back the recording intercept and are tested the page to background module transmission
Request and according to the request to the tested page return it is described construction or recording background module response data;It is additionally operable to interception page
Face domain test image, and the page area test image and page area benchmark image comparison test test are tied
Fruit.
Test cell 20 further comprises:Test operation plays back subelement 21 and the second sectional drawing subelement 22.
Test operation playback subelement 21 is used to play back the page test operation of the recording, intercepts and is tested the page to backstage
The request of module transmission and the background module response data for returning to the construction or recording to the tested page according to the request.
Test operation playback subelement 21 is loaded into the playback plug-in unit with playback function in controlled browser, later from spy
Determine read test operation in file and records the action type that subelement 12 is recorded, the element finger URL and operating parameter that are operated
Deng, by these information be converted to it is corresponding operate and enable playback plug-in unit the operation is executed to web page on controlled browser.
When web page can be sent to background module asks, test operation plays back subelement 21 and intercepts the request, from response
Response data corresponding with the request is searched in the response data that data sub-element 11 is constructed or recorded and returns to web page.
Test operation playback subelement 21, which is first searched in the response data that response data subelement 11 is constructed, whether there is and the request
Corresponding response data, and if it exists, then return to the response data to web page;Otherwise, it is recorded in response data subelement 11
Response data corresponding with the request is searched in the correspondence preserved when background module response data, if correspondence is to ask
The url asked or the character string generated according to identification request field preserve, then correspondingly with the url of the request or according to mark
The character string for knowing request field generation searches response data corresponding with the request in correspondence.
Second sectional drawing subelement 22 is used for intercept page domain test image, and by the page area test image and institute
State page area benchmark image comparison test test result.
After the test operation that test operation playback subelement 21 plays back is finished, the second sectional drawing subelement 22 enables the
The positioning plug-in unit and sectional drawing plug-in unit that one sectional drawing subelement 13 is loaded into controlled browser carry out sectional drawing to specified page region, will
Image is as page area test image obtained by sectional drawing, and the page area that the image and the first sectional drawing subelement 13 are intercepted
Benchmark image is compared with verification test result.The comparison of image can be, but not limited to use following methods:
According to preset cell size, by page area test image with page area benchmark image with identical
Mode cutting is same amount of cell, and it is identical with page area benchmark image to choose page area test image successively
Cell calculates the similarity of image in two selected cells using dot matrix diff algorithms later, if calculating gained
Similarity is not less than preset threshold value, then it is assumed that the image of the two cells is identical, and test passes through;Otherwise it is assumed that this
The image of two cells has differences, and test does not pass through.Using the above method, the page can be judged as unit of cell
Domain test image whether there is difference with page area benchmark image.After the cell for finding to have differences, it can set
Function by the cell automatically to be highlighted, more intuitively tester to be prompted to have differences.If page area is surveyed
The size for attempting picture and page area benchmark image is smaller, then dot matrix diff algorithms can directly be used to calculate the similarity of the two,
And without being cell by image cutting.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all essences in the present invention
With within principle, any modification, equivalent substitution, improvement and etc. done should be included within the scope of protection of the invention god.
Claims (8)
1. a kind of test method of page code, which is characterized in that this method includes:
S1, construction test case, wherein the test case includes:The background module response data of construction, the page of recording are surveyed
Examination operation and page area benchmark image;The background module response data constructs in the following way:It determines and the tested page
The format of the corresponding background module response data of request sent to background module generates each in response data according to the format
The value of parameter;The page area benchmark image obtains in the following way:Page test behaviour has been executed on controlled browser
After work, the image of specified page area is intercepted, wherein the specified page area is:It is fixed according to the page elements of selection
The region of position;Alternatively, the region directly chosen by mouse drag;
S2, the page test operation for playing back the recording intercept the request that the tested page is sent to background module and are asked according to this
Seek the background module response data that the construction is returned to the tested page;
S3, intercept page domain test image, and by the page area test image and the page area benchmark image pair
Compare verification test result.
2. according to the method described in claim 1, it is characterized in that, the recording of the page test operation, specially:
It is recorded in the page test operation executed on the controlled browser;
The page test operation of the recording is played back in the step S2, specially:On the controlled browser described in playback
The page test operation of recording.
3. according to the method described in claim 2, it is characterized in that,
Intercept page domain test image, specifically includes in the step S3:On the backstage for returning to the construction to the tested page
After module response data, the specified page area image is intercepted as page area test image on the tested page.
4. according to the method described in claim 1, it is characterized in that, by page area test image and the page in the step S3
Zonal basis image comparison verification test result, specifically includes:Calculate the page area test image and the page area
The similarity of benchmark image, if similarity is more than preset threshold value, then it is assumed that test passes through;Otherwise it is assumed that test is not led to
It crosses.
5. a kind of test device of page code, which is characterized in that the device includes:
Structural unit, for constructing test case, wherein the test case includes:The background module response data of construction, record
The page test operation and page area benchmark image of system;The structural unit includes response data subelement, the number of responses
According to subelement for constructing the background module response data in the following way, determines and sent to background module with the tested page
The corresponding background module response data of request format, the value of each parameter in response data is generated according to the format;It is described
Structural unit includes the first sectional drawing subelement, and the first sectional drawing subelement is for intercept page zonal basis in the following way
Image:After having executed page test operation on controlled browser, the image of specified page area is intercepted, wherein the finger
Fixed page area is:The region positioned according to the page elements of selection;Alternatively, the region directly chosen by mouse drag;
The test cell of subelement and the second sectional drawing subelement is played back including test operation;
The test operation plays back subelement, and the page test operation for playing back the recording intercepts and is tested the page to backstage
The request of module transmission and the background module response data for returning to the construction to the tested page according to the request;
The second sectional drawing subelement is used for intercept page domain test image, and by the page area test image and institute
State page area benchmark image comparison test test result.
6. device according to claim 5, which is characterized in that the structural unit includes that test operation records subelement,
The test operation records subelement for recording the page test operation in the following way:
It is recorded in the page test operation executed on the controlled browser;
The test operation playback subelement plays back the page test operation of the recording in the following way:
The page test operation of the recording is played back on the controlled browser.
7. device according to claim 6, which is characterized in that
Second sectional drawing subelement intercept page domain test image in the following way:
After test operation playback subelement returns to the background module response data of the construction to the tested page, tested
The specified page area image is intercepted on the page as page area test image.
8. device according to claim 5, the second sectional drawing subelement is in the following way by page area test chart
Picture and page area benchmark image comparison test test result:
The similarity of the page area test image and the page area benchmark image is calculated, if similarity is more than to set in advance
Fixed threshold value, then it is assumed that test passes through;Otherwise it is assumed that test does not pass through.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210345049.1A CN103678105B (en) | 2012-09-17 | 2012-09-17 | A kind of test method and device of page code |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210345049.1A CN103678105B (en) | 2012-09-17 | 2012-09-17 | A kind of test method and device of page code |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103678105A CN103678105A (en) | 2014-03-26 |
CN103678105B true CN103678105B (en) | 2018-11-09 |
Family
ID=50315745
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201210345049.1A Active CN103678105B (en) | 2012-09-17 | 2012-09-17 | A kind of test method and device of page code |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103678105B (en) |
Families Citing this family (26)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105515883A (en) * | 2014-09-22 | 2016-04-20 | 阿里巴巴集团控股有限公司 | Test method and system |
US9753843B2 (en) * | 2014-11-20 | 2017-09-05 | Accenture Global Services Limited | Automated testing of web-based applications |
CN104636255A (en) * | 2015-02-14 | 2015-05-20 | 广州华多网络科技有限公司 | Method and device for testing webpage application display effect |
CN105068918B (en) * | 2015-06-03 | 2017-11-17 | 中国人民财产保险股份有限公司 | A kind of page method of testing and device |
CN106326091B (en) * | 2015-06-24 | 2020-12-11 | 深圳市腾讯计算机***有限公司 | Method and system for detecting browser webpage compatibility |
CN104978270A (en) * | 2015-07-03 | 2015-10-14 | 上海触乐信息科技有限公司 | Automatic software testing method and apparatus |
CN105095083A (en) * | 2015-08-24 | 2015-11-25 | 上海斐讯数据通信技术有限公司 | Mobile phone interface screenshot test method and device used in Android system |
CN105260301A (en) * | 2015-09-24 | 2016-01-20 | 努比亚技术有限公司 | Visual effect comparison test device of user interfaces and realization method of visual effect comparison test device of user interfaces |
CN105653460A (en) * | 2016-02-29 | 2016-06-08 | 东南大学 | Method and system for recording and playback of man-machine interface testing actions of touch screen product |
CN105930265A (en) * | 2016-04-11 | 2016-09-07 | 武汉卡比特信息有限公司 | Image recognition based software test method |
CN107040574B (en) * | 2016-11-17 | 2020-03-27 | 阿里巴巴集团控股有限公司 | Screenshot and data processing method and device |
CN106802864A (en) * | 2016-12-30 | 2017-06-06 | ***股份有限公司 | A kind of method of testing and device based on financial sector |
CN107239404A (en) * | 2017-07-27 | 2017-10-10 | 广州云测信息技术有限公司 | A kind of positioning problems method and apparatus |
CN108255726A (en) * | 2018-01-18 | 2018-07-06 | 北京网信云服信息科技有限公司 | A kind of application program page adaptation test method and device |
CN110704772A (en) * | 2018-06-22 | 2020-01-17 | 北京京东尚科信息技术有限公司 | Page abnormity monitoring method, system, device, electronic equipment and computer readable medium |
CN109086203B (en) * | 2018-07-20 | 2022-10-28 | 百度在线网络技术(北京)有限公司 | Page detection method and device |
CN109784369A (en) * | 2018-12-14 | 2019-05-21 | 深圳壹账通智能科技有限公司 | H5 page test method and device, electronic equipment, storage medium |
CN109885484A (en) * | 2019-01-16 | 2019-06-14 | 深圳壹账通智能科技有限公司 | Application page test method, device, computer equipment and storage medium |
CN110008117A (en) * | 2019-03-12 | 2019-07-12 | 深圳壹账通智能科技有限公司 | Page test method, device, computer equipment and storage medium |
CN110580224A (en) * | 2019-09-20 | 2019-12-17 | 中国银行股份有限公司 | System testing method, device and equipment |
CN110737599A (en) * | 2019-10-18 | 2020-01-31 | 付彪 | Front-end automatic regression testing system and method based on picture comparison technology |
CN111522749B (en) * | 2020-04-26 | 2023-04-11 | 北京三快在线科技有限公司 | Page testing method and device, readable storage medium and electronic equipment |
CN113722203A (en) * | 2020-05-26 | 2021-11-30 | 京东数字科技控股有限公司 | Program testing method and device, electronic device and computer readable storage medium |
CN112100075B (en) * | 2020-09-24 | 2024-03-15 | 腾讯科技(深圳)有限公司 | User interface playback method, device, equipment and storage medium |
CN112256984B (en) * | 2020-10-22 | 2022-09-30 | 上海万物新生环保科技集团有限公司 | Method and device for acquiring interface background screenshot corresponding to webpage |
CN113342627B (en) * | 2021-05-31 | 2023-03-21 | 深圳前海微众银行股份有限公司 | Application service monitoring method and monitoring system of terminal |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101242621A (en) * | 2008-01-21 | 2008-08-13 | 中兴通讯股份有限公司 | An automatic testing method and system based on interface |
CN101882105A (en) * | 2010-06-01 | 2010-11-10 | 华南理工大学 | Method for testing response time of Web page under concurrent environment |
CN102419732A (en) * | 2011-12-27 | 2012-04-18 | Tcl集团股份有限公司 | Android-platform-based automated testing method and testing tool |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8151276B2 (en) * | 2008-02-27 | 2012-04-03 | Accenture Global Services Gmbh | Test script transformation analyzer with change guide engine |
-
2012
- 2012-09-17 CN CN201210345049.1A patent/CN103678105B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101242621A (en) * | 2008-01-21 | 2008-08-13 | 中兴通讯股份有限公司 | An automatic testing method and system based on interface |
CN101882105A (en) * | 2010-06-01 | 2010-11-10 | 华南理工大学 | Method for testing response time of Web page under concurrent environment |
CN102419732A (en) * | 2011-12-27 | 2012-04-18 | Tcl集团股份有限公司 | Android-platform-based automated testing method and testing tool |
Also Published As
Publication number | Publication date |
---|---|
CN103678105A (en) | 2014-03-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103678105B (en) | A kind of test method and device of page code | |
CN111262759B (en) | Internet of things platform testing method, device, equipment and storage medium | |
CN104794050B (en) | The test method of application program, apparatus and system | |
CN103942497B (en) | Forensics type website vulnerability scanning method and system | |
CN107341098A (en) | Software performance testing method, platform, equipment and storage medium | |
CN108717393A (en) | A kind of applied program testing method and mobile terminal | |
CN106354634A (en) | Interface testing method and device | |
CN109542791A (en) | A kind of program large-scale concurrent evaluating method based on container technique | |
CN108446221A (en) | System detection method, device, computer equipment and storage medium | |
US20230273775A1 (en) | Remote application modernization | |
CN108459850B (en) | Method, device and system for generating test script | |
CN110401634A (en) | A kind of web application hole detection regulation engine implementation method and terminal | |
CN110221959B (en) | Application program testing method, device and computer readable medium | |
CN109460365B (en) | A kind of system performance testing method, apparatus, equipment and storage medium | |
JP4627539B2 (en) | Load test system, load test data creation method, and program thereof | |
CN108415826A (en) | Test method, terminal device and the computer readable storage medium of application | |
CN110833693A (en) | Game running method and device, storage medium and electronic device | |
CN107704369A (en) | A kind of recording method of Operation Log, electronic equipment, storage medium, system | |
CN110380936A (en) | Test method and device | |
KR20150025106A (en) | Verification apparatus, terminal device, system, method and computer-readable medium for monitoring of application verification result | |
CN104734918A (en) | Lightweight webpage performance testing architecture and method | |
CN101510172B (en) | Test system and method | |
CN109840212A (en) | Function test method, device, equipment and the readable storage medium storing program for executing of application program | |
CN107332805A (en) | Detect the methods, devices and systems of leak | |
CN110399723A (en) | Leak detection method and device, storage medium and electronic device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
EXSB | Decision made by sipo to initiate substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |