CN107145448A - Test middleware, test system and method based on selenium - Google Patents

Test middleware, test system and method based on selenium Download PDF

Info

Publication number
CN107145448A
CN107145448A CN201710321784.1A CN201710321784A CN107145448A CN 107145448 A CN107145448 A CN 107145448A CN 201710321784 A CN201710321784 A CN 201710321784A CN 107145448 A CN107145448 A CN 107145448A
Authority
CN
China
Prior art keywords
test
selenium
browser
control modules
middleware
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
CN201710321784.1A
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.)
Ctrip Travel Information Technology Shanghai Co Ltd
Original Assignee
Ctrip Travel Information Technology Shanghai 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 Ctrip Travel Information Technology Shanghai Co Ltd filed Critical Ctrip Travel Information Technology Shanghai Co Ltd
Priority to CN201710321784.1A priority Critical patent/CN107145448A/en
Publication of CN107145448A publication Critical patent/CN107145448A/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/3688Test management for test execution, e.g. scheduling of test suites

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 kind of test middleware, test system and method based on selenium, test middleware includes:Interaction API module, task queue module, selenium control modules and browser resource pool;Interaction API module includes multiple api interfaces, and api interface receives multiple test assignments and sent to task queue module;Multiple test assignments are stored in task queue by task queue module, and are sent successively in sequence to selenium control modules;Selenium control modules transfer browser resource according to each test assignment successively from browser resource pool and call selenium, and the node nodes that test assignment and browser resource are sent to selenium are completed to test, test result is sent;Browser resource pool deposits multiple browser resources.The present invention reduces the maintenance work of script, the difficulty of performance test work is also reduced.

Description

