CN103577311A - Method and device for screening test cases - Google Patents

Method and device for screening test cases Download PDF

Info

Publication number
CN103577311A
CN103577311A CN201210261405.1A CN201210261405A CN103577311A CN 103577311 A CN103577311 A CN 103577311A CN 201210261405 A CN201210261405 A CN 201210261405A CN 103577311 A CN103577311 A CN 103577311A
Authority
CN
China
Prior art keywords
test case
code line
equivalence class
test
test cases
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
Application number
CN201210261405.1A
Other languages
Chinese (zh)
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.)
Shenzhen Shiji Guangsu Information Technology Co Ltd
Original Assignee
Shenzhen Shiji Guangsu Information Technology 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 Shenzhen Shiji Guangsu Information Technology Co Ltd filed Critical Shenzhen Shiji Guangsu Information Technology Co Ltd
Priority to CN201210261405.1A priority Critical patent/CN103577311A/en
Publication of CN103577311A publication Critical patent/CN103577311A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Testing And Monitoring For Control Systems (AREA)

Abstract

The invention is suitable for the technical field of software testing and provides a method and a device for screening test cases. The method comprises the steps of respectively obtaining test cases associated with code lines, wherein the test cases cover the code lines associated with the test cases; when the code lines are changed, extracting the test cases associated with the code lines. By obtaining the associated relation between the code lines and the test cases, the test cases influenced by code changing can be screened quickly and effectively when codes are changed, regression testing is performed in a targeted mode, execution of a large amount of redundant test cases is avoided, and test time is saved.

Description

