CN107704391A - Selenium-based testing method and device - Google Patents

Selenium-based testing method and device Download PDF

Info

Publication number
CN107704391A
CN107704391A CN201710912383.3A CN201710912383A CN107704391A CN 107704391 A CN107704391 A CN 107704391A CN 201710912383 A CN201710912383 A CN 201710912383A CN 107704391 A CN107704391 A CN 107704391A
Authority
CN
China
Prior art keywords
test
test case
management module
script
tester
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201710912383.3A
Other languages
Chinese (zh)
Inventor
王珂
高砚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mashang Consumer Finance Co Ltd
Original Assignee
Mashang Consumer Finance 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 Mashang Consumer Finance Co Ltd filed Critical Mashang Consumer Finance Co Ltd
Priority to CN201710912383.3A priority Critical patent/CN107704391A/en
Publication of CN107704391A publication Critical patent/CN107704391A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a Selenium-based test method, which comprises the following steps: receiving a test command sent by a tester; opening a test case management module so that a tester can select the test case in the test case management module and modify the test data of the test case; and calling the test script corresponding to the test case so that the test script executes the test according to the test data. Therefore, the Selenium-based test method disclosed by the invention completely breaks away from an Eclipse tool, when a tester modifies test data, the tester does not need to modify the test script but modifies the test data of the test case management module, and the test script automatically reads the modified test data for testing, so that the test efficiency and the automation degree are greatly improved. The invention also discloses a Selenium-based testing device which can also realize the technical effects.

Description