Test middleware, test system and method based on selenium
Technical field
The invention belongs to browser testing field, more particularly to a kind of test middleware based on selenium, test system System and method.
Background technology
Existing UI (user interface) testing tool based on selenium (browser automated test frame) is single user Single task form, and selenium test needs professional test developer to carry out writing for source code, non-general survey by hand The ability that examination personnel can possess, difficulty of test is high, and script maintenance workload is big, and the requirement degree to human resources is very high.
The content of the invention
The technical problem to be solved in the present invention be in order to overcome in the prior art selenium method of testings can only solve list The problem of user's single task, and the defect that script maintenance workload is big, performance test work difficulty is high is based on there is provided one kind Selenium test middleware, test system and method.
The present invention is to solve above-mentioned technical problem by following technical proposals:
A kind of test middleware based on selenium, including:Interaction API (application programming interface) module, task Queue module, selenium control modules and browser resource pool;
The interactive API module includes multiple api interfaces, and the api interface is used to receive multiple test assignments and send To the task queue module;
The task queue module is used to the multiple test assignment received being stored in task queue, and according to institute The order for stating task queue successively sends the multiple test assignment to the selenium control modules;
The selenium control modules are used to be transferred from the browser resource pool according to each test assignment successively Browser resource simultaneously calls selenium, and the test assignment and the browser resource are sent to the selenium's Node nodes complete the test of task, and test result is sent;
The browser resource pool is used to deposit multiple browser resources.
In this programme, test assignment is sent to the interaction API module of test middleware, the test assignment connects for the page Connect, component identification, to element carry out operation and the operation need parameter at least one of, such as a specific website IP (procotol) address, ID (number of setting) numbers or sendkey of operating personnel (programmed statements, it can be by one or many Individual press key message is sent to active window, just as being inputted with keyboard) operation etc., test middleware is to complete The test of task, overcoming the test of selenium in the prior art needs what professional test developer carried out that source code writes to lack Fall into.
It is preferred that the multiple test assignment is multiple test assignments or single that the multiple users of synchronization send over Multiple test assignments that user sends over.
In this programme, test assignment is multiple tests times of multiple test assignments that single user is sent or multiuser transmission Business, interaction API module sends the multiple test assignment to task queue module, and the task queue module is according to advanced elder generation The test assignment is sent to the test that selenium control modules complete task by the order gone out successively, overcomes prior art Selenium can only solve the defect of single user single task.
It is preferred that the test assignment also performs request including one, described perform asks to include performing the test assignment Required node node types and browser type;
The selenium control modules are transferred with institute according to the browser type from the browser resource pool State the browser resource of browser type;
The selenium control modules appoint the browser resource and the test according to the node node types Business is sent to the node nodes with the node node types.
In this programme, the browser resource pool is used to deposit substantial amounts of browser resource and browser resource and node The corresponding relation of node type, according to the node node types included in request and browser type is performed, selenium is controlled The corresponding browser resource concurrence of module calls is sent to corresponding node nodes to carry out the test of task.
It is preferred that the selenium control modules are additionally operable to detect that the target for being carrying out a target detection task is browsed Whether the quantity of device resource exceedes the threshold value of setting, if so, then stopping transferring the target from the browser resource pool clear Look at device resource.
In this programme, a certain type that selenium control modules are also monitored used in executory test assignment in real time is clear Look at device resource amount whether exceed setting threshold value, more than quantity same browser resource simultaneously perform test assignment, can Server can be caused to exhaust, influence the execution speed of overall task.
It is preferred that the test middleware also includes daily record sorting module, the daily record sorting module is used to receive described The test result that selenium control modules are sended over, and daily record data is generated according to the test result, recall The api interface sends the daily record data.
A kind of test system based on selenium, including management platform and the test of each preference any combination as described above Middleware, the management platform is used to call the api interface to send the multiple test assignment and receive the test result.
A kind of method of testing based on selenium, is realized, the method for testing using test middleware described above Comprise the following steps:
S1, the api interface receive multiple test assignments and sent to the task queue module;
The multiple test assignment received is stored in task queue by S2, the task queue module, and according to institute The order for stating task queue successively sends the multiple test assignment to the selenium control modules;
S3, the selenium control modules are transferred clear according to each test assignment from the browser resource pool successively Look at and device resource and call selenium, the test assignment and browser resource are sent to the node nodes of the selenium The test of completion task, and test result is sent.
It is preferred that the test assignment described in step S1 is multiple test assignments that the multiple users of synchronization send over Or multiple test assignments that unique user is sended over.
It is preferred that the test assignment also includes performing request, described perform asks to include performing the test assignment institute In the node node types and browser type needed, step S3:
The selenium control modules are transferred with institute according to the browser type from the browser resource pool State the browser resource of browser type;
The selenium control modules appoint the browser resource and the test according to the node node types Business is sent to the node nodes with the node node types.
It is preferred that step S3 also includes:The selenium control modules detection is carrying out a target detection task Whether the quantity of objective browser resource exceedes the threshold value of setting, if so, then stopping transferring institute from the browser resource pool State objective browser resource.
It is preferred that the test middleware also includes daily record sorting module, the method for testing also includes step S4:
The test result that the daily record sorting module reception selenium control modules are sended over, and according to The test result generates the daily record data, recalls the api interface and sends the daily record data.
It is preferred that the method for testing is also realized using management platform, also include before step S1:The management platform The api interface is called to send test assignment;Also include after step S4:The daily record sorting module calls the api interface The test result is sent to the management platform.
The positive effect of the present invention is:The present invention is by increasing test middleware, as long as simple addition interaction The access information of api interface just can complete the test of task by testing middleware, so as to realize similar to management platform A set of multi-task and multi-user system, can more reduce the maintenance work of script, at the same also reduce performance test work difficulty.
Brief description of the drawings
Fig. 1 is the structured flowchart of the test middleware based on selenium of the embodiment of the present invention 1.
Fig. 2 is the structured flowchart of the test system based on selenium of the embodiment of the present invention 1.
Fig. 3 is the flow chart of the method for testing based on selenium of the embodiment of the present invention 2.
Embodiment
The present invention is further illustrated below by the mode of embodiment, but does not therefore limit the present invention to described reality Apply among a scope.
Embodiment 1
A kind of test middleware based on selenium, as shown in figure 1, including:Interaction API module 1, task queue module 2nd, selenium control modules 3, browser resource pool 4 and daily record sorting module 5;
The interactive API module 1 includes multiple api interfaces, and the api interface is used to receive multiple test assignments and send To the task queue module 2;The multiple test assignment is multiple test assignments that the multiple users of synchronization send over Or multiple test assignments that unique user is sended over;
The task queue module 2 is used to the multiple test assignment received being stored in task queue, and according to The order of the task queue successively sends the multiple test assignment to the selenium control modules 3;
Each test assignment also performs request including one, and the execution request is included needed for the execution test assignment Node node types and browser type;The selenium control modules 3 are according to the browser type from the browser The browser resource with the browser type is transferred in resource pool 4;Selenium is recalled, according to the node nodes class The test assignment and the browser resource are sent to the node nodes with the node node types and complete task by type Test, and test result is sent to daily record sorting module;
The browser resource pool 4 is used to deposit multiple browser resources;
The daily record sorting module 5 is used to receive the test result, and generates daily record data according to the test result, The api interface is recalled to send the daily record data.
The test assignment generates test mode and sent to the interactive API module 1 in real time in test process, described Test mode is any one in wait, execution, success and failure.Specifically, when test script is stored in the task queue The test mode waited is generated simultaneously and the test mode is back to the interactive API module 1;When test script is by described Task queue module 2 sends the test mode for generating and performing while performing test assignment to the selenium control modules 3 And the test mode is back to the interactive API module 1;When test script in the selenium control modules 3 it is complete While generating test result into test assignment, the test mode of success or failure is generated and by institute according to the test result of task State test mode and be back to the interactive API module 1.
The present embodiment also provides a kind of test system based on selenium, as shown in Fig. 2 including management platform 6 and such as Upper described test middleware, the management platform 6 is used to send the multiple test assignment to the interactive API module 1, It is additionally operable to receive the daily record data that the daily record sorting module 5 is sended over.
In the present embodiment, by increasing test middleware, as long as the test of management platform simply addition interaction api interface is appointed Business, it is possible to the test of task is completed by testing middleware, then test result is back to management platform, so as to realize one The test system of similar management platform is covered, the maintenance work of script can be more reduced, while also reducing the difficulty of performance test work Degree.
Embodiment 2
A kind of method of testing based on selenium, is realized, such as Fig. 3 using test middleware as described in Example 1 Shown, the method for testing comprises the following steps:
Step 101, api interface receive multiple test assignments and sent to task queue module.The test assignment is same Multiple test assignments that the multiple test assignments or unique user that one moment multiple users send over are sended over.
The multiple test assignments received are stored in task queue by step 102, task queue module, and according to described The order of business queue successively sends the multiple test assignment to the selenium control modules.
Step 103, selenium control modules transfer tool according to the browser type from the browser resource pool There is the browser resource of the browser type;Selenium is recalled, will be described clear according to the node node types Look at device resource and the test assignment sends to the node nodes with the node node types test of the task that completes, and will Test result is sent to daily record sorting module.
Step 104, daily record sorting module receive test result, and generate daily record data according to test result, and call API Interface sends daily record data.
Method of testing in the present embodiment is also realized using management platform, is also included before step 101:The management is flat Platform calls the api interface to send test assignment;Also include after step 104:The daily record sorting module calls the API to connect Mouth sends the test result to the management platform.
Although the foregoing describing the embodiment of the present invention, it will be appreciated by those of skill in the art that these It is merely illustrative of, protection scope of the present invention is defined by the appended claims.Those skilled in the art is not carrying on the back On the premise of principle and essence from the present invention, various changes or modifications can be made to these embodiments, but these are changed Protection scope of the present invention is each fallen within modification.