A kind of test case screening technique and device
Technical field
The invention belongs to software testing technology field, relate in particular to a kind of test case screening technique and device.
Background technology
In the life cycle of software, when there is the variations such as code upgrade, version iteration or leak (Bug) reparation, need to carry out regression test, to retest software function, guarantee that above-mentioned variation can not destroy the original function of software.
Yet, in regression test, if carry out all test cases, for large software, need to expend a large amount of test durations, infeasible; If based on risk selection operating part test case,, because tester cannot weigh the coverage that the actual change of software brings, therefore in the selection of test case, seem blindly, may cause larger function logic to omit risk.Therefore, existing regression test process cannot be taken into account the validity of testing efficiency and test case, causes testing effect undesirable.
Summary of the invention
The object of the embodiment of the present invention is to provide a kind of test case screening technique, is intended to solve the validity that existing regression test cannot take into account testing efficiency and test case, causes testing the undesirable problem of effect.
The embodiment of the present invention is achieved in that a kind of test case screening technique, comprising:
Obtain respectively the test case of each code line association, described test case covers the described code line associated with it;
When having described code line that change occurs, extract the described test case of described code line association.
Another object of the embodiment of the present invention is to provide a kind of test case screening plant, comprising:
The first acquiring unit, for obtaining respectively the test case of each code line association, described test case covers the described code line associated with it;
The first extraction unit, for when having described code line that change occurs, extracts the described test case of described code line association.
In embodiments of the present invention, by obtaining the incidence relation between each code line and test case, thereby when there is change in code, can filter out quickly and efficiently the test case that code change affects, carry out targetedly regression test, and avoided the execution of bulk redundancy test case, saved the test duration.
Accompanying drawing explanation
Fig. 1 is the realization flow figure of the test case screening technique that provides of the embodiment of the present invention;
Fig. 2 is the realization flow figure of the test case screening technique that provides of another embodiment of the present invention;
Fig. 3 is the realization flow figure of the test case screening technique that provides of another embodiment of the present invention;
Fig. 4 is the structured flowchart of the test case screening plant that provides of the embodiment of the present invention;
Fig. 5 is the structured flowchart of the test case screening plant that provides of another embodiment of the present invention.
Embodiment
In order to make object of the present invention, technical scheme and advantage clearer, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that specific embodiment described herein, only in order to explain the present invention, is not intended to limit the present invention.
In embodiments of the present invention, by obtaining the incidence relation between each code line and test case, thereby when there is change in code, can filter out quickly and efficiently the test case that code change affects, carry out targetedly regression test, and avoided the execution of bulk redundancy test case, saved the test duration.
Fig. 1 shows the realization flow of the test case screening technique that the embodiment of the present invention provides, and details are as follows:
In step S101, obtain respectively the test case of each code line association, this test case covers the code line associated with it.
In the present embodiment, before step S101, can be by all test cases of the baseline test case library set of all test cases of baseline version code tester (for) be carried out to coverage rate analysis, thereby get the code line of each source file to the mapping relations of this baseline test case library, every line code of knowing source file is all covered by which test case, thus, according to the mapping relations that get, in step S101, can get respectively the test case of each the code line association in each source file, in the incidence relation of this " code line-test case ", being used to indicate each code provisional capital is covered by which test case, be that the associated test case of each code line all covers the code line associated with it.
It should be noted that, in embodiments of the present invention, coverage rate analysis can adopt corresponding coverage rate statistical tool to complete according to the difference of code programming language used, at this, is not used in restriction the present invention.
In step S102, when having code line that change occurs, extract the test case of this code line association.
In the present embodiment, can to the code of new and old two versions, compare by for example diff order, obtain the modification information of new version of code, when finding that there is code line, change, comprise newly-increased, when deleting or revising, extract the associated test case of code line that change occurs, for carrying out regression test.
For example, when modification information indication has code line deleted, extract the associated test case of deleted code line and carry out regression test; When modification information indication has code line to be modified, also extract the associated test case of code line being modified and carry out regression test.
Therefore, in the present embodiment, by test case is screened, in regression test, only need test can reach the test purpose of expection completely with the test case that the code line that change occurs is associated, under the prerequisite that guarantees test case validity, greatly improved testing efficiency.
As one embodiment of the present of invention, due to when code generation increases code line newly or revises the alteration of code line, may occur that the code line that occurs to change possesses the situation of the test case associated with it in addition, now, as shown in Figure 2, the embodiment of the present invention also comprises:
Step S103, if do not have test case associated with the code line that change occurs, feeds back the information of this code line.
In the present embodiment, the information of code line comprises the source filename of this code line place source file and the line number of this code line, by feeding back the above-mentioned information of this code line, the test case that tester can be associated according to the newly-increased code line with there is change of above-mentioned information, has effectively avoided the omission to function logic in test.
For example, for newly-increased code line, test case in baseline version use-case storehouse all cannot cover this code line, need to feed back the filename of newly-increased code line place source file and the line number of code line to tester, to point out the newly-increased corresponding test case of tester to carry out regression test.
In embodiments of the present invention, further, after step S101, before step S102, can also carry out equivalence class division by the test case to all, simplify further the test case that need to test, to improve testing efficiency.Particularly, as shown in Figure 3:
In step S302, all test cases are carried out to equivalence class division, the code line that the test case in each equivalence class covers is identical.
In the present embodiment, according to each code line getting in step S301 and the incidence relation of test case, can get the code line that each test case covers.Particularly, the code line that each test case covers can obtain by the code line of each source file getting before step S101 is reflected to penetrate to the mapping relations of baseline test case library.
In the present embodiment, the identical code line if two test cases are flowed through in the process of implementation, thinks and these two test case equivalences has identical test effect, can mutually replace.Therefore, these two test cases are incorporated in an equivalence class, thereby for the test case in baseline version use-case storehouse, can be divided into some equivalence classes.
Correspondingly, after step S303 extracts the test case of code line association of change, also comprise:
In step S304, obtain the residing equivalence class of the test case extracting.
In step S305, in each equivalence class getting, extract a test case.
In embodiments of the present invention, the associated test case of code line of the change extracting for step S303, can to the test case extracting, screen further, for the test case in same equivalence class, because the code line of its covering is identical, therefore, only need to extract a test case in this equivalence class, the test effect that can reach expection, has shortened the test duration thus widely, has improved the efficiency of test.
Fig. 4 shows the structured flowchart of the test case screening plant that the embodiment of the present invention provides, and this device can be arranged in the software testing devices such as computing machine, for moving the test case screening technique described in Fig. 1 to Fig. 3 embodiment of the present invention.For convenience of explanation, only show the part relevant to the present embodiment.
With reference to Fig. 4, this device comprises:
The first acquiring unit 41, obtains respectively the test case of each code line association, and this test case covers the described code line associated with it.
The first extraction unit 42, when having code line that change occurs, extracts the test case of the code line association that change occurs.
Alternatively, also comprise:
Feedback unit, if do not have test case associated with the code line that change occurs, the information of feedback code row.
Alternatively, the information of code line comprises the line number of filename and the code line of code line source file of living in.
Alternatively, above-mentioned change comprises deletion, newly-increased or modification.
Alternatively, as shown in Figure 5, this device also comprises:
Equivalence class division unit 43, carries out equivalence class division to all test cases, and the code line that the test case in each equivalence class covers is identical; Correspondingly,
This device also comprises:
Second acquisition unit 44, obtains the residing equivalence class of the test case extracting;
The second extraction unit 45 extracts a test case in each equivalence class getting.
In embodiments of the present invention, by obtaining the incidence relation between each code line and test case, thereby when there is change in code, can filter out quickly and efficiently the test case that code change affects, carry out targetedly regression test, and avoided the execution of bulk redundancy test case, saved the test duration.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, all any modifications of doing within the spirit and principles in the present invention, be equal to and replace and improvement etc., within all should being included in protection scope of the present invention.

