CN108170600A - The coverage rate statistical method of front-end code test, apparatus and system - Google Patents
The coverage rate statistical method of front-end code test, apparatus and system Download PDFInfo
- Publication number
- CN108170600A CN108170600A CN201711457933.3A CN201711457933A CN108170600A CN 108170600 A CN108170600 A CN 108170600A CN 201711457933 A CN201711457933 A CN 201711457933A CN 108170600 A CN108170600 A CN 108170600A
- Authority
- CN
- China
- Prior art keywords
- test
- coverage rate
- file
- code
- coverage
- 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
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3676—Test management for coverage analysis
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a kind of front-end code test coverage rate statistical method, including:Test instruction is received, and corresponding test application file is obtained according to the test instruction received;The file content of the test application file is read, each testing procedure is reappeared, and be sent to front end data library with obtained test result generation coverage rate file and preserve according to the file content;Read the file content output coverage data of the coverage rate file.The invention also discloses the coverage rate statistic devices and system of a kind of test of front-end code.The present invention realizes the advantageous effect for performing testing procedure and counting coverage data by fixed testing process and test application file.
Description
Technical field
The present invention relates to field of program development more particularly to a kind of coverage rate statistical method of front-end code test, devices
And system.
Background technology
It is existing in order to obtain the coverage rate test data of IOS (Mobile operating system of Apple Inc.'s exploitation) front-end code
It needs to carry out manual configuration code in systems in technology, to collect local coverage data.It is configured operating procedure compared with
To be cumbersome, and in the case of more than local source quantity of documents, the configuration step of the prior art can block UI threads, and system is caused to collapse
It bursts.In this way, code tester can not be realized, it can not also be collected into the coverage rate test data of this test.
The above is only used to facilitate the understanding of the technical scheme, and is not represented and is recognized that the above is existing skill
Art.
Invention content
It is a primary object of the present invention to provide a kind of coverage rate statistical method of front-end code test, it is intended to solve existing
Technology in configuration testing code in performing code tester, due to source file quantity excessively cause configuration step obstruction UI threads after
And the technical issues of can not being collected into test coverage data after leading to system crash.
To achieve the above object, the present invention provides a kind of coverage rate statistical method of front-end code test, including following interior
Hold:
Test instruction is received, and corresponding test application file is obtained according to the test instruction received;
The file content of the test application file is read, according to each testing procedure of file content reproduction, and with
Obtained test result generation coverage rate file is sent to the preservation of front end data library;
Read the file content output coverage data of the coverage rate file
Preferably, it is described to receive test instruction, and corresponding test application is obtained according to the test instruction received
Before the step of file, further include:
Code tester demand is obtained, and corresponding test application file is generated with the code tester demand.
Preferably, it described the step of corresponding test application file is generated with the code tester demand, specifically includes:
Extraction code corresponding with the code tester demand, the Embedded test configuration code in the code, generation are surveyed
Try application file.
Preferably, the step of file content for reading the coverage rate file exports coverage data, specifically includes:
The coverage rate information in the coverage rate file is extracted, the coverage rate information is input to unit testing coverage rate
Statistic algorithm calculates the coverage data.
Preferably, it before the step of coverage rate information in the extraction coverage rate file, further includes:
Coverage rate statistics instruction is received, lookup stores the coverage rate file into the front end data library, and by described in
Coverage rate file copy is to the region for storing the unit testing coverage rate statistic algorithm.
Preferably, the coverage rate statistical method of the front-end code test, further includes:
User login information is obtained, and after confirming that the user logins successfully, perform and receive test instruction, and according to connecing
The step of test instruction received obtains test application file.
In addition, to achieve the above object, it is described the present invention also provides a kind of coverage rate statistic device of front-end code test
The coverage rate statistic device of front-end code test includes:It memory, processor and is stored on the memory and can be described
The computer program run on processor, the computer program realize front-end code as described above when being performed by the processor
The step of coverage rate statistical method of test.
The present invention also provides a kind of coverage rate statistical system of front-end code test, the coverage rate of the front-end code test
Statistical system includes the step of coverage rate statistical method of front-end code as described above test.
The coverage rate statistical method of a kind of front-end code test that the embodiment of the present invention proposes, by receiving test instruction,
And corresponding test application file is obtained according to the test instruction received;In the file for reading the test application file
Hold, each testing procedure is reappeared according to the file content, and before being sent to obtained test result generation coverage rate file
Client database preserves;Read the file content output coverage data of the coverage rate file.Pass through generated test application
File realizes the coverage data storage of program test, and preserves into front end data, and pass through and obtain coverage data and unite
Count the information of coverage data, the unified testing procedure of realization and the advantageous effect for improving coverage data collection efficiency.
Description of the drawings
Fig. 1 be the hardware running environment that the embodiment of the present invention is related to terminal apparatus structure schematic diagram;
Fig. 2 is the flow diagram of the coverage rate statistical method first embodiment of front-end code of the present invention test;
Fig. 3 is across the function flow schematic diagram of the coverage rate statistical system of front-end code of the present invention test.
The embodiments will be further described with reference to the accompanying drawings for the realization, the function and the advantages of the object of the present invention.
Specific embodiment
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
The primary solutions of the embodiment of the present invention are:Test instruction is received, and is instructed according to the test received
Obtain corresponding test application file;The file content of the test application file is read, is reappeared according to the file content each
A testing procedure, and front end data library is sent to obtained test result generation coverage rate file and is preserved;Read the covering
The file content output coverage data of rate file.
Since the prior art is in code tester in realizing program, manual configuration is needed to test code, if but local source file
Quantity it is excessive when, be easy to cause configuration step obstruction UI threads lead to system crash.In this way, test coverage just cannot be collected
Data, and realize the testing requirement of code tester.
The present invention provides a solution, by fixed testing procedure and unified generation test application file, realizes, has
Beneficial effect.
As shown in Figure 1, the terminal structure schematic diagram for the hardware running environment that Fig. 1, which is the embodiment of the present invention, to be related to.
Terminal of the embodiment of the present invention can be PC or smart mobile phone, tablet computer, E-book reader, portable
Computer etc. has the packaged type terminal device of display function.
As shown in Figure 1, the terminal can include:Processor 1001, such as CPU, network interface 1004, user interface
1003, memory 1005, communication bus 1002.Wherein, communication bus 1002 is used to implement the connection communication between these components.
User interface 1003 can include display screen (Display), input unit such as keyboard (Keyboard), optional user interface
1003 can also include standard wireline interface and wireless interface.Network interface 1004 can optionally connect including the wired of standard
Mouth, wireless interface (such as WI-FI interfaces).Memory 1005 can be high-speed RAM memory or the memory of stabilization
(non-volatile memory), such as magnetic disk storage.Memory 1005 optionally can also be independently of aforementioned processor
1001 storage device.
It will be understood by those skilled in the art that the restriction of the terminal structure shown in Fig. 1 not structure paired terminal, can wrap
It includes and either combines certain components or different components arrangement than illustrating more or fewer components.
As shown in Figure 1, it can lead to as in a kind of memory 1005 of computer storage media including operating system, network
Believe the coverage rate statistics application program of module, Subscriber Interface Module SIM and front-end code test.
In terminal shown in Fig. 1, network interface 1004 is mainly used for connecting background server, is carried out with background server
Data communicate;User interface 1003 is mainly used for connecting client (user terminal), with client into row data communication;And processor
1001 can be used for calling the coverage rate statistics application program of front-end code test stored in memory 1005, and perform following
Operation:
Test instruction is received, and corresponding test application file is obtained according to the test instruction received;
The file content of the test application file is read, according to each testing procedure of file content reproduction, and with
Obtained test result generation coverage rate file is sent to the preservation of front end data library;
Read the file content output coverage data of the coverage rate file
Further, processor 1001 can call the coverage rate statistics that the front-end code stored in memory 1005 is tested
Application program also performs following operate:
Code tester demand is obtained, and corresponding test application file is generated with the code tester demand.
Further, processor 1001 can call the coverage rate statistics that the front-end code stored in memory 1005 is tested
Application program also performs following operate:
Extraction code corresponding with the code tester demand, the Embedded test configuration code in the code, generation are surveyed
Try application file.
Further, processor 1001 can call the coverage rate statistics that the front-end code stored in memory 1005 is tested
Application program also performs following operate:
The coverage rate information in the coverage rate file is extracted, the coverage rate information is input to unit testing coverage rate
Statistic algorithm calculates the coverage data.
Further, processor 1001 can call the coverage rate statistics that the front-end code stored in memory 1005 is tested
Application program also performs following operate:
Coverage rate statistics instruction is received, lookup stores the coverage rate file into the front end data library, and by described in
Coverage rate file copy is to the region for storing the unit testing coverage rate statistic algorithm.
Further, processor 1001 can call the coverage rate statistics that the front-end code stored in memory 1005 is tested
Application program also performs following operate:
User login information is obtained, and after confirming that the user logins successfully, perform and receive test instruction, and according to connecing
The step of test instruction received obtains test application file.
With reference to Fig. 2, Fig. 2 is the flow signal of the coverage rate statistical method first embodiment of front-end code of the present invention test
Figure, the coverage rate statistical method of the front-end code test include:
Step S10 receives test instruction, and obtains corresponding test application text according to the test instruction received
Part;
Based on current program development demand, in described program development process or after program development, reception is based on
The test instruction of described program exploitation, and based on the test instruction received, obtain corresponding with the test instruction
Test application file.The test application file, to be based on the testing requirement, the file for test being generated in advance,
Its file content is related to the testing requirement of described program exploitation.
Further, it is described to receive test instruction, and according to the corresponding test of test instruction acquisition received
Before the step of file, further include:
Code tester demand is obtained, and corresponding test application file is generated with the code tester demand.
Extraction code corresponding with the code tester demand, the Embedded test configuration code in the code, generation are surveyed
Try application file.
Based on current program development testing requirement, the configuration code of described program exploitation test is embedded in corresponding survey
It tries in code, and based on the test code for having been inserted into the test code, generation test application corresponding with the test code
File.It, need to be related to corresponding code content to be tested when generating the test application file.And it is embedded in the test generation
The embedded mode of the configuration code of code, it is consistent with the content of the manual configuration code of existing code tester.
In addition, the coverage rate statistical method of the front-end code test, further includes:
User login information is obtained, and after confirming that the user logins successfully, perform and receive test instruction, and according to connecing
The step of test instruction received obtains test application file.
Step S20 reads the file content of the test application file, reappears each test step according to the file content
Suddenly, and front end data library is sent to obtained test result generation coverage rate file to preserve;
Based on the test application file got, the testing procedure of described program exploitation, the test step are performed
Suddenly, the test content to be arrived applied in present procedure exploitation.Then it according to the test application file got, performs
The testing procedure, and the test result obtained based on the testing procedure generate coverage rate file, and the coverage rate is literary
Part is sent in the front end data library relevant with the corresponding tool of described program exploitation and preserves, the front end data library, fixed
Justice is web server.
Step S30 reads the file content output coverage data of the coverage rate file.
Based on having preserved the content that the coverage rate file in the front end data library, copies the coverage rate file, and
Based on the coverage rate file copied to, read the fileinfo of the coverage rate file and export the coverage rate of this test
Data.
Wherein, the step of file content for reading the coverage rate file exports coverage data, specifically includes:
The coverage rate information in the coverage rate file is extracted, the coverage rate information is input to unit testing coverage rate
Statistic algorithm calculates the coverage data.
Based on the coverage rate file having been copied into, the preset unit testing of the coverage rate file input value is covered
Rate statistical mechanism, the unit testing coverage rate statistical mechanism are a kind of existing tool of computing unit test coverage, will
In the tool of unit testing coverage rate described in the coverage rate file input value copied to, the text of the coverage rate file is read
Part content generates the coverage rate information of the test code, is that the test code exists because being recorded in the coverage rate file
The coverage rate information tested respectively in each testing procedure, i.e., described coverage rate information is dispersion, therefore, based on the covering
Rate information will generate total coverage data after each coverage rate information synthesis of dispersion and export to corresponding region.
Further, it before the step of coverage rate information in the extraction coverage rate file, further includes:
Coverage rate statistics instruction is received, lookup stores the coverage rate file into the front end data library, and by described in
Coverage rate file copy is to the region for storing the unit testing coverage rate statistic algorithm.
Before the coverage rate file in copying the front end data library, coverage rate statistics instruction is received, because of the front end
Database has connection relation with the program development tools for performing the testing requirement and testing procedure, i.e., by coverage rate text
When part is sent to the front end data library, there are the addresses for storing the coverage rate file.Counting this test code
During coverage rate, coverage rate statistics instruction is issued to the developing instrument where the test code, is referred to based on coverage rate statistics
The storage address for reading the stored coverage rate file is enabled, the coverage rate file is copied and is covered to the unit testing is stored
The corresponding region of lid rate statistic algorithm, and the coverage rate information extracted in the coverage rate file is performed, the coverage rate is believed
The step of breath is input in unit testing coverage rate statistic algorithm, calculates the coverage data.
In the present embodiment, by the embedding code of the coverage rate test built and the test copy flow of completion, journey is realized
Sequence publishes packing automation, realizes the advantageous effect efficiently counted based on coverage rate test in program development process.
In addition, the present invention also proposes a kind of coverage rate statistical system of front-end code test, the front-end code test
Coverage rate statistical system can refer to Fig. 3, and Fig. 3 is showing across function flow for the coverage rate statistical system of front-end code of the present invention test
Client utility where the step of being intended to, being realized including test and operating procedure, concrete implementation process, as described above
The content of embodiment that the coverage rate statistical method of front-end code test is realized is consistent.
It should be noted that herein, term " comprising ", "comprising" or its any other variant are intended to non-row
His property includes, so that process, method, article or system including a series of elements not only include those elements, and
And it further includes other elements that are not explicitly listed or further includes intrinsic for this process, method, article or system institute
Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including this
Also there are other identical elements in the process of element, method, article or system.
The embodiments of the present invention are for illustration only, do not represent the quality of embodiment.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side
Method can add the mode of required general hardware platform to realize by software, naturally it is also possible to by hardware, but in many cases
The former is more preferably embodiment.Based on such understanding, technical scheme of the present invention substantially in other words does the prior art
Going out the part of contribution can be embodied in the form of software product, which is stored in one as described above
In storage medium (such as ROM/RAM, magnetic disc, CD), including some instructions use so that a station terminal equipment (can be mobile phone,
Computer, server, air conditioner or network equipment etc.) perform method described in each embodiment of the present invention.
It these are only the preferred embodiment of the present invention, be not intended to limit the scope of the invention, it is every to utilize this hair
The equivalent structure or equivalent flow shift that bright specification and accompanying drawing content are made directly or indirectly is used in other relevant skills
Art field, is included within the scope of the present invention.
Claims (8)
- A kind of 1. coverage rate statistical method of front-end code test, which is characterized in that the coverage rate system of the front-end code test Meter method includes the following steps:Test instruction is received, and corresponding test application file is obtained according to the test instruction received;The file content of the test application file is read, each testing procedure is reappeared, and to obtain according to the file content Test result generation coverage rate file be sent to front end data library preservation;Read the file content output coverage data of the coverage rate file.
- 2. the coverage rate statistical method of front-end code test as described in claim 1, which is characterized in that the reception test refers to Before the step of enabling, and corresponding test application file is obtained according to the test instruction received, further include:Code tester demand is obtained, and corresponding test application file is generated with the code tester demand.
- 3. the coverage rate statistical method of front-end code test as claimed in claim 2, which is characterized in that described to be surveyed with the code Examination demand generates the step of corresponding test application file, specifically includes:Extraction code corresponding with the code tester demand, the Embedded test configuration code in the code, generation test should Use file.
- 4. the coverage rate statistical method of front-end code test as described in claim 1, which is characterized in that described to read the covering It the step of file content output coverage data of rate file, specifically includes:The coverage rate information in the coverage rate file is extracted, the coverage data is calculated according to the coverage rate information.
- 5. the coverage rate statistical method of front-end code test as described in claim 1, which is characterized in that the extraction covering Before the step of coverage rate information in rate file, further include:Coverage rate statistics instruction is received, lookup stores the coverage rate file into the front end data library, and cover described Lid rate file copy is to the region for storing the unit testing coverage rate statistic algorithm.
- 6. the coverage rate statistical method that the front-end code as described in any one of claim 1 to 5 is tested, which is characterized in that before described The coverage rate statistical method of code tester is held, is further included:User login information is obtained, and after confirming that the user logins successfully, perform and receive test instruction, and according to receiving The test instruction obtain test application file the step of.
- A kind of 7. coverage rate statistic device of front-end code test, which is characterized in that the coverage rate system of the front-end code test Counter device includes:Memory, processor and it is stored in the computer journey that can be run on the memory and on the processor Sequence realizes that front-end code is tested as described in any one of claim 1 to 6 when the computer program is performed by the processor Coverage rate statistical method the step of.
- A kind of 8. coverage rate statistical system of front-end code test, which is characterized in that the coverage rate system of the front-end code test Meter systems include the step of coverage rate statistical method such as front-end code according to any one of claims 1 to 6 test.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711457933.3A CN108170600A (en) | 2017-12-27 | 2017-12-27 | The coverage rate statistical method of front-end code test, apparatus and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711457933.3A CN108170600A (en) | 2017-12-27 | 2017-12-27 | The coverage rate statistical method of front-end code test, apparatus and system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108170600A true CN108170600A (en) | 2018-06-15 |
Family
ID=62519356
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711457933.3A Pending CN108170600A (en) | 2017-12-27 | 2017-12-27 | The coverage rate statistical method of front-end code test, apparatus and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108170600A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109992511A (en) * | 2019-03-25 | 2019-07-09 | 口碑(上海)信息技术有限公司 | Obtain the device and method of code tester coverage rate |
CN110471850A (en) * | 2019-08-09 | 2019-11-19 | 锐捷网络股份有限公司 | Code coverage test method and device |
CN111104333A (en) * | 2019-12-20 | 2020-05-05 | 广州品唯软件有限公司 | Coverage rate test method, test device and computer readable storage medium |
CN111651346A (en) * | 2020-04-27 | 2020-09-11 | 平安医疗健康管理股份有限公司 | Method and device for testing front-end component, storage medium and computer equipment |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103631707A (en) * | 2012-08-27 | 2014-03-12 | 腾讯科技(深圳)有限公司 | Method and device for obtaining code coverage rate |
CN105446884A (en) * | 2015-12-16 | 2016-03-30 | 北京奇虎科技有限公司 | Code coverage rate test method and apparatus |
CN105630671A (en) * | 2015-12-16 | 2016-06-01 | 北京奇虎科技有限公司 | Code coverage rate report generation method and device |
US20160292068A1 (en) * | 2012-02-14 | 2016-10-06 | Alibaba Group Holding Limited | Code coverage rate determination method and system |
-
2017
- 2017-12-27 CN CN201711457933.3A patent/CN108170600A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20160292068A1 (en) * | 2012-02-14 | 2016-10-06 | Alibaba Group Holding Limited | Code coverage rate determination method and system |
CN103631707A (en) * | 2012-08-27 | 2014-03-12 | 腾讯科技(深圳)有限公司 | Method and device for obtaining code coverage rate |
CN105446884A (en) * | 2015-12-16 | 2016-03-30 | 北京奇虎科技有限公司 | Code coverage rate test method and apparatus |
CN105630671A (en) * | 2015-12-16 | 2016-06-01 | 北京奇虎科技有限公司 | Code coverage rate report generation method and device |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109992511A (en) * | 2019-03-25 | 2019-07-09 | 口碑(上海)信息技术有限公司 | Obtain the device and method of code tester coverage rate |
CN109992511B (en) * | 2019-03-25 | 2022-11-22 | 口碑(上海)信息技术有限公司 | Device and method for obtaining code test coverage rate |
CN110471850A (en) * | 2019-08-09 | 2019-11-19 | 锐捷网络股份有限公司 | Code coverage test method and device |
CN110471850B (en) * | 2019-08-09 | 2022-12-13 | 锐捷网络股份有限公司 | Code coverage rate testing method and device |
CN111104333A (en) * | 2019-12-20 | 2020-05-05 | 广州品唯软件有限公司 | Coverage rate test method, test device and computer readable storage medium |
CN111651346A (en) * | 2020-04-27 | 2020-09-11 | 平安医疗健康管理股份有限公司 | Method and device for testing front-end component, storage medium and computer equipment |
CN111651346B (en) * | 2020-04-27 | 2022-11-18 | 深圳平安医疗健康科技服务有限公司 | Method and device for testing front-end component, storage medium and computer equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109828903B (en) | Automatic testing method and device, computer device and storage medium | |
CN105404585B (en) | Obtain the method and device of code coverage | |
CN108170600A (en) | The coverage rate statistical method of front-end code test, apparatus and system | |
CN109408105A (en) | Acquisition method, device, computing device and the storage medium of user behavior data | |
CN107506300B (en) | User interface testing method, device, server and storage medium | |
CN111459794A (en) | Communication network testing method, device, computer equipment and storage medium | |
US20130117855A1 (en) | Apparatus for automatically inspecting security of applications and method thereof | |
CN104461481B (en) | The method of adjustment and device of application software | |
CN104407980A (en) | Mobile application automated testing device and method | |
CN110020381A (en) | Method of calibration, device, equipment and computer storage medium based on configuration file | |
CN108255701B (en) | Scene testing method and mobile terminal | |
CN107370804B (en) | Software application processing method and device | |
CN107295082A (en) | Running software processing method, apparatus and system | |
CN109712000A (en) | Repeat insure method for limiting, device, equipment and readable storage medium storing program for executing | |
CN109598602A (en) | Account checking method, device, equipment and computer readable storage medium | |
CN111352836A (en) | Pressure testing method and related device | |
CN107741902A (en) | Program application detection method and program application detection means | |
CN112631924A (en) | Automatic testing method and device, computer equipment and storage medium | |
CN107102950A (en) | A kind of applied program testing method and device | |
CN111325901A (en) | Method and device for identifying mobile phone | |
CN110647523B (en) | Data quality analysis method and device, storage medium and electronic equipment | |
CN108345453A (en) | Code generating method, code generator and readable storage medium storing program for executing | |
CN106201857A (en) | The choosing method of test case and device | |
CN110580171A (en) | APP classification method, related device and product | |
CN112115060A (en) | Audio test method and system based on terminal |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180615 |
|
RJ01 | Rejection of invention patent application after publication |