Claims (12)

1. a kind of test middleware based on selenium, it is characterised in that the test middleware includes:Interaction API module, Task queue module, selenium control modules and browser resource pool;
The interactive API module includes multiple api interfaces, and the api interface is used to receive multiple test assignments and sent to institute State task queue module;
The task queue module is used to the multiple test assignment received being stored in task queue, and according to described The order of business queue successively sends the multiple test assignment to the selenium control modules;
The selenium control modules are used to be transferred from the browser resource pool according to each test assignment successively to browse Device resource simultaneously calls selenium, and the test assignment and the browser resource are sent to the node sections of the selenium The test of point completion task, and test result is sent;
The browser resource pool is used to deposit multiple browser resources.
2. middleware is tested as claimed in claim 1, it is characterised in that the multiple test assignment, which is that synchronization is multiple, to be used Multiple test assignments that the multiple test assignments or unique user that family is sended over are sended over.
3. middleware is tested as claimed in claim 1, it is characterised in that the test assignment also performs request including one, institute State and perform request and include the node node types and browser type needed for the execution test assignment;
The selenium control modules are transferred with described clear according to the browser type from the browser resource pool Look at the browser resource of device type;
The selenium control modules send out the browser resource and the test assignment according to the node node types Deliver to the node nodes with the node node types.
4. middleware is tested as claimed in claim 1, it is characterised in that the selenium control modules are being additionally operable to detection just Whether exceed the threshold value of setting in the quantity of the objective browser resource for the target detection task that performs, if so, then stopping from institute State and the objective browser resource is transferred in browser resource pool.
5. middleware is tested as claimed in claim 1, it is characterised in that the test middleware also includes daily record and arranges mould Block, the daily record sorting module is used to receive the test result that the selenium control modules are sended over, and according to The test result generates daily record data, recalls the api interface and sends the daily record data.
6. a kind of test system based on selenium, it is characterised in that the test system includes management platform and such as right It is required that the test middleware in 1-5 described in any one, the management platform is used to call the api interface transmission the multiple Test assignment simultaneously receives the test result.
7. a kind of method of testing based on selenium, it is characterised in that the method for testing is using as claimed in claim 1 Test middleware to realize, the method for testing comprises the following steps:
S1, the api interface receive multiple test assignments and sent to the task queue module;
The multiple test assignment received is stored in task queue by S2, the task queue module, and according to described The order of business queue successively sends the multiple test assignment to the selenium control modules;
S3, the selenium control modules transfer browser according to each test assignment from the browser resource pool successively Resource simultaneously calls selenium, and the test assignment and browser resource are sent to the node nodes completion of the selenium The test of task, and test result is sent.
8. method of testing as claimed in claim 7, it is characterised in that the test assignment described in step S1 is more for synchronization Multiple test assignments that the multiple test assignments or unique user that individual user sends over are sended over.
9. method of testing as claimed in claim 7, it is characterised in that the test assignment also includes performing request, described to hold Row request is included in the node node types and browser type needed for the execution test assignment, step S3:
The selenium control modules are transferred with described clear according to the browser type from the browser resource pool Look at the browser resource of device type;
The selenium control modules send out the browser resource and the test assignment according to the node node types Deliver to the node nodes with the node node types.
10. method of testing as claimed in claim 7, it is characterised in that step S3 also includes:The selenium control modules Whether the quantity that detection is carrying out the objective browser resource of a target detection task exceedes the threshold value set, if so, then stopping The objective browser resource is only transferred from the browser resource pool.
11. the method for testing as described in any one in claim 7-10, it is characterised in that the test middleware also includes Daily record sorting module, the method for testing also includes step S4:
The daily record sorting module receives the test result that the selenium control modules are sended over, and according to described Test result generates daily record data, recalls the api interface and sends the daily record data.
12. method of testing as claimed in claim 11, it is characterised in that the method for testing is also using management platform come real It is existing, also include before step S1:The management platform calls the api interface to send test assignment;Also include after step S4: The daily record sorting module calls the api interface to send the test result to the management platform.
CN201710321784.1A 2017-05-09 2017-05-09 Test middleware, test system and method based on selenium Pending CN107145448A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710321784.1A CN107145448A (en) 2017-05-09 2017-05-09 Test middleware, test system and method based on selenium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710321784.1A CN107145448A (en) 2017-05-09 2017-05-09 Test middleware, test system and method based on selenium