A kind of method of testing and device based on Selenium
Technical field
The present invention relates to computer testing field, more specifically to a kind of method of testing based on Selenium and Device.
Background technology
With the high speed development of Software Industry, web application has been obtained for being widely applied, and its operation flow becomes It is more complicated.Tester generally requires to write a large amount of test cases and puts into enough personnel in the process of test, to Web Application program carries out test repeatedly to ensure its quality.Solve these well for the utilization of such case automatic test Problem.
Selenium is the Open-Source Tools for being used for web application test, can be run directly in browser, just as Real user is the same in operation, and the browser of support is including IE, Chrome, Mozilla and Firefox etc..But the instrument The basic API of operation pages control is only provided, the mode of test case, test result report, test execution is not carried out Encapsulation, causes tester's needs substantial amounts of time to write the script of test scene, this is safeguarded for the personnel that will not be encoded Cost is too high.
The Web automatic tests based on Selenium of prior art, are carried out in Eclipse instruments.Tester Member need test data is changed in test script, selected section or whole test scripts perform test, after the completion of test The result of test is checked in Eclipse instruments, according to failure sectional drawing, failure miscue information, positions failure cause.
In summary, the method for testing of prior art, when tester A completes after writing of test script, in addition When one tester B uses the test script, tester B needs to install Eclipse instruments, enters in Eclipse instruments Row operation.Change test data and selected section or when whole test scripts perform test, tester B needs to read, Understand the script that tester A writes, tested after changing test script.After the completion of test, tester needs It is in Eclipse that test result, failure cause is corresponding with test script, looked for further according to test script in test case Excel To corresponding test case.Since so, it can cause that the automaticity of method of testing is low, operating efficiency is low.
Therefore, how to improve the automaticity of method of testing and operating efficiency based on Selenium is people in the art Member needs to solve the problems, such as.
The content of the invention
It is an object of the invention to provide a kind of method of testing and device based on Selenium, method of testing is improved Automaticity and operating efficiency.
To achieve the above object, the embodiments of the invention provide a kind of method of testing based on Selenium, including:
Receive the test command that tester sends;
Test case management module is opened, so that tester selects this test in the test case management module Use-case, and change the test data of this test case;
This test script corresponding to this described test case is called, so that this described test script is according to the survey Examination data perform this test.
Wherein, after calling this test script corresponding to this described test case, in addition to:
This test result table is generated in the test case management module, and the test data recorded described In test result table.
Wherein, in addition to;
In this described measuring executing process, the implementation procedure of this test be recorded into this described test and tied In fruit table.
Wherein, in addition to;
After the completion of this described test execution, the test case management module is opened so that the tester checks This described test result table.
Wherein, in addition to;
Receive the modification order of the page control of target detection script;
The positioning side of the page control is changed in the xml document of the target detection script according to the modification order Formula and value.
To achieve the above object, the embodiments of the invention provide a kind of test device based on Selenium, including:
First receiving module, for receiving the test command of tester's transmission;
Selecting module, for opening test case management module, so that tester is in the test case management module Middle this test case of selection, and change the test data of this test case;
Test module, for calling this test script corresponding to this described test case, so as to this described test Script performs this test according to the test data.
Wherein, in addition to:
First logging modle, for generating this test result table in the test case management module, and by described in Test data recorded in the test result table.
Wherein, in addition to:
Second logging modle, in this described measuring executing process, the implementation procedure of this test to be remembered Record in this described test result table.
Wherein, in addition to:
Display module, for after the completion of this described test execution, opening the test case management module with toilet State tester and check this described test result table.
Wherein, in addition to:
Second receiving module, the modification order of the page control for receiving target detection script;
Modified module, for changing the page in the xml document of the target detection script according to the modification order The positioning method and value of face control.
By above scheme, a kind of method of testing based on Selenium provided in an embodiment of the present invention includes:Connect The test command that Acceptance Tests personnel send;Test case management module is opened, so that tester is in the test case management This test case is selected in module, and changes the test data of this test case;Call this described test case This corresponding test script, so that this described test script performs this test according to the test data.
Method of testing provided in an embodiment of the present invention based on Selenium, has completely disengaged Eclipse instruments, tester Member is when changing test data, it is not necessary to and test script is changed, but changes the test data of test case management module, test Script reads amended test data and tested automatically, greatly improves the efficiency of test.As can be seen here, the present invention is implemented The method of testing that example provides, improve the automaticity and operating efficiency of method of testing.The invention also discloses one kind to be based on Selenium test device, it can equally realize above-mentioned technique effect.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing There is the required accompanying drawing used in technology description to be briefly described, it should be apparent that, drawings in the following description are only this Some embodiments of invention, for those of ordinary skill in the art, on the premise of not paying creative work, can be with Other accompanying drawings are obtained according to these accompanying drawings.
Fig. 1 is a kind of flow chart of the method for testing based on Selenium disclosed in the embodiment of the present invention;
Fig. 2 is the flow chart of method of testing of the another kind based on Selenium disclosed in the embodiment of the present invention;
Fig. 3 is the flow chart of another method of testing based on Selenium disclosed in the embodiment of the present invention;
Fig. 4 is a kind of structure chart of the test device based on Selenium disclosed in the embodiment of the present invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, rather than whole embodiments.It is based on Embodiment in the present invention, those of ordinary skill in the art are obtained every other under the premise of creative work is not made Embodiment, belong to the scope of protection of the invention.
The embodiment of the invention discloses a kind of method of testing based on Selenium, the automation journey of method of testing is improved Degree and operating efficiency.
Referring to Fig. 1, a kind of flow chart of the method for testing based on Selenium disclosed in the embodiment of the present invention.Such as Fig. 1 institutes Show, including:
S101:Receive the test command that tester sends;
In specific implementation, batch program envelope is turned into a bat file by errorlevel instrument, and this document is actually The combination of order, such as Excel order, the order for calling test script etc. are opened, by these orders, complete whole test Flow.A button for triggering testing process can be designed for tester or after tester inputs pre-set commands, automatically Test case management module is opened, triggers testing process.
S102:Test case management module is opened, so that tester selects this in the test case management module Secondary test case, and change the test data of this test case;
In specific implementation, test case management module can be an Excel table or a database, use In storage test case and this test result table, it is not especially limited herein.Test case management module includes a plurality of test Use-case, test case script is associated by " method name in script ", be by " whether performing " control wall scroll test case No execution.
After system receives the test command of tester, test case management module is automatically opened up, tester can To select this test case in test case management module, i.e., " whether performing switch " attribute of a certain test case is set Being set to is, and changes the test data that the test case needs when this is performed.
S103:Call this test script corresponding to this described test case, so as to this described test script according to The test data performs this test.
In specific implementation, tester changes the test data of this test case in test case management module Afterwards, test case management module is Saved and Closed.System offer POI can operate test case management module and remove and secondary ought not hold Capable test case, calls this test script corresponding to this described test case, and Dom4J operations xml script reads and needed The page control resource wanted, this test is performed automatically according to test data.
Method of testing provided in an embodiment of the present invention based on Selenium, has completely disengaged Eclipse instruments, tester Member is when changing test data, it is not necessary to and test script is changed, but changes the test data of test case management module, test Script reads amended test data and tested automatically, greatly improves the efficiency of test.As can be seen here, the present invention is implemented The method of testing that example provides, improve the automaticity and operating efficiency of method of testing.
The embodiment of the invention discloses a kind of method of testing based on Selenium, relative to a upper embodiment, this implementation Example has made further instruction and optimization to technical scheme.Specifically:
Referring to Fig. 2, the flow chart of method of testing of the another kind based on Selenium provided in an embodiment of the present invention.Such as Fig. 2 It is shown, including:
S201:Receive the test command that tester sends;
S202:Test case management module is opened, so that tester selects this in the test case management module Secondary test case, and change the test data of this test case;
S231:Call this test script corresponding to this described test case;
S232:This test result table is generated in the test case management module, and the test data is recorded Into the test result table;
Before this test is performed, this test result table, table 1 are automatically generated in test case management module For a kind of schematic diagram of this test result table, as shown in table 1, this test result table can contain testing process, script In method name, test data, parameter declaration, whether perform switch, test result, test sectional drawing, failure cause etc..It will survey The test data of examination personnel modification is automatically logged into this described test result table.
Table 1
S233:This described test script performs this test according to the test data;
S234:In this described measuring executing process, by it is described this test implementation procedure recorded it is described this In test result table;
In this measuring executing process, the process of Log4J log recording test case operational controls can in test process Test result, test sectional drawing, failure cause etc. are recorded to operate test case management module by POI.
S204:After the completion of this described test execution, the test case management module is opened so as to the tester Member checks this described test result table.
In specific implementation, after the completion of test, the test case management module is automatically opened up, shows this test knot Fruit table, test result can be allowed more directly perceived, assignment test failure cause is faster.
Certainly, in the above-described embodiments, a Web application or the application of PC ends can also be developed to read the test in data Use-case information, it is managed by Web page or PC ends bound pair test case, in Web page or PC ends interface button, point Hit to trigger and perform order progress automatic test, test result, failure sectional drawing, failure cause be recorded into data in test process In storehouse, it is shown eventually through Web page or PC ends interface.
The embodiment of the invention discloses a kind of method of testing based on Selenium, when page resource changes, only Need to modify to the xml document in test script.Specifically:
Referring to Fig. 3, the flow chart of another method of testing based on Selenium provided in an embodiment of the present invention, such as Fig. 3 It is shown, including:
S311:Receive the modification order of the page control of target detection script;
S312:The page control is changed in the xml document of the target detection script according to the modification order Positioning method and value.
In specific implementation, Selenium scripts use the principle that page control resource separates with script, page control money Source is stored in xml document.Due to multiple applications, such as foreground and front end interaction can be related in test process, so xml File is divided into three layers.The first floor is Web application layers, including application name, application version information, and the second layer is page layer, including the page Name, Chinese description, third layer be control layer, including the Chinese of the value that positions of control name, control positioning method, control and control Description.When using a certain specific control, the control is accessed by way of " application name Page Name controls title ". It is, for example, possible to use BaiDu.Main.SearchInput accesses Baidu's homepage faceted search input frame.
When receiving the modification order of page control resource generation, it is only necessary in the xml texts of the target detection script The mode and value of control positioning are changed in part, it is not necessary to change test script.
S302:Receive the test command that tester sends;
S303:Test case management module is opened, so that tester selects this in the test case management module Secondary test case, and change the test data of this test case;
S304:Call this test script corresponding to this described test case, so as to this described test script according to The test data performs this test.
A kind of test device based on Selenium provided in an embodiment of the present invention is introduced below, it is described below It is a kind of can be with cross-referenced based on Selenium test device and a kind of above-described method of testing based on Selenium.
Referring to Fig. 4, a kind of structure chart of the test device based on Selenium provided in an embodiment of the present invention, such as Fig. 4 institutes Show, including:
First receiving module 401, for receiving the test command of tester's transmission;
Selecting module 402, for opening test case management module, so that tester is in the test case management mould This test case is selected in block, and changes the test data of this test case;
Test module 403, for calling this test script corresponding to this described test case, so as to this described survey Training this this test performed according to the test data.
Method of testing provided in an embodiment of the present invention based on Selenium, has completely disengaged Eclipse instruments, tester Member is when changing test data, it is not necessary to and test script is changed, but changes the test data of test case management module, test Script reads amended test data and tested automatically, greatly improves the efficiency of test.As can be seen here, the present invention is implemented The method of testing that example provides, improve the automaticity and operating efficiency of method of testing.
On the basis of above-described embodiment, preferably, in addition to:
First logging modle, for generating this test result table in the test case management module, and by described in Test data recorded in the test result table.
On the basis of above-described embodiment, preferably, in addition to:
Second logging modle, in this described measuring executing process, the implementation procedure of this test to be remembered Record in this described test result table.
On the basis of above-described embodiment, preferably, in addition to:
Display module, for after the completion of this described test execution, opening the test case management module with toilet State tester and check this described test result table.
On the basis of above-described embodiment, preferably, in addition to:
Second receiving module, the modification order of the page control for receiving target detection script;
Modified module, for changing the page in the xml document of the target detection script according to the modification order The positioning method and value of face control.
Each embodiment is described by the way of progressive in this specification, what each embodiment stressed be and other The difference of embodiment, between each embodiment identical similar portion mutually referring to.
The foregoing description of the disclosed embodiments, professional and technical personnel in the field are enable to realize or using the present invention. A variety of modifications to these embodiments will be apparent for those skilled in the art, as defined herein General Principle can be realized in other embodiments without departing from the spirit or scope of the present invention.Therefore, it is of the invention The embodiments shown herein is not intended to be limited to, and is to fit to and principles disclosed herein and features of novelty phase one The most wide scope caused.

