CN109902016A - A kind of test method and test platform of Web - Google Patents

A kind of test method and test platform of Web Download PDF

Info

Publication number
CN109902016A
CN109902016A CN201910161259.7A CN201910161259A CN109902016A CN 109902016 A CN109902016 A CN 109902016A CN 201910161259 A CN201910161259 A CN 201910161259A CN 109902016 A CN109902016 A CN 109902016A
Authority
CN
China
Prior art keywords
case
test
file
configuration file
tested
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910161259.7A
Other languages
Chinese (zh)
Other versions
CN109902016B (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.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network 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 Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN201910161259.7A priority Critical patent/CN109902016B/en
Publication of CN109902016A publication Critical patent/CN109902016A/en
Application granted granted Critical
Publication of CN109902016B publication Critical patent/CN109902016B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The embodiment of the invention provides the test method of Web a kind of and test platforms, first obtain manual testing's use-case, generate automation use-case, page configuration file according to manual testing's use-case and execute use-case configuration file;Tested browser version information is determined then according to the execution use-case file, obtains and updates the driving Driver file to match with the tested browser version information;Test is finally executed according to the automation use-case, page configuration file and execution use-case configuration file.Test speed of the present invention is quick, manual test can be allowed mutually to map with automatic test, automatic test is combined with manual test, the more conducively management of test cases of systematization, also reduce testing cost, and test platform is matched with browser before testing, is matched without manpower, can also improve testing efficiency.

Description

A kind of test method and test platform of Web
Technical field
The present invention relates to network communication fields, test method and a kind of Web test platform more particularly to a kind of Web.
Background technique
Since Web is using directly related with user, and usually require to bear prolonged a large amount of operations, the function of Web project Can and performance all have to pass through reliable verifying, therefore will comprehensive test Jing Guo Web project.And with Internet technology Progress and development, more and more automated test frames are applied in internet every field.
And presently used testing tool, there are following deficiencies: manual use-case and automation in testing tool are used An example point two places store, configuration file, test parameter, and cross-platform compatibility test requires manual loading and selects corresponding test Environment, for a new person or the people for being unfamiliar with code, test case is write in study, positioning webpage report an error reason at This is higher.
More in addition precisely due to local browser upgrades automatically, can frequently result in the WebDriver of test frame with it is clear Device of looking at is inconsistent, to lead to the problem of various.And when needing to test in different environments, data file in system with It tests browser to mismatch, and needs the data file in frequent replacement system, greatly reduce testing efficiency, increase survey The workload of examination.
Summary of the invention
In view of the above problems, it proposes the embodiment of the present invention and overcomes the above problem or at least partly in order to provide one kind The test method of the Web to solve the above problems a kind of and a kind of Web test platform.
To solve the above-mentioned problems, the embodiment of the invention discloses the test method of Web a kind of, this method includes following step It is rapid:
Manual testing's use-case is obtained, automation use-case, page configuration file is generated according to manual testing's use-case and is held Row use-case configuration file;
Tested browser version information is determined according to the execution use-case file, is obtained and is updated and the tested browser The driving Driver file that version information matches;
Test is executed according to the automation use-case, page configuration file and execution use-case configuration file.
Optionally, manual testing's use-case includes basic test parameter, test URL, use-case ID, use-case keyword, uses Example title, testing procedure, test data;
Use-case, which is generated, according to the basic test parameter, use-case title, use-case keyword executes configuration file;
Page configuration file is generated according to the test URL, use-case ID;
Automation use-case is generated according to the testing procedure, test result.
Optionally, described to obtain and update the driving Driver file packet to match with the tested browser version information It includes:
The title of objective browser is read, the objective browser is to execute use-case configuration file to need browsing to be tested Device;
According to the title of the objective browser, objective browser version information is obtained;
From preset map information table, searches and believe with the Driver version of the objective browser matches version information Breath;
According to the Driver version information, is applied from preset Driver and obtain corresponding Driver file in pond and fill It carries.
It is optionally, described to obtain and load the driving Driver file to match with the tested browser version information, Further include:
According to the execution test profile, tested environment is determined;
According to the tested environment, corresponding Host file is obtained;
According to the Host file in the corresponding Host file replacement system.
Optionally, executing test according to the automation use-case, page configuration file and execution use-case configuration file includes;
Basic function testing is executed according to the step of execution use-case file, automation use-case;
The test of CSS label is executed according to the step of page configuration file, automation use-case;
The test of picture similarity is executed according to the step of page configuration file, automation use-case.
Optionally, the test of picture similarity is executed according to the step of page configuration file, automation use-case, further includes:
The href link of currentElement configuration file is obtained, and sends HTTP request to href connection and opens link, is sentenced Whether the return value of disconnected HTTP request is correct;
If the HTTP request return value mistake sent, issues use-case and report an error instruction;
If the HTTP request return value sent is correct, current page exhibiting pictures P1 and href configuration link picture are pulled P2 judges whether the check value of P1 and P2 is identical;
If check value is identical, determine that picture is identical;
If check value is not identical, compared by the Image entropy that picture similarity algorithm carries out picture;
If being less than entropy, determine that picture is identical;
It if more than entropy, determines that picture is not identical, issues use-case and report an error instruction.
Optionally, this method further include:
New page configuration file is regenerated according to the page configuration file, and judge new page configuration file with Whether former page configuration file is identical;
If they are the same, former page configuration file is not replaced with new page configuration file;
If not identical, former page configuration file is replaced with new page configuration file.
Optionally, new page configuration file is obtained by CSS pseudo-code and tree table, the page configuration file includes root member Plain configuration file and tested element arrangements file, obtaining new page configuration file includes:
The dom tree shape structure of the root node of the tested page is extracted according to the page configuration file;
According to the dom tree shape structure composition root element configuration file of the root node of the tested page;
Tested element arrangements the file information is obtained according to the root element configuration file;
Tested element arrangements file is generated according to the tested element arrangements the file information.
Optionally, according to the dom tree shape structure composition root element configuration file of the root node of the tested page, comprising:
Obtain the root node of the tested page;
The unique identification node under root node is got according to the root node;
Root element configuration file is obtained according to the unique identification node under the root node.
Optionally, the root node of the tested page is obtained, further includes:
The unique identification under root node is obtained according to the root node of the tested page, and judges the root node of the tested page Whether there is unique ID to identify;
If the root node of the tested page has unique ID to identify, unique ID mark is recorded, and with ID mark Know and obtains root node;
If the root node of the tested page does not have unique ID node, judge the tested page root node whether There is CSS node;
If the root node of the tested page has CSS node, CSS mark is recorded, and identify with the CSS and obtain root section Point.
If the root node of the tested page does not have CSS node, element array is oriented by CSS, then judge whether The element is uniquely navigated to by including pseudo- class;
If can position, record location information, and root node is obtained with location information;
If cannot position, positioned by its location tags, and record position label, obtains root node with location tags.
Optionally, the unique identification node under root node is got according to the root node, further includes:
The node for possessing ID mark under root node root is extracted, the information of the node is identified by ID, and record his father Nodal information, using parent information as root node under unique identification, thus the unique identification node under obtaining root node.
Optionally, generating tested element arrangements file according to the tested element arrangements the file information includes:
Judge whether present node has unique ID to identify;
If the present node has unique ID to identify, former tested element is recorded as its unique identification in ID mark and is matched It sets in file, and generates new tested element arrangements file, to obtain new page configuration file;
If present node does not have ID mark, judge whether the present node has unique CSS to identify;
If the present node has unique CSS to identify, former tested element is recorded as unique identification in CSS mark and is matched It sets in file, and generates new tested element arrangements file, to obtain new page configuration file;
If the present node does not have unique CSS to identify, content element, the left brotgher of node, the right side of present node are obtained The brotgher of node or the grandparent node for possessing unique identification, and by the content element, the left brotgher of node, the right brotgher of node or possess The grandparent node of unique identification is recorded in former tested element arrangements file, new tested element arrangements file is generated, to obtain Obtain page configuration file newly.
It optionally, further include obtaining test result, and test report is generated according to the test result.
The invention also provides a kind of Web test platform, the Web test platform includes use-case generation module, file dress Carry module, test module;
The use-case generation module is generated according to manual testing's use-case and is automated for obtaining manual testing's use-case Use-case, page configuration file and execution use-case configuration file;
The load of file module is used to determine tested browser version information according to the execution use-case file, obtain simultaneously Update the driving Driver file to match with the tested browser version information;
The test module is used for according to the automation use-case, page configuration file and executes the execution of use-case configuration file Test.
The invention also provides a kind of devices, comprising:
One or more processors;With
One or more machine readable medias of instruction are stored thereon with, are executed when by one or more of processors When, so that described device executes method as described above.
The invention also provides one or more machine readable medias, are stored thereon with instruction, when by one or more When managing device execution, so that the processor executes method as described above.
In an embodiment of the present invention, first obtain manual testing's use-case, according to manual testing's use-case generate automation use-case, Page configuration file and execute use-case file, then matching update driving Driver file, then according to the automation use-case, Page configuration file and execution configuration file test Web.Test method test process proposed by the present invention is quick, and Manual test can solve to the mapping relations of automatic test, automatic test has been combined with manual test, more Conducive to the management of test cases of systematization, testing cost is also reduced, and before testing matches test platform with browser, It is matched without manpower, can also improve testing efficiency.
Detailed description of the invention
Fig. 1 is a kind of step flow diagram of one of embodiment of the test method of Web;
Fig. 2 is a kind of step flow diagram of one of embodiment of the test method of Web
Fig. 3 is to update driving Driver file schematic diagram in one of embodiment of the invention;
Fig. 4 is to update Host file schematic diagram in one of embodiment of the invention;
Fig. 5 is to obtain new page configuration document flow schematic diagram in one of embodiment of the invention;
Fig. 6 is to obtain root element configuration file flow diagram in one of embodiment of the invention;
Fig. 7 is the root node flow diagram that the tested page is obtained in one of embodiment of the invention;
Fig. 8 is the unique identification node flow diagram got under root node in one of embodiment of the invention;
Fig. 9 is to obtain tested element arrangements the file information flow diagram in one of embodiment of the invention;
Figure 10 is picture testing process schematic diagram in one of embodiment of the invention;
Figure 11 is to run schematic diagram of mechanism again in one of embodiment of the invention.
Specific embodiment
In order to make the foregoing objectives, features and advantages of the present invention clearer and more comprehensible, with reference to the accompanying drawing and specific real Applying mode, the present invention is described in further detail.
Referring to Fig.1, a kind of step flow chart of the test method one of which embodiment of Web of the invention is shown, it should Method is for testing internet Web, and in the present embodiment, when test can directly use test application program, can also To carry independent Web Service on the platforms such as the server of test platform or Web, internet Web is tested.? This method can specifically include following steps in the present embodiment:
Step 101, manual testing's use-case is obtained, automation use-case, page configuration are generated according to manual testing's use-case File and execution use-case configuration file;
Since the manual use-case of traditional Adaptive Web automatic test needs to separate two places storage with automation use-case, When the test of each cross-platform compatibility requires manual loading and selects corresponding test environment, for a new person or not yet done It knows for the people of code, test case is write in study, and positioning webpage reports an error the higher cost of reason.
It in the present embodiment, can be by generating use-case to compositions such as required keyword, test parameters, and according to required The corresponding configuration file of generations and the testing procedure such as keyword, test parameter, realize the generation of automation use-case, both can increase The practicability and reliability of test, can also reduce its testing cost.
Step 102, tested browser version information, and acquisition and tested browser are determined according to the execution use-case file The driving Driver file to match updates test platform according to the driving Driver file and drives Driver file;
Because the local browser of user have automatically updating function, when testing Web WebDriver used often with Browser version mismatches, to will lead to the problems such as test case reports an error or cannot test;And the access of the Web in test In page, if the IP address of web access page IP corresponding with the common web access page for the system file Host foundation being locally stored Location mismatches, and causes to test environment difference thus can not autonomous operation test.
Web test method proposed by the present invention can be before being tested, to WebDriver used when testing and this every time The system file Host of ground storage is updated, it is ensured that the browser version of the WebDriver and test that use match, Web The IP address IP address corresponding with the common web access page that system file Host is established of access page matches, and avoids testing out Mistake improves the efficiency of test.
Step 103, test is executed according to the automation use-case, page configuration file and execution use-case configuration file;
It obtains automation use-case, page configuration file and executes three files of use-case configuration file and tested, can be made Test result is more accurate, more intuitive, and due to automation use-case, page configuration file and execution use-case configuration file three File is generated by artificial use-case, and artificial use-case can increase test ginseng in input by manual input Number, testing procedure etc. increase the range of test, further increase the accuracy of test.
It in an embodiment of the present invention, can keyword, test parameter and testing procedure needed for first manual input et al. Existing artificial use-case is called in work use-case or input, then according to the use-case of the generations such as required keyword, test parameter, according to The use-case of generation generates corresponding configuration file and testing procedure, reads tested system then according to configuration file and testing procedure Unite local browser IP, by local browser version IP update into preset Driver file so that Web to be tested with into The device version of row test is identical, executes test then according to the configuration file and the testing procedure.Entire test process Quickly, it and can solve manual test to the mapping relations of automatic test, automatic test closed with manual test Together, the more conducively management of test cases of systematization, also reduces testing cost, and before testing by test platform with it is clear Device of looking at matching, matches without manpower, can also improve testing efficiency.
It should be noted that for simple description, therefore, it is stated as a series of action groups for embodiment of the method It closes, but those skilled in the art should understand that, embodiment of that present invention are not limited by the describe sequence of actions, because according to According to the embodiment of the present invention, some steps may be performed in other sequences or simultaneously.Secondly, those skilled in the art also should Know, the embodiments described in the specification are all preferred embodiments, and the related movement not necessarily present invention is implemented Necessary to example.
Referring to Fig. 2, a kind of step flow chart of the test method one of which embodiment of Web of the invention is shown, In the present embodiment, can be used testing tool (as with Web Service server or test platform, equipped with each test The server or test platform of process, the test platform for carrying selenium automated test tool or server etc.) it carries out Test, this method can specifically include following steps:
Step 201, manual testing's use-case is obtained, automation use-case, page configuration are generated according to manual testing's use-case File and execution use-case configuration file;
Manual testing's use-case can write use-case by manual input, manpower, and manual testing's use-case that manpower is write can To include basic test parameter, test URL, use-case ID, use-case keyword, use-case title, testing procedure, test data etc.;
Use-case, which is generated, according to the basic test parameter, use-case title, use-case keyword executes configuration file, the use of generation It is text.xml file that example, which executes file,;
Page configuration file is generated according to the test URL, use-case ID, the page configuration file of generation is .Properties file;
Automation use-case is generated according to the testing procedure, test result, the .jar file packet of use-case generation will be automated. Wherein test result can be the expected test result of manual compiling, be also possible to the last test result tested.It will Test result generate automation use-case be in order to when finally obtaining test result, can by the test result finally obtained with it is defeated The test result entered is compared, and technical staff is facilitated to analyze after a test.
Manual testing's use-case of manual compiling can store manual use-case and automation use-case, more convenient pipe together Reason, and configuration file can be quickly generated;When carrying out cross-platform compatibility test, corresponding test wrapper can be loaded directly into and selected Border improves testing efficiency.Even if a new person is unfamiliar with for the people of code, error probability can be also reduced, reduces and surveys Try cost.Manual testing's use-case can be artificial progress manual input, can also be manually from the artificial use-case of importing.
Step 202, tested browser version information is determined according to the execution use-case file, obtain and updated and the quilt Survey the driving Driver file that browser version information matches.
Referring to Fig. 3, step 202 can also include following sub-step:
Sub-step S2021, reads the title of objective browser to be tested, and the objective browser is to execute use-case configuration File needs browser to be tested;
Sub-step S2022 obtains objective browser version information according to the title of the objective browser;
Sub-step S2023 is searched and the objective browser matches version information from preset map information table Driver version information;
Sub-step S2024, it is corresponding using being obtained in pond from preset Driver according to the Driver version information Driver file simultaneously loads.
Tested browser version information is determined according to the execution use-case file, is to believe with the version of tested browser Manner of breathing matching can frequently result in version information and the survey of tested browser because tested browser has automatic upgrade function It tries equipment or test platform to mismatch, to lead to the problem of various, to need manually to be matched manually, reduces to test and imitate Rate.The version information for matching tested browser before testing is avoided that test error.
Referring to Fig. 4, step 202 can also include following sub-step:
Sub-step S2025 determines test environment according to the execution use-case file;
Sub-step S2026 obtains corresponding Host file according to the tested environment;
Sub-step S2027, according to the Host file in the corresponding Host file replacement system.
While determining tested browser version information according to the execution use-case file, test environment, test wrapper are determined Border may include trunk environment, STG environment, and environment on line, trunk environment is the primary climate of test, and STG environment is pre- publication ring The public same database of environment on border, STG environment and line.
Because presetting the Host file of a not no extension name in the system of internet Web, Host file is responsible for one The corresponding IP address of a little common network address domain names establishes an associated database, when browser inputs stepping on for a needs When the network address of land, system can find corresponding IP address from Hosts file automatically first, once finding, system can be opened immediately Network address can be submitted DNS name resolution server to carry out IP address parsing by corresponding webpage, system if it is not found, again, such as Fruit is the discovery that shielded IP or domain name, will forbid opening this webpage.When needing to test in different environments, people is needed Hand frequently replaces Host file so that test can not autonomous operation, to reduce testing efficiency.Before being tested, according to Use-case file detection test environment is executed to be replaced without manpower to update Host file, allow entire test platform from Main operation substantially increases the efficiency of test.
Updating Host file can carry out simultaneously with driving Driver file is updated, and can also carry out respectively, can basis Practical application needs are adjusted.
Step 203, new page configuration file is regenerated according to the page configuration file, and judges that the new page is matched It sets file and whether former page configuration file is identical;
If they are the same, then former page configuration file is not replaced with new page configuration file;
If not identical, former page configuration file is replaced with new page configuration file.
Since Web test needs to carry out according to the step of automation use-case, and automates use-case and excessively rely on front end page Element, if subtle change occurs for front end page label, it is possible to lead to a large amount of use-case because positioning is reported less than page elements It is wrong.Therefore before being tested, new page configuration file is regenerated according to the page configuration file of generation, by the new page Configuration file is compared with former page configuration file, if different, replace the former page using new page configuration file and matches File is set, the accuracy of test is improved, reduces the probability of error.
It is that new page configuration file is obtained by CSS pseudo-code and tree table in the present embodiment, the new page configuration text Part includes root element configuration file root.properties and tested element arrangements file index.properties;
Referring to Fig. 5, generating new page configuration file may include following sub-step:
Sub-step S2031 extracts the dom tree shape structure of the root node of the tested page according to the page configuration file;
Sub-step S2032, according to the dom tree shape structure composition root element configuration file of the root node of the tested page;
Sub-step S2033 obtains tested element arrangements the file information according to the root element configuration file;
Sub-step S2034 generates tested element arrangements file according to the tested element arrangements the file information.
According to newly-generated root element configuration file and tested element arrangements file and old root element configuration file and by It surveys element arrangements file to be compared, to judge whether page configuration file sends variation, if there is transformation, be matched with the new page It sets file and replaces old page configuration file, avoid changing because of page configuration file, error when causing to test.
Referring to Fig. 6, the sub-step S2032 can also include following sub-step:
Sub-step S20321 obtains the root node of the tested page;
Sub-step S20322 gets the unique identification node under root node according to the root node;
Sub-step S20323 obtains root element configuration file according to the unique identification node under the root node.
Referring to Fig. 7, the sub-step S20321 can also include following sub-step:
Sub-step S203211 obtains the unique identification under root node according to the root node of the tested page, and judges quilt Whether the root node for surveying the page has unique ID to identify;
If the root node of the tested page has unique ID to identify, unique ID mark is recorded, is identified and is obtained with ID Root node;
If the root node of the tested page does not have unique ID to identify, judge the tested page root node whether There is CSS node;
If the root node of the tested page has CSS node, CSS mark is recorded, is identified with CSS and obtains root node.
If the root node of the tested page does not have CSS node, element array is oriented by CSS, then judge whether The element is uniquely navigated to by including pseudo- class;
If can position, record location information, root node is obtained with location information;
If cannot position, positioned by its location tags, and record position label, obtains root node with location tags.
By obtaining the marks such as unique ID mark, CSS mark, location information or position, and root node is recorded It is interior, so that root node is obtained according to above-mentioned mark, so that each root node got has one-to-one mark, energy Effectively the case where avoiding page elements that from can not identifying, no matter any variation occurs for tested browser or tested page midway, can It is recorded in new page configuration file, to improve the accuracy rate of follow-up test.If not generating new page configuration file, When testing, subtle change will occur because of front end page label, it is possible to lead to a large amount of use-case because positioning not It reports an error to page elements.
Referring to Fig. 8, sub-step S20322 can also include following sub-step:
Sub-step S203221 extracts the node for possessing ID mark under root node root, passes through the letter of the node of ID mark Breath, and records its parent information, using parent information as root node under unique identification, thus under obtaining root node only One mark node.
The nodal information for possessing the node of ID mark and its parent information are recorded one by one, and in this, as root The unique identification of node, so that root node can be identified and be distinguished with other identifier.
Referring to Fig. 9, sub-step S2033 can also include following sub-step:
Sub-step S20331, judges whether present node has unique ID to identify;
If the present node has unique ID to identify, former tested element is recorded as its unique identification in ID mark and is matched It sets in file, and generates new tested element arrangements file, to obtain new page configuration file;
If present node does not have ID mark, judge whether the present node has unique CSS to identify;
If the present node has unique CSS to identify, former tested element is recorded as unique identification in CSS mark and is matched It sets in file, and generates new tested element arrangements file, to obtain new page configuration file;
If the present node does not have unique CSS to identify, content element, the left brotgher of node, the right side of present node are obtained The brotgher of node or the grandparent node for possessing unique identification, and by the content element, the left brotgher of node, the right brotgher of node or possess The grandparent node of unique identification is recorded in former tested element arrangements file, new tested element arrangements file is generated, to obtain Obtain page configuration file newly.
Since CSS mark is the language of user's rendering html or xml a kind of, CSS can be by pattern using its selector Attribute is tied to specified node element, i.e. front end developer can use each pattern on the CSS setting page, no matter one Mostly complexity is located in a element, since developer can position and be arranged pattern, then tester can also be positioned by CSS To the node element, the node element is then operated.CSS tends to quickly navigate to complicated element section by succinct grammer Point.Simultaneously for the node element that can uniquely navigate to by ID or CSS, just directly pass through ID the and CSS label of itself Positioning.If the node element that can not uniquely navigate to by CSS, need to determine by way of structure pseudo-code and content pseudo-code Position, can guarantee and uniquely navigate to the node element.
In the present embodiment, the mode of positioning can position the node element by content pseudo-code.
Step 204, test is executed according to the automation use-case, page configuration file and execution use-case configuration file.
In the present embodiment, executing test includes that functional test, page css test and picture test are carried out to the tested page Three tests can need to be adjusted test item, and adjust the testing sequence of test item according to application.
The functional test executes Basic function testing according to the step of execution use-case file, automation use-case, In the present embodiment, the basic function may include the current URL of page title, the page, the current source code of the page, page elements category Property and page elements value etc.;
The page css test executes the test of CSS label according to the step of page configuration file, automation use-case, The CSS label test can first obtain label value, to obtain the label value of CSS, the CSS parameter for then carrying out each dimension is surveyed Examination;
The picture test executes the test of picture similarity according to the step of page configuration file, automation use-case, described The test of picture similarity may include to picture being compared based on check value, the test of picture similarity and based on similarity algorithm Compared with.
Referring to Fig.1 0, picture test executes the test of picture similarity according to the step of page configuration file, automation use-case May include following sub-step:
Sub-step S2041 obtains the href link of currentElement configuration file, sends HTTP request to href connection and beat Open chain connects, and judges whether the return value of HTTP request is correct;
If the HTTP request return value mistake sent, issues use-case and report an error instruction;
If the HTTP request return value sent is correct, current page exhibiting pictures P1 and href configuration link picture are pulled P2 judges whether the check value of P1 and P2 is identical;
If check value is identical, determine that picture is identical;
If check value is not identical, the Image entropy comparison of picture is carried out by picture similarity algorithm;
If being less than entropy, determine that picture is identical;
It if more than entropy, determines that picture is not identical, issues use-case and report an error instruction.
In the present embodiment, the check value of picture P1 and P2 can be md5 value, be also possible to sha1 value or crc verification etc. Deng.
In the present embodiment, it is tested by three, can increase the range of test, greatly increase the accuracy rate of test.
Referring to Fig.1 1, in the present embodiment, when test, is equipped with mechanism of running again, and the heavy race mechanism is that failure runs again survey three times Examination;
If test for the first time and second of test run failure, judge whether it is page elements and report an error;
If not page elements report an error, then test continues to run again, continues to test;
If page elements report an error, then unique ID mark is judged whether it is;
If unique ID mark, then run the use-case, continue to test again;
If not Unique ID, then find the grandparent node or root node css node of its Unique ID, by interior Containing pseudo-code, it is found in the position of grandparent node, then by label jackknife method, updates its location information, finds its grandparent node It is positioned with the brotgher of node.
Step 205, test result is obtained, and test report is generated according to test result.
Test report may include that operation element is highlighted, mistake screenshot, Error Elements mark and error log are analyzed Etc..It finally sends test report in the mobile device of each tester, can be sent out by email or short message form It send.
In an embodiment of the present invention, artificial use-case is then first write by manpower, phase is then generated according to artificial use-case The configuration file and testing procedure answered update then according to configuration file and testing procedure and match browser with tested browser Information, while test environment is updated, and be updated in time to page elements with testing procedure using configuration file, it generates new Page elements generate test result further according to the new page elements, the configuration file and the testing procedure, finally will Test result generates test report.The present invention solves mapping relations of the manual test to automatic test, more conducively systematization Management of test cases, reduce testing cost;Because browser version upgrades, Driver mismatch causes effective solution Test case execute failure problem;Effective solution front end page changes, so that page elements obtain less than and cause Element report an error;Effective solution automation use-case can only carry out the defect problem of functional test, realize head end test;Energy Effective position Error Elements can illustrate the place of mistake ultimately producing error reporting clearly, and can cut in mistake Figure and Error Elements watermarking, after a test can analyze mistake, tester is facilitated preferably to be managed.
It should be noted that for simple description, therefore, it is stated as a series of action groups for embodiment of the method It closes, but those skilled in the art should understand that, embodiment of that present invention are not limited by the describe sequence of actions, because according to According to the embodiment of the present invention, some steps may be performed in other sequences or simultaneously.Secondly, those skilled in the art also should Know, the embodiments described in the specification are all preferred embodiments, and the related movement not necessarily present invention is implemented Necessary to example.
The step of the invention also provides the test method one of which embodiments of Web a kind of, in the present embodiment, Web Test method be applied to Web test platform, control Web test platform is tested, Web test platform includes: that use-case is raw Process, test process, reporting process are updated at process, load of file process, element.Process used can be according to actual use It needs to be adjusted, it can be with the test function and test scope of appropriate adjustment test platform.
In the present embodiment, this method specifically includes the following steps:
Step 301, the use-case generates process and obtains manual testing's use-case, is generated according to manual testing's use-case automatic Change use-case, page configuration file and executes use-case configuration file;
Manual testing's use-case can write use-case by manual input, manpower, and manual testing's use-case that manpower is write can To include basic test parameter, test URL, use-case ID, use-case keyword, use-case title, testing procedure, test data etc.;
Wherein the use-case generates process and generates use-case according to the basic test parameter, use-case title, use-case keyword Configuration file is executed, it is text.xml file that the use-case of generation, which executes file,;
The use-case generates process and generates page configuration file, the page configuration of generation according to the test URL, use-case ID File is .Properties file;
The use-case generates process and generates automation use-case according to the testing procedure, test result, and use-case generates process The .jar file packet of use-case generation will be automated.The test result of input can be the expected test result of manual compiling, can also To be the last test result tested.It is to finally obtain test result generating test results as automation use-case When, the test result finally obtained can be compared with the test result of input, technical staff is facilitated to carry out after a test Analysis.
Process is generated using use-case to be combined together the test case of manual compiling, it can be by manual use-case and automation Use-case stores together, more convenient management, and can quickly generate configuration file;It, can be straight when carrying out cross-platform compatibility test Load and the corresponding test environment of selection are connect, testing efficiency is improved.Even if a new person is unfamiliar with for the people of code, Also error probability can be reduced, testing cost is reduced.
Step 302, the load of file process determines tested browser version information according to the execution use-case file, obtains It takes and updates the driving Driver file to match with the tested browser version information.
Step 302 can also include following sub-step:
Sub-step S3021, the load of file process read the title of objective browser, and the objective browser is to execute Use-case configuration file needs browser to be tested;
Sub-step S3022, the file device process obtain objective browser version according to the title of the objective browser This information;
Sub-step S3023, the file device process are searched and the objective browser from preset map information table The Driver version information of matches version information;
Sub-step S3024, the file device process are applied according to the Driver version information from preset Driver Corresponding Driver file is obtained in pond and is loaded.
The load of file process determines tested browser version information according to the execution use-case file, can to test The beta version information of platform and the version information of tested browser match, because tested browser has automatic upgrading function Can, can frequently result in tested browser version information and test platform mismatch, thus lead to the problem of it is various, to need people Work is matched manually, reduces testing efficiency.After it joined load of file process, Auto-matching can be carried out to test platform It updates, so that test platform matches with tested browser.
Step 302 can also include following sub-step:
Sub-step S3025, the load of file process determine test environment according to the execution use-case file;
Sub-step S3026, the load of file process obtain corresponding Host file according to the tested environment;
Sub-step S3027, the load of file process is according to the Host text in the corresponding Host file replacement system Part.
While the load of file process determines tested browser version information according to the execution use-case file, determine Environment is tested, in the present embodiment, test environment may include trunk environment, STG environment, and environment on line, trunk environment is to survey The primary climate of examination, STG environment are pre- publication environment, the public same database of environment on STG environment and line.
Because presetting the Host file of a not no extension name in the system of Web, Host file is responsible for will be some common The corresponding IP address of network address domain name establish an associated database, when what browser inputted a needs logs in network address When, system can find corresponding IP address from Hosts file automatically first, once finding, system can be opened corresponding immediately Network address can be submitted DNS name resolution server to carry out IP address parsing by webpage, system if it is not found, again, if it find that It is shielded IP or domain name, will forbids opening this webpage.When needing to test in different environments, need manpower frequent Replace Host file so that test can not autonomous operation, to reduce testing efficiency.Before being tested, by load of file Process is according to use-case file detection test environment is executed, so that Host file is updated, without manpower replacement, so that entire test is flat Platform can substantially increase the efficiency of test with autonomous operation.
In addition updating Host file and updating drives Driver file that can carry out simultaneously, can also carry out respectively, can be with Update sequence is adjusted according to the actual application.
Step 303, the element update process regenerates new page configuration file according to the page configuration file, And judge whether new page configuration file and former page configuration file are identical;
If they are the same, then former page configuration file is not replaced with new page configuration file;
If not identical, former page configuration file is replaced with new page configuration file.
In the present embodiment, test process used needs to be tested according to the step of automation use-case, and automates Use-case excessively relies on front end page element, if subtle change occurs for front end page label, it is possible to lead to a large amount of use-case because Positioning reports an error less than page elements.Therefore before being tested, the page configuration file weight that process generates is generated according to use-case New page configuration file and use-case are generated the page configuration file that process generates and carried out by newly-generated new page configuration file It compares, if different, old page configuration file is replaced using new page configuration file, improves the accuracy of test, drop The probability of low error.
In the present embodiment, the element update process obtains new page configuration file, institute by CSS pseudo-code and tree table Stating new page configuration file includes root element configuration file root.properties and tested element arrangements file Index.properties, generating new page configuration file may include following sub-step:
Sub-step S3031, the element update the root node that process extracts the tested page according to the page configuration file Dom tree shape structure;
Sub-step S3032, the element update process according to the dom tree shape structure composition of the root node of the tested page Root element configuration file;
Sub-step S3033, the element update process and obtain tested element arrangements text according to the root element configuration file Part information;
Sub-step S3034, the element update process and generate tested element according to the tested element arrangements the file information Configuration file.
According to two newly-generated root element configuration files and tested element arrangements file and old page configuration file into Row compares, to judge whether page configuration file sends variation, if there is transformation, replaces old page with new page configuration file Face configuration file avoids changing because of page configuration file, test process is caused to malfunction when testing.
The sub-step S3032 can also include following sub-step:
Sub-step S30321, the element update the root node that process obtains the tested page;
Sub-step S30322, the element update process and get the unique identification section under root node according to the root node Point;
Sub-step S30323, the element update process and obtain root element according to the unique identification node under the root node Configuration file.
The sub-step S30321 can also include following sub-step:
Sub-step S303211, the element update process and are obtained under root node according to the root node of the tested page Unique identification, and judge whether the root node of the tested page has unique ID to identify;
If the root node of the tested page has unique ID to identify, unique ID mark is recorded, the element updates Process is identified with ID and obtains root node;
If the root node of the tested page does not have unique ID to identify, judge the tested page root node whether There is CSS node;
If the root node of the tested page has CSS node, CSS mark is recorded, the element is updated process and marked with CSS Know and obtains root node.
If the root node of the tested page does not have CSS node, element array is oriented by CSS, then judge whether The element is uniquely navigated to by including pseudo- class;
If can position, record location information, the element updates process and obtains root node with location information;
If cannot position, positioned by its location tags, and record position label, the element updates process with position Label obtains root node.
By obtaining the marks such as unique ID mark, CSS mark, location information or position, and root node is recorded It is interior, so that root node is obtained according to above-mentioned mark, so that each root node got has one-to-one mark, energy Effectively the case where avoiding page elements that from can not identifying, no matter any variation occurs for tested browser or tested page midway, can It is recorded in new page configuration file, to improve accuracy rate of the test process in follow-up test.If not generating new Because of front end page label subtle change will occur for page configuration file, it is possible to cause largely to use when testing Example is because positioning reports an error less than page elements.
Sub-step S30322 can also include following sub-step:
Sub-step S303221, the element update process and extract the node for possessing ID mark under root node root, pass through ID The information of the node of mark, and record its parent information, using parent information as root node under unique identification, to obtain Take the unique identification node under root node.
The nodal information for possessing the node of ID mark and its parent information are recorded one by one, and in this, as root The unique identification of node, so that root node can be identified and be distinguished with other identifier.
Sub-step S3033 can also include following sub-step:
Sub-step S30331, the element update process and judge whether present node has unique ID to identify;
If the present node has unique ID to identify, the element updates process and remembers ID mark as its unique identification It records in former tested element arrangements file, and generates new tested element arrangements file, to obtain new page configuration file;
If present node does not have ID mark, the element updates process and judges whether the present node has unique CSS Mark;
If the present node has unique CSS to identify, the element updates process and remembers CSS mark as unique identification It records in former tested element arrangements file, and generates new tested element arrangements file, to obtain new page configuration file;
If the present node does not have unique CSS to identify, the element updates the content member that process obtains present node Plain, the left brotgher of node, the right brotgher of node or the grandparent node for possessing unique identification, and by the content element, the left brotgher of node, The right brotgher of node or the grandparent node for possessing unique identification are recorded in former tested element arrangements file, generate new tested element Configuration file, to obtain new page configuration file.
Since CSS mark is the language of user's rendering html or xml a kind of, CSS can be by pattern using its selector Attribute is tied to specified node element, i.e. front end developer can use each pattern on the CSS setting page, no matter one Mostly complexity is located in a element, since developer can position and be arranged pattern, then tester can also be positioned by CSS To the node element, the node element is then operated.CSS tends to quickly navigate to complicated element section by succinct grammer Point.Simultaneously for the node element that can uniquely navigate to by ID or CSS, just directly pass through ID the and CSS label of itself Positioning.If the node element that can not uniquely navigate to by CSS, need to determine by way of structure pseudo-code and content pseudo-code Position, can guarantee and uniquely navigate to the node element.
The mode of positioning can position the node element by content pseudo-code.
Step 304, the test process according to the automation use-case, page configuration file and executes use-case configuration file Test is executed, test result is generated and the test result is sent to the reporting process.
The test process includes function process, page CSS process and picture process, carries out function to the tested page respectively Energy, page CSS and three, picture tests.It can need to be adjusted test item according to application, and adjust test item Testing sequence
The function process executes Basic function testing according to the step of execution use-case file, automation use-case, institute Stating basic function may include current URL, the current source code of the page, page elements attribute and the page elements of page title, the page Value etc.;
The page CSS process executes the test of CSS label according to the step of page configuration file, automation use-case, The CSS label test can first obtain label value, to obtain the label value of CSS, the CSS parameter for then carrying out each dimension is surveyed Examination;
The picture process executes the test of picture similarity according to the step of page configuration file, automation use-case, described The test of picture similarity may include to picture being compared based on check value, the test of picture similarity and based on similarity algorithm Compared with.
The picture process executes the test of picture similarity according to the step of page configuration file, automation use-case and can wrap Include following sub-step:
Sub-step S3041, the picture process obtain the href link of currentElement configuration file, and to href connection It sends HTTP request and opens link, the picture process judges whether the return value of HTTP request is correct;
If the HTTP request return value mistake that the picture process is sent, the picture process issues use-case and reports an error instruction;
If the HTTP request return value that the picture process is sent is correct, the picture process pulls current page display diagram Piece P1 and href configuration link picture P2, judge whether the check value of P1 and P2 is identical;
If check value is identical, the picture process determines that picture is identical;
If check value is not identical, the picture process carries out the Image entropy pair of picture by picture similarity algorithm Than;
If being less than entropy, the picture process determines that picture is identical;
If more than entropy, the picture process determines that picture is not identical, and picture process issues use-case and reports an error instruction.
In the present embodiment, the check value of picture P1 and P2 is md5 value.
It is tested using test process, testing efficiency can be improved, and by three tests, test can be greatly increased Accuracy rate.
And test process is equipped with mechanism of running again, and the heavy race mechanism is that failure is run again three times;
If test for the first time and second of test run failure, test process judge whether it is page elements and report an error;
If not page elements report an error, then test process continues to run again, continues to test;
If page elements report an error, then unique ID mark is judged whether it is;
If unique ID mark, then run the use-case, continue to test again;
If not Unique ID, then find the grandparent node or root node css node of its Unique ID, by interior Containing pseudo-code, it is found in the position of grandparent node, then by label jackknife method, updates its location information, finds its grandparent node It is positioned with the brotgher of node.
Step 305, the reporting process obtains the test result of the test process, and is generated according to the test result Test report.
Test report may include that operation element is highlighted, mistake screenshot, Error Elements mark and error log are analyzed Etc..Final report (FR) process sends test report in the mobile device of each tester, can pass through email or short message Form is sent.
In an embodiment of the present invention, process is generated by use-case and receives test request, artificial use is then write by manpower Example, then use-case generates process and generates corresponding configuration file and testing procedure according to artificial use-case, then load of file process According to configuration file and testing procedure tested browser is matched with test platform, tests environment and test platform phase Match, and send configuration file and testing procedure and update process to element, then element updates process using configuration file and test Step is in time updated page elements, generates new page elements, then by test process according to the new page elements, The configuration file and the testing procedure generate implementing result, finally send reporting process for implementing result.
In an embodiment of the present invention, above step is executed using each process, the working efficiency of test platform can be improved, It is each to be executed different work, more convenient management between each other.Correspondingly, adjustable test platform it is each into Journey works so as to adjust between each process.
The present invention solves mapping relations of the manual test to automatic test, and the management of more conducively systematization, which is tested, to be used Example, reduces testing cost;Effective solution because browser version upgrades, hold by test case caused by Driver is mismatched Row failure problem;Effective solution front end page changes, so that page elements obtain the element less than caused by and report an error;Have Solving automation use-case and can only carrying out the defect problem of functional test for effect, realizes head end test;It can effective position mistake Element can illustrate the place of mistake ultimately producing error reporting clearly, and can be in wrong screenshot and Error Elements Watermarking after a test can analyze mistake, tester is facilitated preferably to be managed.
It should be noted that for simple description, therefore, it is stated as a series of action groups for embodiment of the method It closes, but those skilled in the art should understand that, embodiment of that present invention are not limited by the describe sequence of actions, because according to According to the embodiment of the present invention, some steps may be performed in other sequences or simultaneously.Secondly, those skilled in the art also should Know, the embodiments described in the specification are all preferred embodiments, and the related movement not necessarily present invention is implemented Necessary to example
The invention also provides a kind of Web test platform, the Web test platform includes use-case generation module, file dress Carry module, test module;
The use-case generation module is generated according to manual testing's use-case and is automated for obtaining manual testing's use-case Use-case, page configuration file and execution use-case configuration file;
The load of file module is used to determine tested browser version information according to the execution use-case file, obtain simultaneously Update the driving Driver file to match with the tested browser version information;
The test module is used for according to the automation use-case, page configuration file and executes the execution of use-case configuration file Test.
In this embodiment, the use-case generation module is for obtaining manual testing's use-case, and manual testing's use-case can be with By people's hand-coding, manual testing's use-case includes basic test parameter, test URL, use-case ID, use-case keyword, uses Example title, testing procedure, test data;
The use-case generation module is used to generate use-case according to the basic test parameter, use-case title, use-case keyword Execute configuration file;
The use-case generation module is used to generate page configuration file according to the test URL, use-case ID;
The use-case generation module is used to generate automation use-case according to the testing procedure, test result.
In this embodiment, described to obtain and update the driving Driver text to match with the tested browser version information Part may include:
The load of file module is used to read the title of objective browser, and the objective browser is to execute use-case configuration File needs browser to be tested;
The file device module is used for the title according to the objective browser, obtains objective browser version information;
The file device module is used for from preset map information table, is searched and the objective browser version information Matched Driver version information;
The file device module is used to apply in pond and obtain from preset Driver according to the Driver version information Corresponding Driver file simultaneously loads.
In this embodiment, described to obtain and load the driving Driver text to match with the tested browser version information Part can also include:
The file device module is used to determine tested environment according to the execution test profile;
The load of file module is used to obtain corresponding Host file according to the tested environment;
The load of file module is used for according to the Host file in the corresponding Host file replacement system.
In this embodiment, the test module includes functional module, page CSS module and picture module, the test mould Block is used to execute test according to the automation use-case, page configuration file and execution use-case configuration file;
The functional module is used to execute basic function according to the step of execution use-case file, automation use-case and survey Examination;
The page CSS module is used to execute CSS label according to the step of page configuration file, automation use-case and survey Examination;
The picture module is used to execute the test of picture similarity according to the step of page configuration file, automation use-case.
In this embodiment, the picture module is used to execute picture according to the step of page configuration file, automation use-case Similarity test, further includes:
The picture module is used to obtain the href link of currentElement configuration file, and sends HTTP request and open chain It connects, judges whether the return value of HTTP request is correct;
If the HTTP request return value mistake that the picture module is sent, picture module issues use-case and reports an error instruction;
If the HTTP request return value that the picture module is sent is correct, the picture module pulls current page display diagram Piece P1 and href configuration link picture P2, judge whether the check value of P1 and P2 is identical;
If check value is identical, the picture module determines that picture is identical;
If check value is not identical, the picture module carries out the Image entropy pair of picture by picture similarity algorithm Than;
If being less than entropy, the picture module determines that picture is identical;
If more than entropy, the picture module determines that picture is not identical, and picture module issues use-case and reports an error instruction.
In this embodiment, the test platform further includes element update module;
The element update module is sentenced for regenerating new page configuration file according to the page configuration file Whether the page configuration file for breaking new and former page configuration file are identical;
If they are the same, then former page configuration file is not replaced with new page configuration file;
If not identical, former page configuration file is replaced with new page configuration file.
In this embodiment, the page configuration file includes root element configuration file and tested element arrangements file, described Element update module obtains new page configuration file by CSS pseudo-code and tree table, comprising:
The element update module is used to extract the dom tree shape of the root node of the tested page according to the page configuration file Structure;
The element update module is used to be matched according to the dom tree shape structure composition root element of the root node of the tested page Set file;
The element update module is used to obtain tested element arrangements the file information according to the root element configuration file;
The element update module is used to generate tested element arrangements file according to the tested element arrangements the file information.
In this embodiment, the element update module is used for the dom tree shape structure composition according to the root node for being tested the page Root element configuration file, comprising:
The element update module is used to obtain the root node of the tested page;
The element update module is used to get the unique identification node under root node according to the root node;
The element update module is used to obtain root element configuration file according to the unique identification node under the root node.
In this embodiment, the element update module is used to obtain the root node of the tested page, further includes:
The element update module judges whether the root node of the tested page has unique ID to identify;
If the root node of the tested page has unique ID to identify, unique ID mark is recorded, the element updates Module is identified with ID and obtains root node;
If the root node of the tested page does not have unique ID node, judge the tested page root node whether There is CSS node;
If the root node of the tested page has CSS node, CSS mark is recorded, the element update module is marked with CSS Know and obtains root node.
If the root node of the tested page does not have CSS node, element array is oriented by CSS, then judge whether The element is uniquely navigated to by including pseudo- class;
If can position, record location information, the element update module obtains root node with location information;
If cannot position, positioned by its location tags, and record position label, the element update module is with position Label obtains root node.
In this embodiment, the element update module is used to get the unique identification under root node according to the root node Node, further includes:
The element update module is used to extract the node for possessing ID mark under root node root, identifies the section by ID The information of point, and records its parent information, using parent information as root node under unique identification, to obtain root node Under unique identification node.
In this embodiment, the element update module is used to generate tested member according to the tested element arrangements the file information Plain configuration file includes:
The element update module judges whether present node has unique ID to identify;
If the present node has unique ID to identify, the element update module remembers ID mark as its unique identification It records in former tested element arrangements file, and generates new tested element arrangements file, to obtain new page configuration file;
If present node does not have ID mark, the element update module judges whether the present node has unique CSS Mark;
If the present node has unique CSS to identify, the element update module remembers CSS mark as unique identification It records in former tested element arrangements file, and generates new tested element arrangements file, to obtain new page configuration file;
If the present node does not have unique CSS to identify, the element update module obtains the content member of present node Plain, the left brotgher of node, the right brotgher of node or the grandparent node for possessing unique identification, and by the content element, the left brotgher of node, The right brotgher of node or the grandparent node for possessing unique identification are recorded in former tested element arrangements file, generate new tested element Configuration file, to obtain new page configuration file.
In this embodiment, the test platform further includes reporting modules, and the reporting modules are for obtaining test module Test result, and test report is generated according to the implementing result of the test module.
For device embodiment, since it is basically similar to the method embodiment, related so being described relatively simple Place illustrates referring to the part of embodiment of the method.
The embodiment of the invention also provides a kind of devices, comprising:
One or more processors;With
One or more machine readable medias of instruction are stored thereon with, are executed when by one or more of processors When, so that described device executes method described in the embodiment of the present invention.
The embodiment of the invention also provides one or more machine readable medias, are stored thereon with instruction, when by one or When multiple processors execute, so that the processor executes method described in the embodiment of the present invention.
All the embodiments in this specification are described in a progressive manner, the highlights of each of the examples are with The difference of other embodiments, the same or similar parts between the embodiments can be referred to each other.
It should be understood by those skilled in the art that, the embodiment of the embodiment of the present invention can provide as method, apparatus or calculate Machine program product.Therefore, the embodiment of the present invention can be used complete hardware embodiment, complete software embodiment or combine software and The form of the embodiment of hardware aspect.Moreover, the embodiment of the present invention can be used one or more wherein include computer can With in the computer-usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) of program code The form of the computer program product of implementation.
The embodiment of the present invention be referring to according to the method for the embodiment of the present invention, terminal device (system) and computer program The flowchart and/or the block diagram of product describes.It should be understood that flowchart and/or the block diagram can be realized by computer program instructions In each flow and/or block and flowchart and/or the block diagram in process and/or box combination.It can provide these Computer program instructions are set to general purpose computer, special purpose computer, Embedded Processor or other programmable data processing terminals Standby processor is to generate a machine, so that being held by the processor of computer or other programmable data processing terminal devices Capable instruction generates for realizing in one or more flows of the flowchart and/or one or more blocks of the block diagram The device of specified function.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing terminal devices In computer-readable memory operate in a specific manner, so that instruction stored in the computer readable memory generates packet The manufacture of command device is included, which realizes in one side of one or more flows of the flowchart and/or block diagram The function of being specified in frame or multiple boxes.
These computer program instructions can also be loaded into computer or other programmable data processing terminal devices, so that Series of operation steps are executed on computer or other programmable terminal equipments to generate computer implemented processing, thus The instruction executed on computer or other programmable terminal equipments is provided for realizing in one or more flows of the flowchart And/or in one or more blocks of the block diagram specify function the step of.
Although the preferred embodiment of the embodiment of the present invention has been described, once a person skilled in the art knows bases This creative concept, then additional changes and modifications can be made to these embodiments.So the following claims are intended to be interpreted as Including preferred embodiment and fall into all change and modification of range of embodiment of the invention.
Finally, it is to be noted that, herein, relational terms such as first and second and the like be used merely to by One entity or operation are distinguished with another entity or operation, without necessarily requiring or implying these entities or operation Between there are any actual relationship or orders.Moreover, the terms "include", "comprise" or its any other variant meaning Covering non-exclusive inclusion, so that process, method, article or terminal device including a series of elements not only wrap Those elements are included, but also including other elements that are not explicitly listed, or further includes for this process, method, article Or the element that terminal device is intrinsic.In the absence of more restrictions, being wanted by what sentence "including a ..." limited Element, it is not excluded that there is also other identical elements in process, method, article or the terminal device for including the element.
Above to a kind of test method and test platform of Web provided by the present invention, it is described in detail, herein Apply that a specific example illustrates the principle and implementation of the invention, the explanation of above example is only intended to help Understand method and its core concept of the invention;At the same time, for those skilled in the art, according to the thought of the present invention, There will be changes in the specific implementation manner and application range, in conclusion the content of the present specification should not be construed as to this The limitation of invention.