Publications (1)

Publication Number Publication Date
CN107145448A true CN107145448A (en) 2017-09-08

Family

ID=59776802

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710321784.1A Pending CN107145448A (en) 2017-05-09 2017-05-09 Test middleware, test system and method based on selenium

Country Status (1)

Country Link
CN (1) CN107145448A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112579447A (en) * 2020-12-10 2021-03-30 京东数科海益信息科技有限公司 Browser testing method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103927253A (en) * 2013-01-11 2014-07-16 阿里巴巴集团控股有限公司 Multiple browser compatibility testing method and system
US20150082279A1 (en) * 2013-09-13 2015-03-19 Sap Ag Software testing system and method
CN104461855A (en) * 2013-09-22 2015-03-25 腾讯科技(北京)有限公司 Automatic Web testing method, system and device
CN105786696A (en) * 2014-12-26 2016-07-20 阿里巴巴集团控股有限公司 Test method and device
CN106547689A (en) * 2016-10-20 2017-03-29 金航数码科技有限责任公司 A kind of automatic test cases development system and method based on web

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103927253A (en) * 2013-01-11 2014-07-16 阿里巴巴集团控股有限公司 Multiple browser compatibility testing method and system
US20150082279A1 (en) * 2013-09-13 2015-03-19 Sap Ag Software testing system and method
CN104461855A (en) * 2013-09-22 2015-03-25 腾讯科技(北京)有限公司 Automatic Web testing method, system and device
CN105786696A (en) * 2014-12-26 2016-07-20 阿里巴巴集团控股有限公司 Test method and device
CN106547689A (en) * 2016-10-20 2017-03-29 金航数码科技有限责任公司 A kind of automatic test cases development system and method based on web

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
FANXIYANHONG: ""(selenium 六)unittest通过测试套件组织用例(2)"", 《CSDN》 *
仅存的记忆: "《Selenium 2 & WebDriver &多线程并发》", 《博客园》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112579447A (en) * 2020-12-10 2021-03-30 京东数科海益信息科技有限公司 Browser testing method and device