Claims (10)

  1. A kind of 1. method of testing based on Selenium, it is characterised in that including:
    Receive the test command that tester sends;
    Test case management module is opened, so that tester selects this test to use in the test case management module Example, and change the test data of this test case;
    This test script corresponding to this described test case is called, so that this described test script is according to the test number Tested according to this is performed.
  2. 2. method of testing according to claim 1, it is characterised in that call this survey corresponding to this described test case After training sheet, in addition to:
    This test result table is generated in the test case management module, and the test data be recorded into the test As a result in table.
  3. 3. method of testing according to claim 2, it is characterised in that also include;
    In this described measuring executing process, the implementation procedure of this test be recorded into this described test result table In.
  4. 4. method of testing according to claim 3, it is characterised in that also include;
    After the completion of this described test execution, it is described so that the tester checks to open the test case management module This test result table.
  5. 5. according to the method for testing described in claim any one of 1-4, it is characterised in that also include;
    Receive the modification order of the page control of target detection script;
    According to the modification order change in the xml document of the target detection script page control positioning method and Value.
  6. A kind of 6. test device based on Selenium, it is characterised in that including:
    First receiving module, for receiving the test command of tester's transmission;
    Selecting module, for opening test case management module, so that tester selects in the test case management module This test case is selected, and changes the test data of this test case;
    Test module, for calling this test script corresponding to this described test case, so as to this described test script This test is performed according to the test data.
  7. 7. test device according to claim 6, it is characterised in that also include:
    First logging modle, for generating this test result table in the test case management module, and by the test Data recorded in the test result table.
  8. 8. test device according to claim 7, it is characterised in that also include:
    Second logging modle, in this described measuring executing process, the implementation procedure of this test to recorded In this described test result table.
  9. 9. test device according to claim 8, it is characterised in that also include:
    Display module, for after the completion of this described test execution, opening the test case management module so as to the survey Examination personnel check this described test result table.
  10. 10. according to the test device described in claim any one of 6-9, it is characterised in that also include:
    Second receiving module, the modification order of the page control for receiving target detection script;
    Modified module, for changing the page control in the xml document of the target detection script according to the modification order The positioning method and value of part.