Claims (16)

1. a kind of test method of Web, which is characterized in that this method comprises:
Manual testing's use-case is obtained, automation use-case, page configuration file is generated according to manual testing's use-case and executes use Example configuration file;
Tested browser version information is determined according to the execution use-case file, obtains and is updated and the tested browser version The driving Driver file that information matches;
Test is executed according to the automation use-case, page configuration file and execution use-case configuration file.
2. the method according to claim 1, wherein manual testing's use-case includes basic test parameter, surveys Try URL, use-case ID, use-case keyword, use-case title, testing procedure, test data;
Use-case, which is generated, according to the basic test parameter, use-case title, use-case keyword executes configuration file;
Page configuration file is generated according to the test URL, use-case ID;
Automation use-case is generated according to the testing procedure, test result.
3. the method according to claim 1, wherein it is described acquisition and update and the tested browser version believe The matched driving Driver file of manner of breathing includes:
The title of objective browser is read, the objective browser is to execute use-case configuration file to need browser to be tested;
According to the title of the objective browser, objective browser version information is obtained;
From preset map information table, the Driver version information with the objective browser matches version information is searched;
According to the Driver version information, is applied from preset Driver and obtain corresponding Driver file in pond and load.
4. the method according to claim 1, wherein it is described acquisition and load and the tested browser version believe The matched driving Driver file of manner of breathing, further includes:
According to the execution test profile, tested environment is determined;
According to the tested environment, corresponding Host file is obtained;
According to the Host file in the corresponding Host file replacement system.
5. the method according to claim 1, wherein according to the automation use-case, page configuration file and holding Row use-case configuration file executes test;
Basic function testing is executed according to the step of execution use-case file, automation use-case;
The test of CSS label is executed according to the step of page configuration file, automation use-case;
The test of picture similarity is executed according to the step of page configuration file, automation use-case.
6. according to the method described in claim 5, it is characterized in that, being held according to the step of page configuration file, automation use-case The test of row picture similarity, further includes:
The href link of currentElement configuration file is obtained, and sends HTTP request to href connection and opens link, judgement Whether the return value of HTTP request is correct;
If the HTTP request return value mistake sent, issues use-case and report an error instruction;
If the HTTP request return value sent is correct, current page exhibiting pictures P1 and href configuration link picture P2 are pulled, is sentenced Whether the check value of disconnected P1 and P2 is identical;
If check value is identical, determine that picture is identical;
If check value is not identical, compared by the Image entropy that picture similarity algorithm carries out picture;
If being less than entropy, determine that picture is identical;
It if more than entropy, determines that picture is not identical, issues use-case and report an error instruction.
7. the method according to claim 1, wherein further include:
New page configuration file is regenerated according to the page configuration file, and judges new page configuration file and former page Whether face configuration file is identical;
If they are the same, former page configuration file is not replaced with new page configuration file;
If not identical, former page configuration file is replaced with new page configuration file.
8. the method according to the description of claim 7 is characterized in that obtaining new page configuration text by CSS pseudo-code and tree table Part, the page configuration file include root element configuration file and tested element arrangements file, obtain new page configuration file Include:
The dom tree shape structure of the root node of the tested page is extracted according to the page configuration file;
According to the dom tree shape structure composition root element configuration file of the root node of the tested page;
Tested element arrangements the file information is obtained according to the root element configuration file;
Tested element arrangements file is generated according to the tested element arrangements the file information.
9. according to the method described in claim 8, it is characterized in that, according to the dom tree shape structure group of the root node of the tested page At root element configuration file, comprising:
Obtain the root node of the tested page;
The unique identification node under root node is got according to the root node;
Root element configuration file is obtained according to the unique identification node under the root node.
10. according to the method described in claim 9, it is characterized in that, obtaining the root node of the tested page, further includes:
Obtain the unique identification under root node according to the root node of the tested page, and judge the tested page root node whether There is unique ID to identify;
If the root node of the tested page has unique ID to identify, unique ID mark is recorded, and obtain with ID mark Take root node;
If the root node of the tested page does not have unique ID node, judge whether the root node of the tested page has CSS node;
If the root node of the tested page has CSS node, CSS mark is recorded, and identify with the CSS and obtain root node.
If the root node of the tested page does not have CSS node, element array is oriented by CSS, then judge whether to pass through Pseudo- class is included uniquely to navigate to the element;
If can position, record location information, and root node is obtained with location information;
If cannot position, positioned by its location tags, and record position label, obtains root node with location tags.
11. according to the method described in claim 9, it is characterized in that, being got according to the root node unique under root node Identify node, further includes:
The node for possessing ID mark under root node root is extracted, the information of the node is identified by ID, and record its father node Information, using parent information as root node under unique identification, thus the unique identification node under obtaining root node.
12. according to the method described in claim 8, it is characterized in that, generating quilt according to the tested element arrangements the file information Surveying element arrangements file includes:
Judge whether present node has unique ID to identify;
If the present node has unique ID to identify, former tested element arrangements text is recorded as its unique identification in ID mark In part, and new tested element arrangements file is generated, to obtain new page configuration file;
If present node does not have ID mark, judge whether the present node has unique CSS to identify;
If the present node has unique CSS to identify, former tested element arrangements text is recorded as unique identification in CSS mark In part, and new tested element arrangements file is generated, to obtain new page configuration file;
If the present node does not have unique CSS to identify, content element, the left brotgher of node, right brother of present node are obtained Node or the grandparent node for possessing unique identification, and by the content element, the left brotgher of node, the right brotgher of node or possess unique The grandparent node of mark is recorded in former tested element arrangements file, generates new tested element arrangements file, to obtain new Page configuration file.
13. the method according to claim 1, wherein further including obtaining test result, and tie according to the test Fruit generates test report.
14. a kind of Web test platform, the Web test platform includes use-case generation module, load of file module, test module;
The use-case generation module generates automation according to manual testing's use-case and uses for obtaining manual testing's use-case Example, page configuration file and execution use-case configuration file;
The load of file module is used to determine tested browser version information according to the execution use-case file, obtains and update The driving Driver file to match with the tested browser version information;
The test module is used to execute survey according to the automation use-case, page configuration file and execution use-case configuration file Examination.
15. a kind of device characterized by comprising
One or more processors;With
One or more machine readable medias of instruction are stored thereon with, when being executed by one or more of processors, are made Obtain method of the described device execution as described in claim 1-13 any one.
16. one or more machine readable medias, are stored thereon with instruction, when executed by one or more processors, so that The processor executes the method as described in claim 1-13 any one.
CN201910161259.7A 2019-03-04 2019-03-04 Web test method and test platform Active CN109902016B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910161259.7A CN109902016B (en) 2019-03-04 2019-03-04 Web test method and test platform

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910161259.7A CN109902016B (en) 2019-03-04 2019-03-04 Web test method and test platform

