Summary of the invention
In view of the above problems, the object of this invention is to provide a kind of mobile browser automated testing method,Testing server and system, to shorten the testing time, improve testing efficiency.
According to an aspect of the present invention, provide a kind of automated testing method of mobile browser, comprising:
The number of the mobile terminal of adding up all pages to be measured and be connected with testing server, Qi ZhongyiThe number of moving terminal is at least two or more;
According to the number of added up mobile terminal, from the mobile terminal being connected with testing server, selectSelect at least two mobile terminals, and start the test process of selected mobile terminal, then respectively to instituteThe mobile terminal of selecting sends the page to be measured and carries out automatic test;
Receive respectively the test result of corresponding mobile terminal and preserve.
Wherein, testing server comprises master server and child servers, wherein,
Be connected with master server by least one child servers;
Add up all pages to be measured by master server, and the added up page to be measured is distributed to sub-servicesDevice;
Add up the number of the mobile terminal being connected with child servers by child servers, then from main serviceIn device, obtain the page to be measured of distribution, and send to mobile terminal.
In addition, the invention provides a kind of testing server of mobile browser, comprising:
Statistic unit, the movement being connected with testing server for adding up all pages to be measured and statisticsThe number of terminal, wherein the number of mobile terminal is at least two or more;
Test processes unit, for the number of the mobile terminal added up according to statistic unit, from testIn the mobile terminal that server is connected, select at least two mobile terminals, and start selected eventually mobileThe test process of end, then sends the page to be measured to selected mobile terminal respectively and carries out automatic test;
Result treatment unit, for receiving respectively after the test result of corresponding mobile terminal, by test resultPreserve.
On the other hand, the invention provides a kind of automatization test system of mobile browser, comprise aforementioned surveyExamination server and mobile terminal, wherein, be connected with testing server by least two mobile terminals,To complete automatic test.
Wherein, mobile terminal comprises:
Page acquiring unit to be measured, the page to be measured pushing for obtaining testing server;
Test cell, for reading the information of the page to be measured, tests;
Test result transmitting element, for sending to testing server by test result.
Utilize above-mentioned according to the automated testing method of mobile browser of the present invention, testing server and beSystem, by carrying out distributed deployment at mobile terminal, or enters respectively at testing server and mobile terminalRow distributed deployment, carries out concurrent testing to test cases, once tests thereby can shorten entire runThe time of case, is ensureing on the quality base of each submitted to code, shortens the testing time, carriesHigh testing efficiency.
In order to realize above-mentioned and relevant object, one or more aspects of the present invention comprise below will be in detailThe feature that illustrates and particularly point out in the claims. Explanation and accompanying drawing below describe this in detailSome bright illustrative aspects. But what indicated these aspects only can use principle of the present inventionSome modes in variety of way. In addition, the present invention be intended to comprise all these aspects and they etc.Jljl.
Detailed description of the invention
Below with reference to accompanying drawing, specific embodiments of the invention are described in detail.
For aforementioned existing browser of mobile terminal, in the time carrying out automatic test, existence can only be used listProcess operation test case, and the overlong time of a test cases of entire run, what testing efficiency was low asksTopic. The present invention is by carrying out distributed deployment at mobile terminal, or at testing server end with eventually mobileEnd carries out respectively distributed deployment, and testing server starts according to the number of coupled mobile terminalThe test process of mobile terminal, surveys respectively the test case of needs test by multiple test processesExamination, thus the test of whole test cases completed at short notice, ensure at exploitation browser of mobile terminalTime the code of submitting to the basis of quality on, greatly shortened the testing time, improved testing efficiency.
It should be noted that, in the present invention, mentioned mobile terminal can refer to that mobile phone, IPAD etc. are eventually mobileEnd equipment but be not limited to this.
For the automated testing method of mobile browser provided by the invention is described, Fig. 2 shows basisThe automated testing method flow process of the mobile browser of the embodiment of the present invention.
As shown in Figure 2, describe from the angle of testing server, mobile browser provided by the invention fromMovingization method of testing comprises:
S210: the testing server all pages to be measured of statistics and the movement being connected with testing server are wholeThe number of end, wherein the number of mobile terminal is at least two or more.
Wherein, the host process by testing server is to all pages to be measured and be connected with testing serverThe number of the mobile terminal connecing is added up.
Particularly, the host process of testing server is collected all pages to be measured that connect that are attached thereto, and formation is treatedSurvey page listings, and statistics is attached thereto the mobile terminal connecing.
S220: according to the number of added up mobile terminal, eventually mobile from what be connected with testing serverIn end, select at least two mobile terminals, and start the test process of selected mobile terminal, then divideDo not send the page to be measured to selected mobile terminal and carry out automatic test.
In addition, can enter the number that is attached thereto the mobile terminal connecing by the host process of testing serverAfter row statistics, according to added up number, the mobile terminal of notice similar number starts in mobile terminalTest process, utilize multiple test processes concurrently test cases to be tested, thus save testTime.
In an example of the present invention, suppose to have 5 mobile phones to be connected with testing server, now surveyThe test process that examination server can start 4 mobile phones carries out automatic test, also can start 5 handsThe test process of machine carries out automatic test.
S230: receive respectively the test result of corresponding mobile terminal and preserve. That is to say testing serviceAfter the test result that device is tested the page to be measured at the test process of mobile terminal receive, will test knotFruit preserves.
Wherein, carry out in the process of automatic test at mobile terminal, first the test process of mobile terminalObtain the page to be measured that testing server pushes; Then mobile terminal reads the information of the page to be measured, entersRow test; After mobile terminal completes the test of the page to be measured, mobile terminal sends test resultGive testing server.
Particularly, testing server is after receiving the test result of mobile terminal transmission, by this testResult is saved to testing server.
Can find out the automatic test of mobile browser provided by the invention by the flow process shown in Fig. 2Method, by distributed multiple mobile terminal is set, testing server can be by starting multiple movementsTest process in terminal carries out concurrent testing to test case, can shorten once test case of entire runThe time of example, on the basis of quality that ensures each submitted to code, greatly improve testing efficiency.
It should be noted that, above-mentioned is multiple distributed mobile terminals to be set illustrate, the present inventionDistributed testing server can also be further set on this basis. When exist multiple mobile terminals andWhen a testing server, testing efficiency may be limited to single testing server so, its main bodyPresent two aspects: the one, the linking number of the maximum mobile terminal that testing server is supported and process number;The 2nd, the disposal ability of the single test process of mobile terminal. Therefore, based on above-mentioned two aspects, at thisIn a bright example, testing server is set to distributed server, can be divided into master server andMultiple child servers, wherein, are connected with master server by least one child servers. Wherein, mainThe effect of server is that the page to be measured of all test cases is distributed to child servers, and child serversHost process notify the test process of mobile terminal when start test and test content, andCollect test result, judge whether test is passed through.
Concrete, add up all pages to be measured by master server, and by added up page distribution to be measuredGive child servers; Add up the number of the mobile terminal being connected with child servers by child servers, thenFrom master server, obtain the page to be measured of distribution, and send to be connected with this child servers eventually mobileEnd, notice mobile terminal starts the test process in mobile terminal.
Particularly, multiple child servers are connected with master server, each child servers is conduct respectively againA testing server is connected with mobile terminal, the movement that so just can make testing server connectThe quantity of terminal increases greatly, thereby the quantity that makes the test process that testing server starts also can beOriginally on the basis of mobile terminal distributed schemes, greatly increase, thereby further shorten the time of testing,Improve testing efficiency.
It also should be noted that, the automated testing method of mobile browser provided by the present invention alsoSupport dynamic expansion, mobile terminal can join in test at any time, also can exit at any time test.
Particularly, in the time having new mobile terminal to be connected with testing server, (there is new mobile terminal to addEnter test), testing server starts the test process of this new mobile terminal and sends out to this new mobile terminalSend the page to be measured; In the time that mobile terminal and testing server disconnect (mobile terminal exits test),After the disconnection message that testing server sends at the test process that receives mobile terminal, withdrawal institute is rightAnswer the test of the page to be measured to put back in page listings to be measured by the page to be measured.
For the automated testing method of mobile browser provided by the invention is described in more detail, Fig. 3,Fig. 4, Fig. 5 and Fig. 6 do more automatic testing process provided by the present invention in the mode of example respectivelySpecific description. Wherein, Fig. 3 shows according to the host process of the testing server of the embodiment of the present inventionHandling process. As shown in Figure 3:
S310: the host process of testing server is added up the url of the page to be measured, and statistics is connected to this testThe number of the mobile terminal on server;
S320: the host process notice mobile terminal of testing server starts test process, sends out to mobile terminalSend the page to be measured;
S330: the test process return messages that wait standby communication terminal;
S340: judge whether the access message of new mobile terminal, if had, enter step S350,Otherwise enter step S360;
S350: the test process that the host process of testing server starts new mobile terminal, then returnsS330;
S360: judge whether that test process completes the message of test, if enter step S370, noReturn to S330;
Wherein, judge whether that test has two kinds of modes, one are to know from webpage when test finishes,Another is that browser completes webpage and loads to resolve after playing up and think and tested.
S370: judge that whether test all completes, if enter step S380, otherwise returns to stepS330;
S380: testing server is notified mobile terminal to stop and being destroyed test process and testing serverGenerate test result form, finish test.
It should be noted that, this embodiment illustrates with 1 testing server and multiple mobile terminal, asFruit testing server is divided into the situation of master server and child servers, is also similarly, and difference is,All pages to be measured are given child servers by master server, then started by child servers notice mobile terminalTest process and distribute the page to be measured to mobile terminal.
Fig. 4 illustrates according to the handling process of the test process starting at mobile terminal of the embodiment of the present invention.As shown in Figure 4:
S410: after the test process of mobile terminal is activated, obtains and treat from the host process of testing serverSurvey the url of the page;
S420: test process notice mobile terminal automation testing software;
S430: set time-out time, wait for the arrival of news;
S440: judge whether the automatic test result of mobile terminal, if there has been test result,Enter step S450, otherwise enter step S460;
S450: the test result of mobile terminal is sent to testing server and preserves, complete this test;
S460: judge whether overtimely, if overtime, enter step S470, otherwise get back to step S430;
S470: judge whether mobile terminal automation testing software collapses, if enter S480, otherwiseEnter S490;
S480: the result of mobile terminal automation testing software crash is sent to testing server and preserves,Complete this test;
S490: overtime result is sent to testing server and preserves, complete this test.
Fig. 5 show according to the embodiment of the present invention in the time that mobile terminal and testing server disconnect, testThe handling process of server. As shown in Figure 5:
S510: the test process that mobile terminal starts scans mobile terminal and testing server has disconnectedWhen connection, send the url of the page to be measured to testing server by message;
S520: testing server is after receiving the disconnection message of test process, by the url of the page to be measuredPut back in page listings to be measured;
S530: testing server stops and closing the process relevant to test that it starts.
Fig. 6 shows according to the handling process of the mobile terminal of the embodiment of the present invention. As shown in Figure 6:
S610: the url of the page to be measured that the test process wait testing server of mobile terminal pushes;
S620: mobile terminal obtains the url of the page to be measured from testing server;
S630: mobile terminal, according to the url of the page to be measured, reads Webpage, resolves and carries out js;
S640: test run result is sent to testing server by mobile terminal.
Can find out by above-mentioned example, utilize automated testing method provided by the present invention to have madeThe total time of a test cases of whole operation shortens, and improves testing efficiency.
Particularly, for the effect that illustrates that automated testing method provided by the invention embodies, at thisIn a bright example, if do not use automated testing method provided by the present invention, its operation allThe total time of automatic test case is tens hours; And in another example of the present invention, useAutomated testing method provided by the present invention, its total time of moving whole automatic test cases shortensIn tens minutes, therefore the testing time shortens greatly, and efficiency greatly improves.
Corresponding with said method, the present invention also provides a kind of automatization test system of mobile browser,Fig. 7 shows according to the logical construction of the automatization test system of the mobile browser of the embodiment of the present invention.
As shown in Figure 7, the automatization test system 700 of mobile browser provided by the invention comprises testServer 710 and mobile terminal 720. Wherein, by least two mobile terminals 720 and testing server710 are connected, to complete automatic test.
Particularly, testing server 710 provided by the invention comprises statistic unit 711, test processes unit712 and result treatment unit 713.
Wherein, statistic unit 711 is for adding up all pages to be measured and being connected with testing serverThe number of mobile terminal, wherein, the number of mobile terminal is at least two or more; Test processes unit712 numbers for the mobile terminal added up according to statistic unit 711, from coupled eventually mobileIn end, select at least two mobile terminals, and start the test process of selected mobile terminal, then divideDo not send the page to be measured to selected mobile terminal and carry out automatic test; Result treatment unit 713 useAfter receiving respectively the test result of corresponding mobile terminal, test result is preserved.
Wherein, testing server provided by the invention further comprises master server and child servers, wherein,Master server is used for adding up all pages to be measured, then the added up page to be measured is distributed to child servers;Child servers, for adding up the number of the mobile terminal being connected with child servers, then obtains from master serverGet the page to be measured of distribution, and send to mobile terminal; Wherein, at least one child servers and main serviceDevice is connected.
In addition, mobile terminal 720 provided by the present invention comprises page acquiring unit 721 to be measured, test listUnit 722 and test result transmitting element 723.
Wherein, the page to be measured that page acquiring unit 721 to be measured pushes for obtaining testing server;Test cell 722, for reading the information of the page to be measured, is tested; Test result transmitting element 723For test result is sent to testing server.
By automated testing method, testing server and the system of mobile browser provided by the present invention,Carry out distributed deployment at mobile terminal, or distribute respectively at testing server end and mobile terminalFormula is disposed, and testing server passes through to start multiple test processes to test cases concurrent testing, thereby shortIn time, complete the test of whole test cases, thereby each institute submits in the time of exploitation browser of mobile terminal toOn the basis that the quality of code is protected, improve the efficiency of whole test.
Describe according to the automation of mobile browser of the present invention and surveyed in the mode of example above with reference to accompanying drawingMethod for testing, testing server and system. But, it will be appreciated by those skilled in the art that for above-mentionedAutomated testing method, testing server and the system of the mobile browser that proposes of invention, can also beDo not depart from the basis of content of the present invention and make various improvement. Therefore, protection scope of the present invention should be byThe content of appending claims is determined.