Claims (10)

1. a test case screening technique, is characterized in that, comprising:
Obtain respectively the test case of each code line association, described test case covers the described code line associated with it;
When having described code line that change occurs, extract the described test case of described code line association.
2. the method for claim 1, is characterized in that, also comprises:
If do not have described test case associated with the described code line that change occurs, feed back the information of described code line.
3. method as claimed in claim 2, is characterized in that, the information of described code line comprises the filename of described code line source file of living in and the line number of described code line.
4. the method as described in claim 1 ~ 3 any one, is characterized in that, described change comprises deletion, newly-increased or modification.
5. the method for claim 1, is characterized in that, before described code line changes, also comprises:
All described test cases are carried out to equivalence class division, and the code line that the test case in each equivalence class covers is identical; Correspondingly,
Described method also comprises:
Obtain the residing described equivalence class of the described test case extracting;
Get each described in extract a described test case in equivalence class.
6. a test case screening plant, is characterized in that, comprising:
The first acquiring unit, for obtaining respectively the test case of each code line association, described test case covers the described code line associated with it;
The first extraction unit, for when having described code line that change occurs, extracts the described test case of described code line association.
7. device as claimed in claim 6, is characterized in that, also comprises:
Feedback unit, if for not having described test case associated with the described code line that change occurs, feed back the information of described code line.
8. device as claimed in claim 7, is characterized in that, the information of described code line comprises the filename of described code line source file of living in and the line number of described code line.
9. the device as described in claim 6 ~ 8 any one, is characterized in that, described change comprises deletion, newly-increased or modification.
10. device as claimed in claim 6, is characterized in that, also comprises:
Equivalence class division unit, for all described test cases are carried out to equivalence class division, the code line that the test case in each equivalence class covers is identical; Correspondingly,
Described device also comprises:
Second acquisition unit, for obtaining the residing described equivalence class of the described test case extracting;
The second extraction unit, for get each described in equivalence class extract a described test case.
CN201210261405.1A 2012-07-26 2012-07-26 Method and device for screening test cases Pending CN103577311A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210261405.1A CN103577311A (en) 2012-07-26 2012-07-26 Method and device for screening test cases

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210261405.1A CN103577311A (en) 2012-07-26 2012-07-26 Method and device for screening test cases