Similar Documents

Publication Publication Date Title
US8516451B2 (en) System and method for creating virtual callback objects
US11307969B2 (en) Methods for improved web application testing using remote headless browsers and devices thereof
CN106649057A (en) Method and device for testing server pressure
US7953850B2 (en) Monitoring related content requests
JP6095491B2 (en) How to predict call topics
CN110768872B (en) Inspection method, system, device, computer equipment and storage medium
US9015668B1 (en) Instrumentation agent for manipulating component responses in a test
WO2016095554A1 (en) Test method, device and system for application
US20100223446A1 (en) Contextual tracing
CN103176895A (en) Method and system of regression testing
US10084637B2 (en) Automatic task tracking
JPH08163132A (en) Modeling method of data traffic of network,and simulation method thereof
US20180210745A1 (en) Virtual service interface
CN110177139A (en) A kind of ostensible mobile APP data grab method
US10775751B2 (en) Automatic generation of regular expression based on log line data
CN107092559A (en) Test platform middleware, test system and method based on Jmeter
CN101163024A (en) Method and device of performing concurrent operation to a plurality of network servers
CN103593293A (en) Parallel automated testing method
CN114691782B (en) Database table increment synchronization method, device and storage medium
US8146086B2 (en) Gathering operational metrics within a grid environment using ghost agents
CN113495498B (en) Simulation method, simulator, device and medium for hardware device
CN105095070B (en) QQ group's data capture method and system based on browser testing component
CN107145448A (en) Test middleware, test system and method based on selenium
CN106357466B (en) A kind of internet product monitoring method and monitoring system
CN110188258B (en) Method and device for acquiring external data by using crawler

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: 20170908

RJ01 Rejection of invention patent application after publication