Publications (2)

Publication Number Publication Date
CN109902016A true CN109902016A (en) 2019-06-18
CN109902016B CN109902016B (en) 2022-06-14

Family

ID=66946352

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910161259.7A Active CN109902016B (en) 2019-03-04 2019-03-04 Web test method and test platform

Country Status (1)

Country Link
CN (1) CN109902016B (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110737599A (en) * 2019-10-18 2020-01-31 付彪 Front-end automatic regression testing system and method based on picture comparison technology
CN111177014A (en) * 2020-02-24 2020-05-19 重庆长安新能源汽车科技有限公司 Software automatic test method, system and storage medium
CN111414154A (en) * 2020-03-31 2020-07-14 中国建设银行股份有限公司 Method and device for front-end development, electronic equipment and storage medium
CN112100359A (en) * 2020-10-14 2020-12-18 北京嘀嘀无限科技发展有限公司 Test case searching method, device, equipment and storage medium
CN112231213A (en) * 2020-10-16 2021-01-15 广州助蜂网络科技有限公司 Web automatic testing method, system, storage medium and terminal equipment
CN112685300A (en) * 2020-12-28 2021-04-20 京东数字科技控股股份有限公司 Webpage automatic testing method and device, electronic equipment and readable storage medium
CN112711525A (en) * 2019-10-25 2021-04-27 中国移动通信集团浙江有限公司 UI test and interface test cooperative test method and device and computing equipment
CN113176914A (en) * 2021-06-03 2021-07-27 上海中通吉网络技术有限公司 Modularized testing tool based on automatic Web end

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020097268A1 (en) * 2001-01-22 2002-07-25 Dunn Joel C. Method, system, and program for a platform-independent, browser-based, client-side, test automation facility for verifying web site operation
CN102779091A (en) * 2012-06-18 2012-11-14 中兴通讯股份有限公司 Test transformation method and test transformation device
CN104252410A (en) * 2013-06-27 2014-12-31 阿里巴巴集团控股有限公司 Method and equipment for testing control in page
CN108694118A (en) * 2017-04-11 2018-10-23 北京京东尚科信息技术有限公司 A kind of application testing method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020097268A1 (en) * 2001-01-22 2002-07-25 Dunn Joel C. Method, system, and program for a platform-independent, browser-based, client-side, test automation facility for verifying web site operation
CN102779091A (en) * 2012-06-18 2012-11-14 中兴通讯股份有限公司 Test transformation method and test transformation device
CN104252410A (en) * 2013-06-27 2014-12-31 阿里巴巴集团控股有限公司 Method and equipment for testing control in page
CN108694118A (en) * 2017-04-11 2018-10-23 北京京东尚科信息技术有限公司 A kind of application testing method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
邓志勇: "关于Selenium WebDriver自动化测试框架设计与实现", 《数字化用户》 *

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110737599A (en) * 2019-10-18 2020-01-31 付彪 Front-end automatic regression testing system and method based on picture comparison technology
CN112711525A (en) * 2019-10-25 2021-04-27 中国移动通信集团浙江有限公司 UI test and interface test cooperative test method and device and computing equipment
CN112711525B (en) * 2019-10-25 2023-12-26 中国移动通信集团浙江有限公司 Collaborative testing method and device for UI test and interface test and computing equipment
CN111177014A (en) * 2020-02-24 2020-05-19 重庆长安新能源汽车科技有限公司 Software automatic test method, system and storage medium
CN111177014B (en) * 2020-02-24 2023-02-24 重庆长安新能源汽车科技有限公司 Software automatic test method, system and storage medium
CN111414154A (en) * 2020-03-31 2020-07-14 中国建设银行股份有限公司 Method and device for front-end development, electronic equipment and storage medium
CN112100359A (en) * 2020-10-14 2020-12-18 北京嘀嘀无限科技发展有限公司 Test case searching method, device, equipment and storage medium
CN112231213A (en) * 2020-10-16 2021-01-15 广州助蜂网络科技有限公司 Web automatic testing method, system, storage medium and terminal equipment
CN112685300A (en) * 2020-12-28 2021-04-20 京东数字科技控股股份有限公司 Webpage automatic testing method and device, electronic equipment and readable storage medium
CN113176914A (en) * 2021-06-03 2021-07-27 上海中通吉网络技术有限公司 Modularized testing tool based on automatic Web end

Also Published As

Publication number Publication date
CN109902016B (en) 2022-06-14

Similar Documents

Publication Publication Date Title
CN109902016A (en) A kind of test method and test platform of Web
US9836710B2 (en) Resource planning for data protection validation
CN105138448B (en) A kind of method and apparatus in the head end test page
US9419884B1 (en) Intelligent automated testing method for restful web services
US8984485B2 (en) Analysis of source code changes
US10621212B2 (en) Language tag management on international data storage
CN110134613B (en) Software defect data acquisition system based on code semantics and background information
CN108345532A (en) A kind of automatic test cases generation method and device
EP3750049A1 (en) Variable analysis using code context
Waltersdorfer et al. Version management and conflict detection across heterogeneous engineering data models
CN109684847A (en) Self-repairing method, device, equipment and the storage medium of script loophole
CN109710528A (en) A kind of test script generation method, device, equipment and medium
CN107729031A (en) Code administration method, apparatus, computer equipment and computer-readable recording medium
CN115712623B (en) Batch data fault-tolerant collection method based on captured metadata change
CN107015903A (en) A kind of generation method, device and the electronic equipment of interface detection program
CN115113927A (en) Register model processing method and device, computer equipment and storage medium
CN112241370B (en) API interface class checking method, system and device
Kauhanen et al. Regression test selection tool for python in continuous integration process
CN105912573A (en) Data updating method and data updating device
CN115357269A (en) Configuration information updating method and device, computer equipment and storage medium
CN109508203A (en) Version consistency determines method, apparatus and system
Karami et al. Maintaining accurate web usage models using updates from activity diagrams
Rath et al. SpojitR: Intelligently link development artifacts
CN112381509A (en) Management system for major special topic of national science and technology for creating major new drug
Wang et al. Using workflow patterns to model and validate service requirements

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