CN201710912383.3A 2017-09-29 2017-09-29 Selenium-based testing method and device Pending CN107704391A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710912383.3A CN107704391A (en) 2017-09-29 2017-09-29 Selenium-based testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710912383.3A CN107704391A (en) 2017-09-29 2017-09-29 Selenium-based testing method and device

Publications (1)

Publication Number Publication Date
CN107704391A true CN107704391A (en) 2018-02-16

Family

ID=61175691

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710912383.3A Pending CN107704391A (en) 2017-09-29 2017-09-29 Selenium-based testing method and device

Country Status (1)

Country Link
CN (1) CN107704391A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109376089A (en) * 2018-10-24 2019-02-22 江苏满运软件科技有限公司 A kind of automatic test management method and system
CN112416734A (en) * 2019-08-20 2021-02-26 北京中关村科金技术有限公司 Test method, device and storage medium
CN112612691A (en) * 2020-11-30 2021-04-06 北京思特奇信息技术股份有限公司 Method and system for realizing automatic test data management and control based on SVN, electronic device and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101882107A (en) * 2010-06-28 2010-11-10 山东中创软件商用中间件股份有限公司 Method and device for automatically testing WEB (World Wide Web) application
CN102495789A (en) * 2011-10-18 2012-06-13 瑞斯康达科技发展股份有限公司 Automatic test method and device for the same
US20150082279A1 (en) * 2013-09-13 2015-03-19 Sap Ag Software testing system and method
CN105159833A (en) * 2015-09-30 2015-12-16 努比亚技术有限公司 Automatic testing device and method
CN106649090A (en) * 2016-10-10 2017-05-10 上海瀚之友信息技术服务有限公司 Automated test system and method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101882107A (en) * 2010-06-28 2010-11-10 山东中创软件商用中间件股份有限公司 Method and device for automatically testing WEB (World Wide Web) application
CN102495789A (en) * 2011-10-18 2012-06-13 瑞斯康达科技发展股份有限公司 Automatic test method and device for the same
US20150082279A1 (en) * 2013-09-13 2015-03-19 Sap Ag Software testing system and method
CN105159833A (en) * 2015-09-30 2015-12-16 努比亚技术有限公司 Automatic testing device and method
CN106649090A (en) * 2016-10-10 2017-05-10 上海瀚之友信息技术服务有限公司 Automated test system and method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
张慧琳 等: ""基于Selenium和TestNG的集成自动化测试平台设计"", 《实验技术与管理》 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109376089A (en) * 2018-10-24 2019-02-22 江苏满运软件科技有限公司 A kind of automatic test management method and system
CN112416734A (en) * 2019-08-20 2021-02-26 北京中关村科金技术有限公司 Test method, device and storage medium
CN112612691A (en) * 2020-11-30 2021-04-06 北京思特奇信息技术股份有限公司 Method and system for realizing automatic test data management and control based on SVN, electronic device and storage medium

