CN103713988A - Program testing device and program testing method - Google Patents

Program testing device and program testing method Download PDF

Info

Publication number
CN103713988A
CN103713988A CN201210375517.XA CN201210375517A CN103713988A CN 103713988 A CN103713988 A CN 103713988A CN 201210375517 A CN201210375517 A CN 201210375517A CN 103713988 A CN103713988 A CN 103713988A
Authority
CN
China
Prior art keywords
program
test
control
module
attribute
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
CN201210375517.XA
Other languages
Chinese (zh)
Other versions
CN103713988B (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201210375517.XA priority Critical patent/CN103713988B/en
Publication of CN103713988A publication Critical patent/CN103713988A/en
Application granted granted Critical
Publication of CN103713988B publication Critical patent/CN103713988B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a program testing method. The method includes the following steps: selecting a visual control from a program, acquiring method attributes according to the visual control, testing the program according to the method attributes, and acquiring testing reaction of the program; recording test starting time and test finishing time of the program; calculating running time of the program, judging whether the running time meets preset requirements or not, and generating a first judgment result, wherein the running time is equal to difference of the test finishing time and the test starting time; when the first judgment result shows that the running time meets the preset requirements, stopping testing the program. The invention further discloses a program testing device. By the method and the device, unnecessary testing can be avoided, more pertinence in program testing is realized, and program testing efficiency is improved.

Description

Program test device and method
[technical field]
The present invention relates to program test field, particularly a kind of program test device and method.
[background technology]
In the performance history of program (software), need developed program (software) to test.Android(Android) (for example, Monkey), this command-line tool may operate in simulator or physical device to provide a command-line tool.In traditional test process, this command-line tool sends pseudorandom customer incident stream to simulator or physical device, and for example, key-press input, touch-screen input, gesture input etc., test program (software) thereby realize.
The capable instrument of mentioned order has such defect: the flow of event data stream that test is used is random, can not carry out self-defined.
For this command-line tool, the flow of event data stream of using due to test is random, therefore there will be more invalid click (operation),, the pixel that much cannot operate also at random (test) arrive, especially in having the user interface of pop-up box etc., the phenomenon of the more invalid click of above-mentioned appearance (operation) is more obvious, and this can cause the efficiency of testing for program (software) very low.
Therefore, be necessary to propose a kind of new technical scheme, to solve the problems of the technologies described above.
[summary of the invention]
One object of the present invention is to provide a kind of program testing method, and it can avoid carrying out unnecessary test, makes for the test of program more targetedly, improves the testing efficiency of program.
For addressing the above problem, the invention provides a kind of program testing method, said method comprising the steps of: from program, select visual control and according to described visual control acquisition methods attribute, and described program is tested and obtained the test reaction of described program according to described method attribute; Record test start time and the test end time of described program; Calculate the working time of described program, and judge whether meet pre-provisioning request described working time and generate the first judged result, equal the poor of described test end time and described test start time described working time; Described first, judgment result is that and while meeting described pre-provisioning request, stop described program to test described working time.
Another object of the present invention is to provide a kind of program test device, and it can avoid carrying out unnecessary test, makes for the test of program more targetedly, improves the testing efficiency of program.
For addressing the above problem, the invention provides a kind of program test device, described device comprises: test module, for selecting visual control and according to described visual control acquisition methods attribute from program, and for described program being tested and obtained the test reaction of described program according to described method attribute; Time logging modle, for recording test start time and the test end time of described program; Whether the first judge module, for calculating the working time of described program, and meet pre-provisioning request described working time and generate the first judged result for judging, equals the poor of described test end time and described test start time described working time; Described test module is described working time also for judgment result is that and stop described program to test while meeting described pre-provisioning request described first.
Relative prior art, the present invention can be so that more targeted and more efficient for the test of program, reason is in the process that program is tested, from program, to select visual control, avoided some non-visual controls to test, therefore can be so that this test produce effect and is efficient, in addition, owing to utilizing this visual attributes to screen control, therefore thereby draw the observable control of user, can improve validity that program is tested and targetedly.
For foregoing of the present invention can be become apparent, preferred embodiment cited below particularly, and coordinate appended graphicly, be described in detail below:
[accompanying drawing explanation]
Fig. 1 is the block diagram of program test device of the present invention;
Fig. 2 is the block diagram of test module in Fig. 1;
Fig. 3 and Fig. 4 are the process flow diagram of program testing method of the present invention.
[embodiment]
The explanation of following embodiment is graphic with reference to what add, can be in order to the specific embodiment of implementing in order to illustration the present invention.
In order to prevent in the process that program is tested, some unnecessary clicks (operation) also being tested, make for the test of program more targetedly, improve the testing efficiency of program, technical scheme of the present invention is as follows:
With reference to figure 1 and Fig. 2, Fig. 1 is the block diagram of program test device 10 of the present invention, and Fig. 2 is the block diagram of test module 104 in Fig. 1.
Program test device of the present invention comprises test module 104, time logging modle 103 and the first judge module 106.Test module 104 is electrically connected time logging modle 103, and time logging modle 103 is also electrically connected with the first judge module 106.Test module 104 is for selecting visual control from program and according to visual control acquisition methods attribute, and for program being tested and obtained according to method attribute the test reaction of program.It is more targeted and more efficient in order to make for the test of program from program, selecting visual control, reason is that the control that user only can see those is clicked or operated, and for some invisible controls, user there is no fear of clicking or operation, this just makes in the process that program is tested, some non-visual controls are tested and be there is no need, and first select visual control, and then visual control is tested, this can make this test produce effect and be efficient.Time logging modle 103 is for test start time and the test end time of logging program.The test start time of program and test end time are conducive to whether the test for program is met to pre-provisioning request and make better judgement.The first judge module 106 is for the working time of calculation procedure, and whether meets pre-provisioning request working time and generate the first judged result for judging, equals to test the poor of end time and test start time working time.Test module 104 also for stopping program testing when first judgment result is that meet pre-provisioning request working time.
Program test device 10 of the present invention also comprises startup control module 101 and the second judge module 102.Start control module 101 and the second judge module 102 electric connections, the second judge module 102 is also electrically connected with test module 104.Start control module 101 and start for control program, particularly, when needs are tested program, the program that control will be tested starts.Whether the second judge module 102 is corresponding with current interface and generate the second judged result for determining program.Whether on current interface, user is shown with the current corresponding program that refers in interface, and in preparing to receive the state of user's operation.Whether the program that judgement will be tested is corresponding with current interface is to be under the state being used and to test in program in order only to realize, if and under the state that program is no longer used, for example, under state in background process, user can the operation such as not click to it, therefore,, in order not do unnecessary test, need to guarantee that the program that will test is corresponding with current interface.Test module 104 is also for judgment result is that second program and current interface are at once testing program.Like this, effective during the test that just can guarantee to carry out for program, in addition, can also improve the efficiency of test.Time logging modle 103 is also for test start time of logging program.Test module 104 also for again testing program when first judgment result is that do not meet pre-provisioning request working time.
Program test device 10 of the present invention also comprises monitoring module 105.Monitoring module 105 is with test module 104, the first judge module 106 and start control module 101 electric connections.Whether monitoring module 105 is normal and generate monitored results for the test reaction of determining program, and the abnormal situation of test reaction can be collapse (Crash).It is in order to grasp in real time test result that the test reaction of program is monitored.Start control module 101 when also undesired for the test reaction that is program in monitored results control program restart.This is a protection technical scheme of in the present invention, program being tested.Record test end time when time logging modle 103 is also normal for the test reaction that is program in monitored results.
Test module 104 comprises acquisition module 1041, screening module 1042, selects module 1043 and trigger module 1044.Acquisition module 1041 is electrically connected with screening module 1042, and screening module 1042 is electrically connected with selecting module 1043, selects module 1043 to be also electrically connected with trigger module 1044.Acquisition module 1041 is for obtaining at least one control of program.This is situation about likely occurring in the process that program is tested for limit, all sidedly program is tested.Particularly, acquisition module 1041 is for obtaining the control of program according to Java reflex mechanism principle.Java reflex mechanism is dynamically obtaining information and the dynamically method of allocating object, the function of this Java reflex mechanism is: the object of constructing any one class when operation, judge member variable and method that any one class has, call any one method of any one object, judge the class that any one object is affiliated, generate dynamic proxy.Screening module 1042 is for filtering out visual control according to the visual attributes of at least one control from least one control.Visual attributes in control can be about the whether visual a kind of annotation of this control, utilizes this visual attributes to screen control, thereby draws the observable control of user, and then the validity that raising is tested program is with targeted.Select module 1043 for selecting the one of visual control, selecting module 1043 can be a random module of selecting, and this selects module to be used for selecting randomly the one of visual control at random.In addition, select module 1043 also for the father node from visual control, to start to travel through the parent node control of visual control till root node control.The parent node control that travels through visual control is in order to find out the attribute about parent node control, as method attribute, the method attribute can be click, longly click, double-click, drag, roll, the combination in any one or one one in input etc.Trigger module 1044 is for selecting a method attribute and utilizing method attribute trigger, and in fact, this is in analog subscriber clicking operation, in order that program is tested.Trigger module 1044 is also for obtaining the test reaction of program.
Program test device 10 of the present invention also comprises log pattern 107.Log pattern 107 is connected with monitoring module 105 telecommunications with the first judge module 106.Log pattern 107 is for the test log of logging program.
With reference to figure 3 and Fig. 4, the process flow diagram that Fig. 3 and Fig. 4 are program testing method of the present invention.Program testing method of the present invention is carried out by program test device.
In step 301, start control module 101 control programs and start, particularly, when needs are tested program, the program that control will be tested starts.
In step 302, whether the second judge module 102 determining programs are corresponding with current interface and generate the second judged result, if so, enter step 303, otherwise, turn back to step 301.Whether on current interface, user is shown with the current corresponding program that refers in interface, and in preparing to receive the state of user's operation.Whether the program that judgement will be tested is corresponding with current interface is to be under the state being used and to test in program in order only to realize, if and under the state that program is no longer used, for example, under state in background process, user can the operation such as not click to it, therefore,, in order not do unnecessary test, need to guarantee that the program that will test is corresponding with current interface.
In step 303, the test start time of time logging modle 103 logging programs.The test start time of program and test end time are conducive to whether the test for program is met to pre-provisioning request and make better judgement.
In step 304, to step 309, test module 104 is selected visual control and according to visual control acquisition methods attribute from program, and according to method attribute, program is tested and obtained the test reaction of program.It is more targeted and more efficient in order to make for the test of program from program, selecting visual control, reason is that the control that user only can see those is clicked or operated, and for some invisible controls, user there is no fear of clicking or operation, this just makes in the process that program is tested, some non-visual controls are tested and be there is no need, and first select visual control, and then visual control is tested, this can make this test produce effect and be efficient.
Particularly, in step 304, acquisition module 1041 obtains at least one control of program.This is situation about likely occurring in the process that program is tested for limit, all sidedly program is tested.Particularly, acquisition module 1041 obtains the control of program according to Java reflex mechanism principle.Java reflex mechanism is dynamically obtaining information and the dynamically method of allocating object, the function of this Java reflex mechanism is: the object of constructing any one class when operation, judge member variable and method that any one class has, call any one method of any one object, judge the class that any one object is affiliated, generate dynamic proxy.
In step 305, screening module 1042 filters out visual control from least one control according to the visual attributes of at least one control.Visual attributes in control can be about the whether visual a kind of annotation of this control, utilizes this visual attributes to screen control, thereby draws the observable control of user, and then the validity that raising is tested program is with targeted.
In step 306, the one of selecting module 1043 to select in visual control.Particularly, selecting module 1043 can be a random module of selecting, and this selects module to select randomly the one in visual control at random.
In step 307, select module 1043 from the father node of visual control, to start to travel through the parent node control of visual control till root node control.The parent node control that travels through visual control is in order to find out the attribute about parent node control, as method attribute, the method attribute can be click, longly click, double-click, drag, roll, the combination in any one or one one in input etc.
In step 308, trigger module 1044 is selected a method attribute and utilizes method attribute trigger, and in fact, this is in analog subscriber clicking operation, in order that program is tested.
In step 309, trigger module 1044 obtains the test reaction of program.
In step 310, whether the test reaction of monitoring module 105 determining programs is normal and generate monitored results, if so, enters step 312, otherwise, enter step 311.The abnormal situation of test reaction can be collapse (Crash).It is in order to grasp in real time test result that the test reaction of program is monitored.
In step 311, when test reaction that to start control module 101 be program in monitored results is undesired, control program restarts.This is a protection technical scheme of in the present invention, program being tested.
In step 312, record test end time when test reaction that time logging modle 103 is program in monitored results is normal.
In step 313, the working time of the first judge module 106 calculation procedures.
In step 314, the first judge module 106 judges whether meet pre-provisioning request working time and generate the first judged result, equal to test the end time working time and test the poor of start time, if, enter step 315, otherwise, turn back to step 304, that is, test module 104 is again tested program when first judgment result is that do not meet pre-provisioning request working time.
In step 315, test module 104 stops program testing when first judgment result is that meet pre-provisioning request working time.
In step 316, the test log of log pattern 107 logging programs, in fact, the test log of log pattern 107 logging programs is through the whole process of program test.
In sum; although the present invention discloses as above with preferred embodiment; but above preferred embodiment is not in order to limit the present invention; those of ordinary skill in the art; without departing from the spirit and scope of the present invention; all can do various changes and retouching, so the scope that protection scope of the present invention defines with claim is as the criterion.

Claims (20)

1. a program testing method, is characterized in that, said method comprising the steps of:
From program, select visual control and according to described visual control acquisition methods attribute, and described program is tested and obtained the test reaction of described program according to described method attribute;
Record test start time and the test end time of described program;
Calculate the working time of described program, and judge whether meet pre-provisioning request described working time and generate the first judged result, equal the poor of described test end time and described test start time described working time;
Described first, judgment result is that and while meeting described pre-provisioning request, stop described program to test described working time.
2. program testing method according to claim 1, is characterized in that, described method is further comprising the steps of:
Controlling described program starts;
Judge that described program is whether corresponding with current interface and generate the second judged result;
Described second, judgment result is that described program and current interface are at once testing described program;
Record the test start time of described program.
3. program testing method according to claim 1, is characterized in that, described method is further comprising the steps of:
Whether the test reaction that judges described program is normal and generate monitored results;
When the test reaction that is described program in described monitored results is undesired, control described restart routine;
The record test end time when test reaction that is described program in described monitored results is normal.
4. program testing method according to claim 1, is characterized in that, described method is further comprising the steps of:
Obtain at least one control of described program;
According to the visual attributes of described at least one control, from described at least one control, filter out visual control;
Select the one in described visual control;
Select a method attribute and utilize described method attribute to trigger described program, and the described test reaction that obtains described program.
5. program testing method according to claim 4, is characterized in that, described method is further comprising the steps of:
According to Java reflex mechanism principle, obtain the control of described program.
6. program testing method according to claim 4, is characterized in that, described method is further comprising the steps of:
Select randomly the one in described visual control.
7. program testing method according to claim 6, is characterized in that, described method is further comprising the steps of:
From the father node of described visual control, start to travel through the parent node control of described visual control till root node control.
8. program testing method according to claim 7, it is characterized in that, described method attribute is the attribute about described parent node control, described method attribute can be click, longly click, double-click, drag, roll, the combination in any one or one one in input etc.
9. program testing method according to claim 4, is characterized in that, described method is further comprising the steps of:
When described first judgment result is that do not meet described pre-provisioning request described working time, again described program is tested.
10. program testing method according to claim 1, is characterized in that, described method is further comprising the steps of:
Record the test log of described program.
11. 1 kinds of program test devices, is characterized in that, described device comprises:
Test module, for selecting visual control from program and according to described visual control acquisition methods attribute, and for described program being tested and obtained the test reaction of described program according to described method attribute;
Time logging modle, for recording test start time and the test end time of described program;
Whether the first judge module, for calculating the working time of described program, and meet pre-provisioning request described working time and generate the first judged result for judging, equals the poor of described test end time and described test start time described working time;
Described test module is described working time also for judgment result is that and stop described program to test while meeting described pre-provisioning request described first.
12. program test devices according to claim 11, is characterized in that, described device also comprises:
Start control module, for controlling described program, start;
Whether the second judge module is corresponding with current interface and generate the second judged result for judging described program;
Described test module is also for judgment result is that described second described program and current interface are at once testing described program;
Described time logging modle is also for recording the test start time of described program.
13. program test devices according to claim 11, is characterized in that, described device also comprises:
Whether monitoring module is normal and generate monitored results for the test reaction that judges described program;
When described startup control module is also undesired for the test reaction that is described program in described monitored results, control described restart routine;
Record test end time when described time logging modle is also normal for the test reaction that is described program in described monitored results.
14. program test devices according to claim 11, is characterized in that, described test module comprises:
Acquisition module, for obtaining at least one control of described program;
Screening module, for filtering out visual control according to the visual attributes of described at least one control from described at least one control;
Select module, for selecting the one of described visual control;
Trigger module, for selecting a method attribute and utilizing described method attribute to trigger described program, and for obtaining the described test reaction of described program.
15. program test devices according to claim 14, is characterized in that, described acquisition module is also for obtaining the control of described program according to Java reflex mechanism principle.
16. program test devices according to claim 14, is characterized in that, described selection module is also for selecting randomly the one of described visual control.
17. program test devices according to claim 16, is characterized in that, described selection module also starts to travel through till root node control the parent node control of described visual control for the father node from described visual control.
18. program test devices according to claim 17, it is characterized in that, described method attribute is the attribute about described parent node control, described method attribute can be click, longly click, double-click, drag, roll, the combination in any one or one one in input etc.
19. program test devices according to claim 14, is characterized in that, described test module also for again testing described program when described first judgment result is that do not meet described pre-provisioning request described working time.
20. program test devices according to claim 11, is characterized in that, described device also comprises:
Log pattern, for recording the test log of described program.
CN201210375517.XA 2012-09-29 2012-09-29 Program test device and method Active CN103713988B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210375517.XA CN103713988B (en) 2012-09-29 2012-09-29 Program test device and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210375517.XA CN103713988B (en) 2012-09-29 2012-09-29 Program test device and method

Publications (2)

Publication Number Publication Date
CN103713988A true CN103713988A (en) 2014-04-09
CN103713988B CN103713988B (en) 2018-01-26

Family

ID=50406988

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210375517.XA Active CN103713988B (en) 2012-09-29 2012-09-29 Program test device and method

Country Status (1)

Country Link
CN (1) CN103713988B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105095093A (en) * 2015-09-30 2015-11-25 上海斐讯数据通信技术有限公司 Intelligent terminal performance test method and system
CN109376067A (en) * 2018-08-15 2019-02-22 中国平安人寿保险股份有限公司 Monkey test method, device, electronic equipment and computer readable storage medium
CN111694735A (en) * 2020-05-28 2020-09-22 北京城市网邻信息技术有限公司 Page performance testing method and device, electronic equipment and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101620565B (en) * 2008-07-04 2012-05-09 福建升腾资讯有限公司 Method for automatically testing functions of terminal system
CN102279787B (en) * 2010-06-08 2015-06-17 腾讯科技(深圳)有限公司 Method and device for testing average fault-free time
CN102541728A (en) * 2010-12-14 2012-07-04 北京新媒传信科技有限公司 Method for expanding identifiable control of automatic test tool

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105095093A (en) * 2015-09-30 2015-11-25 上海斐讯数据通信技术有限公司 Intelligent terminal performance test method and system
CN109376067A (en) * 2018-08-15 2019-02-22 中国平安人寿保险股份有限公司 Monkey test method, device, electronic equipment and computer readable storage medium
CN111694735A (en) * 2020-05-28 2020-09-22 北京城市网邻信息技术有限公司 Page performance testing method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN103713988B (en) 2018-01-26

Similar Documents

Publication Publication Date Title
CN106445292B (en) Method and system for managing application programs in different body modes
CN102779094A (en) Terminal and software exception test method
CN106681701B (en) Task display method and device
CN107577415B (en) Touch operation response method and device
CN110912776A (en) Automatic fuzzy test method and device for entity router management protocol
CN109960642A (en) Automatic test approach and device
CN110505079A (en) For the visual system and method for multidimensional network based on context
CN111666217B (en) Method and apparatus for testing code
CN103198005A (en) Application program display method and device and electronic device
CN104978266A (en) Application test method and device
CN101930308A (en) Method and device for resetting drive circuit of touch input device
CN104346279A (en) Method and device for software testing
CN102646066B (en) Method and device for obtaining starting-up time
WO2017049893A1 (en) Application program testing method, testing apparatus, and mobile terminal
CN104820565B (en) Slide command processing method and terminal
CN111866160A (en) Multi-machine control method, device, equipment and storage medium
CN105808257B (en) Application popup identification method and device
CN103713988A (en) Program testing device and program testing method
CN104572137B (en) A kind of implementation method and device of NM client Acceleration of starting
CN101706752B (en) Method and device for in-situ software error positioning
CN103729258A (en) Automatic testing method, terminal and system
CN106484604B (en) Application test control method and device
CN103677518A (en) Method and device for responding to touch messages on mobile terminal
CN105095093A (en) Intelligent terminal performance test method and system
CN106980575A (en) A kind of event-handling method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant