CN101510170A - Test method for playing-back midlet life cycle event record - Google Patents
Test method for playing-back midlet life cycle event record Download PDFInfo
- Publication number
- CN101510170A CN101510170A CNA2009100108246A CN200910010824A CN101510170A CN 101510170 A CN101510170 A CN 101510170A CN A2009100108246 A CNA2009100108246 A CN A2009100108246A CN 200910010824 A CN200910010824 A CN 200910010824A CN 101510170 A CN101510170 A CN 101510170A
- Authority
- CN
- China
- Prior art keywords
- midlet
- playback
- record
- incident
- life cycle
- 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
Links
Images
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a method for testing record and playback of the MIDlet lifecycle events. The method adopts a code instrumentation manner to pack the original lifecycle events of MIDlet class, and after the recording code is injected, the MIDlet is operated to realize the recording to the lifecycle events; after the recording is finished, a playback thread is injected into the MIDlet class and then the MIDlet is operated again to sequentially and automatically trigger and trace the event sequence according to the recorded data content so as to complete the playback to the recorded events; and the playback result is compared with the recorded event sequence so as to complete the analysis to the test result. The invention realizes the method for automatically testing the record and the playback of the MIDlet lifecycle events for the first time, both the stability of the relevant changing sequence of MIDlet state in multiple times of operation and the operation consistency of the MIDlet in the transplantation among different types of equipment can be tested, and the user events can be conveniently recorded and played back together.
Description
Technical field
The present invention relates to a kind of method of testing of embedded software, relate in particular to the method for testing of MIDlet life cycle incident in a kind of Java ME embedded software.
Background technology
MIDlet is a kind of Java ME (Java Micro Edition) Application Type of the MIDP of meeting standard, is widely used on the mobile computing devices such as mobile phone, PDA.MIDlet is managed by AMS (being application manager).AMS is responsible for the operations such as installation, download, establishment, operation and deletion of MIDlet.When being managed by AMS, MIDlet can communicate by letter with AMS, the variation of the own state of notice AMS.A MIDlet has Active in its life cycle, Paused, three kinds of states of Destroyed, i.e. activity attitude, the attitude of suspending, destruction attitude.The event methods that the MIDlet life cycle is relevant has startApp, pauseApp, destroyApp, resumeRequest, notifyPaused and notifyDestroyed method.Be in the Paused state when a MIDlet just has been created, AMS can call the startApp method automatically in good time and enter the Active state subsequently.If discharge some resources to move other functions (making or move situations such as another MIDlet) temporarily such as phone is arranged in run duration AMS decision, AMS can call the pauseApp method makes MIDlet enter the Paused state, perhaps the user has called the notifyPaused method in program, also can notify AMS to make MIDlet enter the Paused state.At the Paused state, when AMS can directly call the startApp method in good time or receive the notice of resumeRequst method in the program, make MIDlet get back to the Active state from the Paused state.No matter be at Paused or Active state, AMS can directly call the destroyApp method or receive the notice of the notifyDestroy method in the program, makes MIDlet enter the Destroyed state.Though also can directly call the destroyApp/pauseApp method in the program, but can't cause the variation of MIDlet state, just can notify AMS when only in program, calling the notifyDestroyed/notifyPaused method, by the variation of AMS decision MIDlet state.
The management of MIDlet life cycle and the variation of state are very important in the true(-)running of MIDlet, if can carry out automatic record to the life cycle incident, and realize pressing the automatic playback of recorded content, just can realize testing the incident of MIDlet and state variation sequence easily whether in that repeatedly maintenance in service is reliable and stable; Particularly test and normally to move MIDlet is transplanted to prototype or is transplanted on the different equipment from simulator after; In addition, often also need cooperating of life cycle logout and playback in the interface detection of MIDlet.But because the restriction of MIDP standard realizes automatic record and playback not a duck soup to MIDlet life cycle incident.At present at the test frame of Java ME embedded software and instrument the J2MEUnit, the JMUnit that increase income and JTHarness etc. are arranged, business tool has Mobile JUnit etc.Yet in the Java ME software test means that current various testing tools and people adopt all not realization at the record playback function of life cycle incident.Therefore, realize that a kind of method of testing that MIDlet life cycle incident is write down playback is a urgent problem, have positive meaning.
Summary of the invention
The present invention is directed to the proposition of above problem, develop a kind of method of testing of the record playback to the MIDlet life cycle incident in the JavaME embedded software.It was made of logout, event replay and three stages of comparative analysis as a result; It wraps up life cycle event methods original in the MIDlet class respectively by the mode of code instrumentation with newly-built method, the mode of injecting record code therein realizes the record of life cycle incident; By injecting the playback thread, realization triggers automatically according to log file content order and follows the tracks of the execution sequence of events, finishes the playback of recording events; The result of automatic playback is compared with the sequence of events of record, finish the analysis of test result.Specifically may further comprise the steps:
1. write down the life cycle incident:
(1) location and backup MIDlet class to be revised;
(2) MIDlet class Central Plains life cycle event methods is wrapped up with new method respectively, inject record code, be modified as " record MIDlet ";
(3) start HTTP Server;
(4) start " record MIDlet ", will write down the result and be stored in local device and send to the preservation of Server end.
(5) the end record stage, close HTTP Server, the MIDlet class file that the duplicated record stage revises;
Specifically being characterized as of (2) wherein:
(a) for startApp, destroyApp, pauseApp method, take former method is renamed, rewrite new startApp then, destroyApp, the pauseApp method is wrapped in the former method after renaming wherein, and record code is injected in the position before former method call.
(b) and for notifyDestroyed and notifyPaused method, directly so it is wrapped in the newly-built method not of the same name accordingly, record code is injected in the position of calling in packaging method before notifyDestroyed and the notifyPaused method; And the position of calling the notifyDestroyed/notifyPaused method in program originally changes this newly-built method of calling into.
(c) do not keep a record for the resumeRequest method.
(d) record of life cycle incident can carry out in the lump with the record of customer incident.
2. playback life cycle incident:
(1) whether the inspection record file exists, if there be the carrying out that then continues playback phase;
(2) inject the playback code to the MIDlet class, be modified as " playback MIDlet ";
(3) start HTTP Server;
(4) start " playback MIDlet ", press log file content playback incident successively, playback result is issued the Server end and is preserved.
(5) finish playback phase, close HTTP Server, the MIDlet class file that the backup playback phase is revised recovers the MIDlet source file of initial backup;
Being characterized as of (2) wherein:
(a) at the last injection playback thread of building method body;
(b) startApp does not need additional triggers when playback, only needs to carry out when playback track record;
Do not have register user events during (c) as if record life cycle incident, then need the injecting program code to go to trigger and call destroyApp/pauseApp.If write down the words of customer incident, for what follow closely behind the destroyApp/pauseApp record row in the log file is the incident of notifyDestroyed/notifyPaused, then do not need other triggering, and trigger automatically during by the customer incident playback, only need when playback, carry out track record.
(d) injecting codes in pauseApp method body makes MIDlet can get back to the active state automatically from the paused state, or enters the destroyed state.
3. life cycle incident test result analysis:
In host side playback result and record session information are compared analyzing and processing, and the incident of generation test report.
Description of drawings
Fig. 1 is that implementation process flow process of the present invention is always schemed.
Fig. 2 is a life cycle logout process flow diagram flow chart.
Fig. 3 is a life cycle event replay process flow diagram flow chart.
Embodiment
In conjunction with Fig. 1-process flow diagram shown in Figure 3, specific implementation process of the present invention is described.
1. write down the life cycle incident:
(1) location and backup MIDlet class.
Locate MIDlet class (have a plurality of MIDlets in the MIDlet Suite application program, MIDlets is located out) by the mode of judging superclass;
The mode of source code is directly revised in employing in current MIDlet external member, do not build new test event in addition;
The MIDlet class file that the backup desire is revised, extension name changes .java-src into;
(2) life cycle event methods original in the MIDlet class is wrapped up with newly-built method respectively, inject record code, be modified as " record MIDlet ".
(a) for startApp, destroyApp, the pauseApp method is taked former method is renamed, newly-built startApp, destroyApp, the pauseApp method is wrapped in the former method after renaming wherein, and record code is injected in the position before former method call.
Do detailed description with the example that is revised as of startApp below, pauseApp, the destroyApp disposal route is similar with it.
Rename former startApp () method as private void orig$startApp (), rewrite new startApp () method, call orig$startApp () therein, calling the information that orig$startApp () the former startApp of preceding record () is activated.As follows:
Recorded information is with the plain text format record, and is every with CSV, and form is as follows:
Wherein timeStampNum is overall integer variable (logging timestamp), and every record once can add 1 to be handled.
Recorded information on depositing local device in, also to this recorded information be sent to server end and preserve in the http mode.Adopt the http mode to be because support the equipment of MIDP necessarily to support http, and modes such as socket, UDP are not necessarily supported.
(b) for notifyDestroyed and notifyPaused method, because these two methods are final methods, can not rewrite, so it is wrapped in the newly-built method not of the same name accordingly, as a following newly-built mynotifyDestroyed () method, former notifyDestroyed () method is directly wrapped up wherein, and record code is injected in the position before calling the notifyDestroyed method.
The position that also will call the notifyDestroyed/notifyPaused method in program originally changes this newly-built method of calling into, such as in the program notifyDestroyed () is called mynotifyDestroyed () instead.
The form of its recorded information (is example with notifyPaused) is as follows:
(c) do not keep a record for the resumeRequest method.Because after entering the paused state, program can only be handled asynchronous event, such as timers incident or callbacks incident.And when resumeRequest () was called, AMS can call startApp () automatically and carry out.Owing to write down startApp (), therefore resumeRequest () do not kept a record.
(d) record that the record of life cycle incident can same customer incident (interface operation incident) carries out together.If these incidents have all write down in the lump, just playback together in the playback thread of back.
After above modification, just obtain one " record MIDlet ".
(1) starts HTTP Server at server end (as host side).
(2) start " record MIDlet " in equipment end, along with user's the operation and the continuous variation of MIDlet incident and state, when recorded information constantly is stored in local device and send to HTTP Server end and preserve.
(3) the end record stage, close HTTP Server, the MIDlet class source file that the duplicated record stage revises is with its extension name .java-record more.
2. playback life cycle incident
(1) whether the inspection record file exists, if there be the carrying out that then continues playback phase, do not exist and then ejects information, and the prompting user finishes logout earlier.
(2) inject the playback code to the MIDlet class, be modified as " playback MIDlet ".
(a) at the last injection playback thread of building method body, this thread triggers the execution sequence of events in proper order according to the log file content.To in thread, choose beginning and initiatively carry out the time point of Event triggered, after startApp is finished, begin initiatively to carry out Event triggered again.
(b) startApp does not need to trigger when playback, carry out or call automatically during at the corresponding resumeRequest of AMS because startApp can be after just creating " playback MIDlet " example be called automatically by AMS, therefore do not need additional triggers, only need in the playback thread, startApp to be carried out track record;
The words that do not have register user events during (c) as if record life cycle incident, though in the log file be routine call or the destroyApp/pauseApp that AMS calls, all need when playback in the playback thread injecting program code to go to trigger and call destroyApp/pauseApp.As inject entering of following code playback Paused state:
If write down the words of customer incident, judge by the reading and recording file, for what follow closely behind the destroyApp/pauseApp record row in the log file is the incident of notifyDestroyed/notjfyPaused, illustrate that then this destroyApp/pauseApp calls in the program, trigger by customer incident, so in the playback thread, trigger automatically during by the customer incident playback, do not need to trigger in addition again, only need when playback, carry out track record.
(d) injecting codes in pauseApp method body makes MIDlet can get back to the active state automatically from the paused state, or enters the destroyed state.
Can enter the active state from the paused state, also can enter the destroyed state, need program code during playback and trigger this variation automatically.Can be by following algorithm injecting codes:
1. scan whole log file, it is the occurrence number of startApp that statistics follows closely after the pauseApp/notifyPaused, and it be 〉=0 integer, obtain then representing it with a constant NUM_PSTA; Statistics is the occurrence number b of destroyApp after following pauseApp/notifyPaused closely, b=0 or 1;
2. if b=0 injects following code in pauseApp (): use Timer to call resumeRequest ();
3. if b=1 then injects following code in pauseApp ():
(3) start HTTP Server at server end (as host side), what adopt when this Server and record is same.
(4) start " playback MIDlet " in equipment end, by log file content playback incident successively and write down playback result, playback result is issued the Server end and is preserved.
(5) finish playback phase, close HTTP Server, the MIDlet class source file that the backup playback phase is revised, with its extension name .java-record more, and the MIDlet source file that will back up at first to extension name .java-src reverts to .java.
3. life cycle incident test result analysis:
At host side difference reading and recording file and playback file, playback result and record session information are compared analysis.
By comparing line by line, can judge whether the whole life sequence of events is identical, if there is difference, whether the judgment part specified sequence is identical again;
The life cycle sequence of events relatively after, can from the incident change sequence, extract MIDlet state variation sequence and compare, judge whether unanimity;
In addition, if combine the record playback of customer incident (as the interface incident), just can combine assay surface Displayable change sequence, ItemStates change sequence, and the state variation that causes of a certain sequence of user events aspect such as unanimity whether;
The result of above comparative analysis can html format or the XML form make test report and preserve, check with for further analysis.
The above; only be the preferable embodiment of the present invention; but protection scope of the present invention is not limited thereto; anyly be familiar with those skilled in the art in the technical scope that the present invention discloses; be equal to replacement or change according to technical scheme of the present invention and inventive concept thereof, all should be encompassed within protection scope of the present invention.
Claims (5)
1, a kind of the life cycle incident of MIDlet is write down the method for testing of playback, it is characterized in that, may further comprise the steps:
A, will be behind the MIDlet class plug-in mounting record code start operation, the life cycle incident of all generations in the operational process of record MIDlet;
B, record stage will start operation, the life cycle incident in playback stage successively after finishing again behind the MIDlet class plug-in mounting playback code;
After C, playback are finished, playback result and record session information are compared analyzing and processing, generate the incident test report in host side.
2, according to claim 1ly a kind of the life cycle incident of MIDleL is write down the method for testing of playback, it is characterized in that the implementation of steps A has the following steps:
(1) location and backup MIDlet class to be revised;
(2) MIDlet class Central Plains life cycle event methods is wrapped up with new method respectively, inject record code, be modified as " record MIDlet ";
(3) start HTTP Server;
(4) start " record MIDlet ", will write down the result and be stored in local device and send to the preservation of Server end.
(5) the end record stage, close HTTP Server, the MIDlet class file that the duplicated record stage revises.
3, describedly a kind of the life cycle incident of MIDlet is write down the method for testing of playback according to claim 1 and 2, it is characterized in that there is following concrete feature in the step of (2) in the steps A:
(a) for startApp, destroyApp, pauseApp method, take former method is renamed, rewrite new startApp then, destroyApp, the pauseApp method is wrapped in the former method after renaming wherein, and record code is injected in the position before former method call;
(b) and for notifyDestroyed and notifyPaused method, directly so it is wrapped in the newly-built method not of the same name accordingly, record code is injected in the position of calling in packaging method before notifyDestroyed and the notifyPaused method; And the position of calling the notifyDestroyed/notifyPaused method in program originally changes this newly-built method of calling into;
(c) do not keep a record for the resumeRequest method;
(d) record of life cycle incident can carry out in the lump with the record of customer incident.
4, according to claim 1ly a kind of the life cycle incident of MIDlet is write down the method for testing of playback, it is characterized in that the implementation of step B has the following steps:
(1) whether the inspection record file exists, if there be the carrying out that then continues playback phase;
(2) inject the playback code to the MIDlet class, be modified as " playback MIDlet ";
(3) start HTTP Server;
(4) start " playback MIDlet ", press log file content playback incident successively, playback result is issued the Server end and is preserved;
(5) finish playback phase, close HTTP Server, the MIDlet class file that the backup playback phase is revised recovers the MIDlet source file of initial backup.
5, describedly a kind of the life cycle incident of MIDlet is write down the method for testing of playback according to claim 1 and 4, its feature is that also there is following concrete feature in the step of (2) among the step B:
(a) at the last injection playback thread of building method body;
(b) startApp does not need additional triggers when playback, only needs to carry out when playback track record;
Do not have register user events during (c) as if record life cycle incident, then need the injecting program code to go to trigger and call destroyApp/pauseApp.If write down the words of customer incident, for what follow closely behind the destroyApp/pauseApp record row in the log file is the incident of notifyDestroyed/notifyPaused, then do not need other triggering, and trigger automatically during by the customer incident playback, only need when playback, carry out track record;
(d) injecting codes in pauseApp method body makes MIDlet can get back to the active state automatically or enter the destroyed state from the paused state.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNA2009100108246A CN101510170A (en) | 2009-03-21 | 2009-03-21 | Test method for playing-back midlet life cycle event record |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNA2009100108246A CN101510170A (en) | 2009-03-21 | 2009-03-21 | Test method for playing-back midlet life cycle event record |
Publications (1)
Publication Number | Publication Date |
---|---|
CN101510170A true CN101510170A (en) | 2009-08-19 |
Family
ID=41002573
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CNA2009100108246A Pending CN101510170A (en) | 2009-03-21 | 2009-03-21 | Test method for playing-back midlet life cycle event record |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101510170A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102708049A (en) * | 2012-04-21 | 2012-10-03 | 北京迈凯互动网络科技有限公司 | Method and system for recording and replaying test results of mobile application |
CN103425583A (en) * | 2013-08-25 | 2013-12-04 | 浙江大学 | Tracking and replaying method of multi-DSP (Digital Signal Processor) parallel system |
CN104503893A (en) * | 2014-12-22 | 2015-04-08 | 上海斐讯数据通信技术有限公司 | Activity state information storage and analysis methods in android system, and electronic terminal |
-
2009
- 2009-03-21 CN CNA2009100108246A patent/CN101510170A/en active Pending
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102708049A (en) * | 2012-04-21 | 2012-10-03 | 北京迈凯互动网络科技有限公司 | Method and system for recording and replaying test results of mobile application |
CN102708049B (en) * | 2012-04-21 | 2015-11-18 | 北京云测信息技术有限公司 | Mobile solution test result record and back method and system |
CN103425583A (en) * | 2013-08-25 | 2013-12-04 | 浙江大学 | Tracking and replaying method of multi-DSP (Digital Signal Processor) parallel system |
CN103425583B (en) * | 2013-08-25 | 2016-06-01 | 浙江大学 | The tracking of a kind of multi-DSP parallel system and back method |
CN104503893A (en) * | 2014-12-22 | 2015-04-08 | 上海斐讯数据通信技术有限公司 | Activity state information storage and analysis methods in android system, and electronic terminal |
CN104503893B (en) * | 2014-12-22 | 2018-01-30 | 上海斐讯数据通信技术有限公司 | The preservation of Activity status informations, analytic method and electric terminal in a kind of android systems |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7165191B1 (en) | Automated verification of user interface tests on low-end emulators and devices | |
CN101521899B (en) | System and method for on-computer test of mobile applications | |
CN101175284B (en) | Function testing method of portable electronic apparatus | |
CN100562033C (en) | A kind of automated test tool of stored-program control exchange and method | |
CN103186740B (en) | A kind of automated detection method of Android malware | |
CN107704375A (en) | A kind of system and method recorded and play back network port upstream data | |
JP2006018827A (en) | Smart user interface record and reproduction framework | |
CN103729294B (en) | Method and device for testing performance script of application software | |
CN201392526Y (en) | Onboard test system for mobile applications | |
US20070220481A1 (en) | Limited source code regeneration based on model modification | |
CN101137170A (en) | Software automatic testing instrument and method of embedded equipment | |
CN104766007A (en) | Method for quickly recovering sandbox based on file system filter driver | |
CN103577309A (en) | Automatic test method and device | |
CN102999419B (en) | A kind of Android test incident record back method and device | |
CN105512044A (en) | Method and system for updating object base used for keyword drive test | |
CN109344071A (en) | The method for automatically generating LoadRunner performance test script | |
CN107608663A (en) | A kind of development approach and device of Mobile solution plug-in unit and Mobile solution | |
CN101510170A (en) | Test method for playing-back midlet life cycle event record | |
Zhifang et al. | Test automation on mobile device | |
CN111930703A (en) | Automatic log file capturing method and device and computer equipment | |
CN102025555B (en) | Method and device for testing IP multimedia sub-system performance | |
CN106649000A (en) | Fault recovery method for real-time processing engine, and corresponding server | |
TW201217966A (en) | Method and apparatus for off-line analyzing crashed programs | |
CN110633199A (en) | Testing apparatus, method, and medium for block chain supporting intelligent contract | |
CN111382424A (en) | Mobile application sensitive behavior detection method and system based on controlled environment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C02 | Deemed withdrawal of patent application after publication (patent law 2001) | ||
WD01 | Invention patent application deemed withdrawn after publication |
Open date: 20090819 |