CN104102574B - Applied program testing method and device - Google Patents
Applied program testing method and device Download PDFInfo
- Publication number
- CN104102574B CN104102574B CN201310117742.8A CN201310117742A CN104102574B CN 104102574 B CN104102574 B CN 104102574B CN 201310117742 A CN201310117742 A CN 201310117742A CN 104102574 B CN104102574 B CN 104102574B
- Authority
- CN
- China
- Prior art keywords
- source code
- code
- application program
- test
- application
- 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.)
- Active
Links
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The present invention relates to a kind of applied program testing method and device, its method includes:Tested application source code is obtained, based on the test script write in advance, precompile is carried out to tested application source code;Tested application source code after precompile is compiled, generates application program;Run the application program, output test information.The present invention is by precompile, according to the test script towards tangent plane programming, dynamically the debugging code of test is inserted in the source code of tested application program, when running application program, test information is exported based on debugging code, so as to according to test information to being positioned and quality metric using bugs, due to tested application source code need not be changed, therefore application product defect and performance risk will not be caused, while the Validity Test of application program is realized, the maintainability of tested code is improved.
Description
Technical field
The present invention relates to mobile internet technical field, more particularly to a kind of applied program testing method and device.
Background technology
At present, when testing Android application software, it will usually need tester by hand in tested application code
Middle one section of test code of insertion, when tested application program is run, refers to by test code output Debugging message or correlated performance
Mark, to position application software defect, measures the quality of application software.
But in existing this method of testing, be difficult to safeguard by the stake code manually inserted, because submitting and testing
Product defects and performance risk will certainly be caused about and with the unrelated code of product function.
The content of the invention
It is a primary object of the present invention to provide a kind of applied program testing method and device, it is intended to realize application program
Validity Test, improve the maintainability of tested code.
In order to achieve the above object, the present invention proposes a kind of applied program testing method, including:
Tested application source code is obtained, based on the test script write in advance, to the tested application program source generation
Code carries out precompile;
Tested application source code after precompile is compiled, generates application program;
Run the application program, output test information.
The present invention also proposes a kind of Application testing device, including:
Precompile module, for obtaining tested application source code, based on the test script write in advance, to the quilt
Survey application source code and carry out precompile;
Collector, for being compiled to the tested application source code after precompile, generate application program;
Output module, for running the application program, output test information.
A kind of applied program testing method and device proposed by the present invention, by precompile, being compiled according to towards section
The test script of journey, dynamically inserts the debugging code of test in the source code of tested application program, and journey is applied in operation
During sequence, test information is exported based on debugging code, so as to according to test information to being positioned and quality using bugs
Measurement, due to that need not change tested application source code, therefore will not cause application product defect and performance risk,
While the Validity Test of application program is realized, the maintainability of tested code is improved.
Brief description of the drawings
Fig. 1 is the schematic flow sheet of applied program testing method first embodiment of the present invention;
Fig. 2 is the schematic flow sheet of applied program testing method second embodiment of the present invention;
Fig. 3 is the schematic flow sheet of applied program testing method 3rd embodiment of the present invention;
Fig. 4 is the structural representation of Application testing device first embodiment of the present invention;
Fig. 5 is the structural representation of precompile module in Application testing device first embodiment of the present invention;
Fig. 6 is the structural representation of Application testing device second embodiment of the present invention;
Fig. 7 is the structural representation of Application testing device 3rd embodiment of the present invention.
In order that technical scheme is clearer, clear, it is described in further detail below in conjunction with accompanying drawing.
Embodiment
Solution for embodiment of the invention is mainly:Test application program is treated based on the test script towards tangent plane programming
Precompile is carried out, is dynamically inserted the debugging code of test in the source code of tested application program, in operation application program
When, test information is exported based on debugging code, so as to according to test information to being positioned and quality degree using bugs
Amount, due to that need not change tested application source code, therefore will not cause application product defect and performance risk, carry
The maintainability of high tested code.
As shown in figure 1, first embodiment of the invention proposes a kind of applied program testing method, including:
Step S101, tested application source code is obtained, based on the test script write in advance, to the tested application
Program source code carries out precompile;
In the present embodiment be tested application program include but be not limited to android system application program, the present embodiment with
Android system application program illustrates.
Wherein, tested application source code is carried out precompile and follow-up compilation process can by compiler come
Complete, the compiler can support AOP(Aspect Oriented Programming, towards tangent plane programming)Precompile
Compiler, such as ASM and Aspectj compilers etc..
In order to realize the test to application program, the present embodiment is encoded with test script previously according to towards tangent plane programming,
Include cutting into position information of the debugging code in tested application source code as test in the test script.
The test script write in advance is then based on, precompile is carried out to the tested application source code.Precompile
Refer to carry out some associative operations before the source code of compiler compiling application program.
Specifically, when carrying out precompile to the tested application source code, the test script is parsed first, from survey
Cutting into position information of the debugging code in tested application source code is obtained in training sheet, and then by debugging code according to institute
State in the tested application source code of cutting into position insertion.
Above-mentioned debugging code is one section of program code, and it can include the performance indications or correlation for test application program
Performance data, such as:Current time in system of the tested application program, memory size, cpu status, current application program are installed
Memory size of operation process and occupancy etc..
Step S102, the tested application source code after precompile is compiled, generates application program;
Tested application source code is compiled by compiler, its Compilation Method can use existing conventional answer
With program compilation scheme, will not be repeated here.
Step S103, run the application program, output test information.
The application program generated after precompile and compiling is attached to mobile terminal, on mobile terminals described in operation
Debugging code in the source code and the insertion application source code of application program;Thus, it is possible to according to the debugging
The operation result output test information such as related commissioning information or performance indications of code, such as:The tested application program is installed
Current time in system, memory size, cpu status, current application program run memory size of process and occupancy etc., follow-up to be
Can be according to test information to be positioned and quality metric using bugs.
The present embodiment is treated test application program based on the test script towards tangent plane programming and carried out in advance by such scheme
Compiling, dynamically the debugging code of test is inserted in the source code of tested application program, when running application program, be based on
Debugging code output test information, so as to according to test information to being positioned and quality metric using bugs, due to
Tested application source code need not be changed, therefore application product defect and performance risk will not be caused, is improved tested
Try the maintainability of code.
As shown in Fig. 2 second embodiment of the invention proposes a kind of applied program testing method, in above-mentioned first embodiment
On the basis of, also include before above-mentioned steps S101:
Step S100, the test script is write according to towards tangent plane programming.
The present embodiment and the difference of above-mentioned first embodiment are that the present embodiment also includes the preparation package of test script.
Specifically, test script can be write according to towards tangent plane programming, includes in the test script and used as test
Cutting into position information of the debugging code in tested application source code.Subsequently to the tested application source code
When carrying out precoding, the test script is parsed first, and debugging code is obtained from test script in tested application source code
In cutting into position information, and then debugging code is inserted in tested application source code according to the cutting into position.
The present embodiment uses towards tangent plane programming and writes test script, and the purpose mainly realized is to be directed to application program business
Section in processing procedure is extracted, and what it was faced is some step or the stage in processing procedure, to obtain logic mistake
In journey between each several part lower coupling isolation effect.
Compared to existing object-oriented or the preparation package of the test script of process, the present embodiment is used towards tangent plane programming
Write test script so that the maintainability of test script and application program is more preferable.
As shown in figure 3, third embodiment of the invention proposes a kind of applied program testing method, in above-mentioned first embodiment
On the basis of, also include after above-mentioned steps S103:
Step S104, the test information is analyzed, obtain test result.
The present embodiment and the difference of above-mentioned first embodiment are that the present embodiment is according to test acquisition of information test result
Scheme.
Specifically, after the test information of tested application program is got, for example get and the tested application program is installed
Current time in system, memory size, cpu status, the information such as memory size of current application program operation process and occupancy
Afterwards, tester the defects of fast positioning application software and can measure this and apply journey by analyzing the test information
The quality of sequence software, and corresponding counter-measure can be made, so as to improve the maintainability of application software.
As shown in figure 4, first embodiment of the invention proposes a kind of Application testing device, including:Precompile module
201st, collector 202 and result output module 203, wherein:
Precompile module 201, for obtaining tested application source code, based on the test script write in advance, to institute
State tested application source code and carry out precompile;
Collector 202, for being compiled to the tested application source code after precompile, generate application program;
Output module 203, for running the application program, output test information.
Application program is tested in the present embodiment to be included but is not limited to install android system application journey on mobile terminals
Sequence, the present embodiment are illustrated with android system application program.
Wherein, tested application source code is carried out precompile and follow-up compilation process can by compiler come
Complete, the compiler can support AOP(Aspect Oriented Programming, towards tangent plane programming)Precompile
Compiler, such as ASM and Aspectj compilers etc..
In order to realize the test to application program, the present embodiment is encoded with test script previously according to towards tangent plane programming,
Include cutting into position information of the debugging code in tested application source code as test in the test script.
Then precompile module 201 is carried out based on the test script write in advance to the tested application source code
Precompile.Precompile refers to carry out some associative operations before the source code of application program is compiled by compiler.
Specifically, when carrying out precompile to the tested application source code, the test script is parsed first, from survey
Cutting into position information of the debugging code in tested application source code is obtained in training sheet, and then by debugging code according to institute
State in the tested application source code of cutting into position insertion.
Above-mentioned debugging code is one section of program code, and it can include the performance indications or correlation for test application program
Performance data, such as:Current time in system of the tested application program, memory size, cpu status, current application program are installed
Memory size of operation process and occupancy etc..
Then collector 202 is compiled by compiler to tested application source code, and its Compilation Method can be with
Using existing conventional compiling of application scheme, will not be repeated here.
The application program generated after precompile and compiling is attached to mobile terminal by last output module 203, is being moved
The debugging code that the source code of the application program is run in dynamic terminal and is inserted in the application source code;Thus,
The test information such as related commissioning information or performance indications can be exported according to the operation result of the debugging code, such as:Installation
This is tested the current time in system of application program, memory size, cpu status, current application program operation process and occupancy
Memory size etc., subsequently can be according to test information to be positioned and quality metric using bugs.
Specifically, as shown in figure 5, the precompile module 201 can include:Resolution unit 2011 and insertion unit
2012, wherein:
Resolution unit 2011, for parsing the test script, debugging code is obtained in the application source code
Cutting into position;
Unit 2012 is inserted, for the debugging code to be inserted into the application source code according to the cutting into position
In.
The present embodiment is treated test application program based on the test script towards tangent plane programming and carried out in advance by such scheme
Compiling, dynamically the debugging code of test is inserted in the source code of tested application program, when running application program, be based on
Debugging code output test information, so as to according to test information to being positioned and quality metric using bugs, due to
Tested application source code need not be changed, therefore application product defect and performance risk will not be caused, is improved tested
Try the maintainability of code.
As shown in fig. 6, second embodiment of the invention proposes a kind of Application testing device, in above-mentioned first embodiment
On the basis of, in addition to:
Module 200 is write, for writing the test script according to towards tangent plane programming.
The present embodiment and the difference of above-mentioned first embodiment are that the present embodiment also includes the preparation package of test script.
Specifically, write module 200 and write test script according to towards tangent plane programming, include conduct in the test script
Cutting into position information of the debugging code of test in tested application source code.Subsequently to the tested application program
When source code carries out precoding, the test script is parsed first, and debugging code is obtained from test script in tested application program
Cutting into position information in source code, and then debugging code is inserted into tested application source code according to the cutting into position
In.
The present embodiment uses towards tangent plane programming and writes test script, and the purpose mainly realized is to be directed to application program business
Section in processing procedure is extracted, and what it was faced is some step or the stage in processing procedure, to obtain logic mistake
In journey between each several part lower coupling isolation effect.
Compared to existing object-oriented or the preparation package of the test script of process, the present embodiment is used towards tangent plane programming
Write test script so that the maintainability of test script and application program is more preferable.
As shown in fig. 7, third embodiment of the invention proposes a kind of Application testing device, in above-mentioned first embodiment
On the basis of, in addition to:
Analysis module 204, for analyzing the test information, obtain test result.
The present embodiment and the difference of above-mentioned first embodiment are that the present embodiment is according to test acquisition of information test result
Scheme.
Specifically, after the test information of tested application program is got, for example get and the tested application program is installed
Current time in system, memory size, cpu status, the information such as memory size of current application program operation process and occupancy
Afterwards, tester the defects of fast positioning application software and can measure this and apply journey by analyzing the test information
The quality of sequence software, and corresponding counter-measure can be made, so as to improve the maintainability of application software.
Applied program testing method of the embodiment of the present invention and device, by precompile, according to towards tangent plane programming
Test script, dynamically the debugging code of test is inserted in the source code of tested application program, when running application program,
Test information is exported based on debugging code, so as to according to test information to being positioned and quality metric using bugs,
Due to tested application source code need not be changed, therefore application product defect and performance risk will not be caused, in reality
While the Validity Test of existing application program, the maintainability of tested code is improved.
The preferred embodiments of the present invention are the foregoing is only, are not intended to limit the scope of the invention, every utilization
Equivalent structure or the flow conversion that description of the invention and accompanying drawing content are made, or directly or indirectly it is used in other related skills
Art field, is included within the scope of the present invention.
Claims (11)
- A kind of 1. applied program testing method, it is characterised in that including:Tested application source code is obtained, based on the test script write in advance, the tested application source code is entered Row precompile;Tested application source code after precompile is compiled, generates application program;Run the application program, output test information.
- 2. according to the method for claim 1, it is characterised in that it is described based on the test script write in advance, to the quilt Surveying the step of application source code carries out precompile includes:The test script is parsed, obtains cutting into position of the debugging code in the application source code;The debugging code is inserted in the application source code according to the cutting into position.
- 3. according to the method for claim 2, it is characterised in that the operation application program, export the step of testing information Including:The application program is attached to mobile terminal;The debugging code for running the source code of the application program and inserting in the application source code;Related commissioning information or performance indications are exported according to the operation result of the debugging code.
- 4. according to the method for claim 2, it is characterised in that the debugging code includes:System performance index and correlation Performance data.
- 5. according to the method any one of claim 1-4, it is characterised in that described to obtain tested application program source generation Code, based on the test script write in advance, to also including before the step of tested application source code progress precompile:The test script is write according to towards tangent plane programming.
- 6. according to the method any one of claim 1-4, it is characterised in that the operation application program, output test Also include after the step of information:The test information is analyzed, obtains test result.
- A kind of 7. Application testing device, it is characterised in that including:Precompile module,, should to described be tested based on the test script write in advance for obtaining tested application source code Precompile is carried out with program source code;Collector, for being compiled to the tested application source code after precompile, generate application program;Output module, for running the application program, output test information.
- 8. device according to claim 7, it is characterised in that the precompile module includes:Resolution unit, for parsing the test script, obtain incision position of the debugging code in the application source code Put;Unit is inserted, for the debugging code to be inserted in the application source code according to the cutting into position.
- 9. device according to claim 8, it is characterised in that the output module is additionally operable to install the application program To mobile terminal;The debugging code for running the source code of the application program and inserting in the application source code;Root Related commissioning information or performance indications are exported according to the operation result of the debugging code.
- 10. according to the device described in claim 7,8 or 9, it is characterised in that also include:Module is write, for writing the test script according to towards tangent plane programming.
- 11. according to the device described in claim 7,8 or 9, it is characterised in that also include:Analysis module, for analyzing the test information, obtain test result.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310117742.8A CN104102574B (en) | 2013-04-07 | 2013-04-07 | Applied program testing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310117742.8A CN104102574B (en) | 2013-04-07 | 2013-04-07 | Applied program testing method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104102574A CN104102574A (en) | 2014-10-15 |
CN104102574B true CN104102574B (en) | 2017-12-26 |
Family
ID=51670743
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310117742.8A Active CN104102574B (en) | 2013-04-07 | 2013-04-07 | Applied program testing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104102574B (en) |
Families Citing this family (17)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105095084B (en) * | 2015-08-25 | 2018-02-09 | 浪潮(北京)电子信息产业有限公司 | The virutal machine memory Performance Test System and method of a kind of server virtualization platform |
CN105847325B (en) * | 2016-03-14 | 2019-11-05 | 广州酷狗计算机科技有限公司 | The adjustment method and device of applications client |
CN106126449A (en) * | 2016-06-17 | 2016-11-16 | 山东超越数控电子有限公司 | A kind of serial ports reads the method for EC depositor |
CN105868118B (en) * | 2016-06-27 | 2018-09-11 | 北京奇虎科技有限公司 | Application testing method, apparatus and system |
CN107590066A (en) * | 2016-07-08 | 2018-01-16 | 广州市动景计算机科技有限公司 | Method of testing, equipment and the programmable device of application program |
CN106055485A (en) * | 2016-07-08 | 2016-10-26 | 北京奇虎科技有限公司 | Method, device and system for testing application |
CN106371994B (en) * | 2016-09-04 | 2018-11-13 | 南京理工大学 | Dynamic mobile APP test methods based on natural language processing |
CN107918583B (en) * | 2016-10-09 | 2021-01-19 | 腾讯科技(深圳)有限公司 | Script dynamic debugging method, device and terminal |
CN106528261A (en) * | 2016-12-02 | 2017-03-22 | 武汉斗鱼网络科技有限公司 | Application page initialization compiling and controlling device and method |
CN106844204B (en) * | 2017-01-11 | 2020-11-13 | 福建星网视易信息系统有限公司 | Method and system for generating defect report by using mobile terminal |
CN108572910A (en) * | 2017-03-14 | 2018-09-25 | 百度在线网络技术(北京)有限公司 | Experimental method and device for client |
CN109359023B (en) * | 2018-04-27 | 2020-01-24 | 哈尔滨工程大学 | Mobile application error positioning method based on submitted information |
CN108647142B (en) * | 2018-05-07 | 2021-10-01 | 杭州有赞科技有限公司 | Local pre-compiling and debugging method and system for Gatling voltage measurement footage |
CN112765032A (en) * | 2021-01-25 | 2021-05-07 | 广州市百果园网络科技有限公司 | Program debugging method, device, equipment and storage medium |
CN113626308A (en) * | 2021-07-06 | 2021-11-09 | 深圳点猫科技有限公司 | Code debugging method and device, electronic equipment and storage medium |
US11599455B2 (en) | 2021-07-08 | 2023-03-07 | Bank Of America Corporation | Natural language processing (NLP)-based cross format pre-compiler for test automation |
US11599454B2 (en) | 2021-07-08 | 2023-03-07 | Bank Of America Corporation | Natural language processing (NLP)-based cross format pre-compiler for test automation |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102053906A (en) * | 2009-10-30 | 2011-05-11 | 国际商业机器公司 | System and method for collecting program runtime information |
CN102799515A (en) * | 2011-05-24 | 2012-11-28 | 腾讯科技(深圳)有限公司 | Application program testing method and device |
-
2013
- 2013-04-07 CN CN201310117742.8A patent/CN104102574B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102053906A (en) * | 2009-10-30 | 2011-05-11 | 国际商业机器公司 | System and method for collecting program runtime information |
CN102799515A (en) * | 2011-05-24 | 2012-11-28 | 腾讯科技(深圳)有限公司 | Application program testing method and device |
Non-Patent Citations (1)
Title |
---|
使用 Rational Functional Tester 和 AOP 相结合测试 SWT 应用程序;宋政君等;《IBM developerWorks 中国》;20080506;第1-8页 * |
Also Published As
Publication number | Publication date |
---|---|
CN104102574A (en) | 2014-10-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104102574B (en) | Applied program testing method and device | |
US11151018B2 (en) | Method and apparatus for testing a code file | |
US8949792B2 (en) | Methods and systems for data service development | |
CN104407980B (en) | Mobile solution automatic test device and method | |
CN103902456B (en) | Test script processing meanss, system and method | |
Falke et al. | The bounded model checker LLBMC | |
JP2017097862A (en) | System and method for generation of automatic request for base test case for safety critical software | |
CN103049371A (en) | Testing method and testing device of Android application programs | |
CN106933609A (en) | The generation method and device of Android application program installation kits | |
CN107239398B (en) | Postman-based automatic interface test case generation system and method | |
US9317405B2 (en) | Test double generation | |
CN107704393A (en) | Data test method, apparatus and electronic equipment | |
CN103631705B (en) | A kind of regression testing method and device for search engine | |
CN104156311B (en) | A kind of embedded type C language target code level unit test method based on CPU emulator | |
CN107329889B (en) | Method for automatically testing C compiler | |
CN104536885A (en) | Method for generating Soc random verification platform | |
CN104102581B (en) | A kind of method and device for realizing unit testing | |
CN106649094A (en) | Test method based on EventViewer development process | |
CN107832176A (en) | Hard disk pressure automatic test approach and system under a kind of Windows | |
CN103309807B (en) | program testing method and platform | |
CN107797805A (en) | Code packaging method and device and computer readable storage medium | |
CN103838666B (en) | A kind of method and apparatus for determining code implementation coverage | |
CN102087629A (en) | Agent embedded software-based invariant test method and tool | |
CN104657267A (en) | Elastic source code syntax tree resolving system and method | |
CN105786465A (en) | Scripting language execution 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 |