Publications (1)

Publication Number Publication Date
CN103577311A true CN103577311A (en) 2014-02-12

Family

ID=50049138

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210261405.1A Pending CN103577311A (en) 2012-07-26 2012-07-26 Method and device for screening test cases

Country Status (1)

Country Link
CN (1) CN103577311A (en)

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105426282A (en) * 2015-11-05 2016-03-23 天津津航计算技术研究所 Method for optimizing regression time of test cases of digital chip verification platform
CN105930257A (en) * 2015-10-12 2016-09-07 中国银联股份有限公司 Method and apparatus for determining target test cases
CN106201857A (en) * 2015-05-05 2016-12-07 阿里巴巴集团控股有限公司 The choosing method of test case and device
CN106547678A (en) * 2015-09-16 2017-03-29 伊姆西公司 For the method and apparatus of white-box testing
CN106776290A (en) * 2016-11-28 2017-05-31 北京铭铭鑫软件有限公司 A kind of intelligent continuous integrating method of testing of incremental learning
CN104461875B (en) * 2014-11-23 2018-01-09 国云科技股份有限公司 A kind of method according to equivalence class design software test case
CN107908540A (en) * 2017-07-26 2018-04-13 平安壹钱包电子商务有限公司 Test case creation method, apparatus, computer equipment and medium
CN105224446B (en) * 2014-05-26 2018-06-19 腾讯科技(深圳)有限公司 A kind of test case screening technique and device, server
CN110069414A (en) * 2019-04-25 2019-07-30 浙江吉利控股集团有限公司 Regression testing method and system
CN110134595A (en) * 2019-04-19 2019-08-16 平安科技(深圳)有限公司 Analysis method, device, computer equipment before SVN resource library test
CN110928798A (en) * 2019-11-30 2020-03-27 苏州浪潮智能科技有限公司 Code testing method, device and equipment
CN111382070A (en) * 2020-03-03 2020-07-07 腾讯科技(深圳)有限公司 Compatibility testing method and device, storage medium and computer equipment
CN112256556A (en) * 2020-09-11 2021-01-22 上海汇付数据服务有限公司 Test method and test device using test case
CN113138930A (en) * 2021-05-12 2021-07-20 上海云从企业发展有限公司 Software testing method and device and computer storage medium
CN113672494A (en) * 2020-05-13 2021-11-19 美商新思科技有限公司 Intelligent regression test selection for software development
CN117009230A (en) * 2023-07-25 2023-11-07 北京泰策科技有限公司 Accurate test method and system based on code coverage rate evaluation