Similar Documents

Publication Publication Date Title
Burg et al. Interactive record/replay for web application debugging
US6941546B2 (en) Method and apparatus for testing a software component using an abstraction matrix
Leotta et al. Pesto: Automated migration of DOM‐based Web tests towards the visual approach
BR112020020917A2 (en) execution control with cross-level trace mapping
US10303751B1 (en) System and method for interaction coverage
US20140366005A1 (en) Abstract layer for automatic user interface testing
US20120124495A1 (en) System and method for object relationship identification in a user interface
US8135572B2 (en) Integrated debugger simulator
CN104699602A (en) Method for detecting influence and computer
CN107704391A (en) Selenium-based testing method and device
CN112711526A (en) UI test method, device, equipment and storage medium
Amalfitano et al. The DynaRIA tool for the comprehension of Ajax web applications by dynamic analysis
Tuovenen et al. MAuto: Automatic mobile game testing tool using image-matching based approach
Mehrpour et al. Active documentation: Helping developers follow design decisions
US20150020045A1 (en) Method, device and computer-readable storage medium for closure testing
Ahmad et al. Challenges of mobile applications development: Initial results
WO2016131328A1 (en) Network-element-simulator-based testing method and device
US20130318499A1 (en) Test script generation
US20230195825A1 (en) Browser extension with automation testing support
US11010140B2 (en) Integration of workflow and logical data objects using visual programming
US10579761B1 (en) Method and system for reconstructing a graph presentation of a previously executed verification test
US20240053980A1 (en) Shortened narrative instruction generator for software code change
US20090265156A1 (en) Dynamically varying simulation precision
Procaccianti Energy-efficient software
CN109426497A (en) Data embedding method, device, system and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20180216

RJ01 Rejection of invention patent application after publication