Cited By (25)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105224446B (en) * 2014-05-26 2018-06-19 腾讯科技(深圳)有限公司 A kind of test case screening technique and device, server
CN104461875B (en) * 2014-11-23 2018-01-09 国云科技股份有限公司 A kind of method according to equivalence class design software test case
CN106201857B (en) * 2015-05-05 2019-03-29 阿里巴巴集团控股有限公司 The choosing method and device of test case
CN106201857A (en) * 2015-05-05 2016-12-07 阿里巴巴集团控股有限公司 The choosing method of test case and device
CN106547678A (en) * 2015-09-16 2017-03-29 伊姆西公司 For the method and apparatus of white-box testing
CN106547678B (en) * 2015-09-16 2019-03-15 伊姆西公司 Method and apparatus for white-box testing
CN105930257B (en) * 2015-10-12 2018-12-28 中国银联股份有限公司 A kind of method and device of determining target detection use-case
CN105930257A (en) * 2015-10-12 2016-09-07 中国银联股份有限公司 Method and apparatus for determining target test cases
CN105426282B (en) * 2015-11-05 2018-04-03 天津津航计算技术研究所 Optimize the method that digit chip verification platform test case returns number
CN105426282A (en) * 2015-11-05 2016-03-23 天津津航计算技术研究所 Method for optimizing regression time of test cases of digital chip verification platform
CN106776290B (en) * 2016-11-28 2020-05-22 北京一铭铭鑫软件有限公司 Intelligent continuous integration test method for incremental learning
CN106776290A (en) * 2016-11-28 2017-05-31 北京铭铭鑫软件有限公司 A kind of intelligent continuous integrating method of testing of incremental learning
CN107908540A (en) * 2017-07-26 2018-04-13 平安壹钱包电子商务有限公司 Test case creation method, apparatus, computer equipment and medium
CN110134595A (en) * 2019-04-19 2019-08-16 平安科技(深圳)有限公司 Analysis method, device, computer equipment before SVN resource library test
CN110134595B (en) * 2019-04-19 2024-05-28 平安科技(深圳)有限公司 Analysis method, analysis device and computer equipment before SVN (scalable vector network) resource library test
CN110069414A (en) * 2019-04-25 2019-07-30 浙江吉利控股集团有限公司 Regression testing method and system
CN110069414B (en) * 2019-04-25 2023-05-30 浙江吉利控股集团有限公司 Regression testing method and system
CN110928798A (en) * 2019-11-30 2020-03-27 苏州浪潮智能科技有限公司 Code testing method, device and equipment
CN111382070A (en) * 2020-03-03 2020-07-07 腾讯科技(深圳)有限公司 Compatibility testing method and device, storage medium and computer equipment
CN111382070B (en) * 2020-03-03 2022-03-04 腾讯科技(深圳)有限公司 Compatibility testing method and device, storage medium and computer equipment
CN113672494A (en) * 2020-05-13 2021-11-19 美商新思科技有限公司 Intelligent regression test selection for software development
CN112256556A (en) * 2020-09-11 2021-01-22 上海汇付数据服务有限公司 Test method and test device using test case
CN113138930A (en) * 2021-05-12 2021-07-20 上海云从企业发展有限公司 Software testing method and device and computer storage medium
CN117009230A (en) * 2023-07-25 2023-11-07 北京泰策科技有限公司 Accurate test method and system based on code coverage rate evaluation
CN117009230B (en) * 2023-07-25 2024-04-16 北京泰策科技有限公司 Accurate test method and system based on code coverage rate evaluation

Similar Documents

Publication Publication Date Title
CN103577311A (en) Method and device for screening test cases
CN105446878B (en) A kind of lasting programming automation method of testing
CN106933609B (en) Android application program installation package generation method and device
CN105095059B (en) A kind of method and apparatus of automatic test
CN105138386A (en) Logic design verification continuous integration platform based on Jenkins and vManager
CN105302716A (en) Method and apparatus for test in joint development mode
CN104407980A (en) Mobile application automated testing device and method
CN104077140A (en) Automatic compiling method and compiling device for continuous integration
CN105487907A (en) Difference package manufacturing method and device
CN105022691A (en) Highly automatic software testing method based on UML diagram
CN103209197A (en) Cluster server deployment method and cluster server deployment system
CN102567164A (en) Instruction set batch testing device and method for processor
CN110737594A (en) Database standard conformance testing method and device for automatically generating test cases
CN103389939A (en) Detection method and detection system for controlled heap allocation bug
CN103092748A (en) Method and system of test cases surely needing to perform regression testing
CN106681783A (en) Detection method and system for SVN code
CN106354638A (en) Automatic testing method and device based on lexical analysis
CN104125504A (en) Deployment method, device and system based on continuous integration
CN105117329A (en) Application automatic online system and method
EP3514680B1 (en) Identification of changes in functional behavior and runtime behavior of a system during maintenance cycles
CN104035766A (en) Android system trimming method based on coverage rate test
CN104133763A (en) Program debugging system and program debugging method
CN110990177B (en) Fault repairing method, device, system, storage medium and electronic equipment
CN104536880A (en) GUI program testing case augmentation method based on symbolic execution
US10545740B2 (en) Distributed agent to collect input and output data along with source code for scientific kernels of single-process and distributed systems

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20140212