CN103870384B - Test case presumption method and system - Google Patents

Test case presumption method and system Download PDF

Info

Publication number
CN103870384B
CN103870384B CN201210533665.XA CN201210533665A CN103870384B CN 103870384 B CN103870384 B CN 103870384B CN 201210533665 A CN201210533665 A CN 201210533665A CN 103870384 B CN103870384 B CN 103870384B
Authority
CN
China
Prior art keywords
test
test case
execution
relation
class
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
Application number
CN201210533665.XA
Other languages
Chinese (zh)
Other versions
CN103870384A (en
Inventor
吴旭
胡骥
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Aisino Corp
Original Assignee
Aisino Corp
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 Aisino Corp filed Critical Aisino Corp
Priority to CN201210533665.XA priority Critical patent/CN103870384B/en
Publication of CN103870384A publication Critical patent/CN103870384A/en
Application granted granted Critical
Publication of CN103870384B publication Critical patent/CN103870384B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention relates to the technical field of software testing, and provides a test case presumption method and system. The method comprises the following steps: S1, acquiring the relation between a test case and an implementing method; S2, acquiring an inter-method calling relation map in a new version class package; S3, comparing a new version test version with an old version test version to obtain the names of varied method items; S4, inversely computing the name of a method calling the varied method items by using the calling relation map obtained in the step S2; S5, calculating the information of test cases needing to be tested by using the relation between the test case and the implementation method obtained in the step S1. In the technical scheme, a modification item-correlated method is realized by means of the comparison between new and old versions and inverse computation of the calling relation, and test cases needing to be tested in regression testing are found automatically, thereby increasing the implementation efficiency of the regression testing.

Description

Test case estimates method and system
Technical field
The present invention relates to software testing technology field, estimate method and system particularly to a kind of test case.
Background technology
Because computer software programs are mainly completed by artificial exploitation, generally also jointly can be completed by several developers, Inevitably there are all kinds of unexpected mistakes.Therefore, software product before formal issue will through multiple test and Modification, the basic goal of software test is exactly the defect finding as much as possible before software product is issued in software, to protect The quality of card formal product.Wherein Black-box Testing is from user perspective, and program is regarded as a flight data recorder that can not open, In the case of giving no thought to program internal structure and bulk properties, the input and output to program are tested, Black-box Testing Tested mainly for software interface and software function, one of most practical software test mode.
Existing software test theory has been mature on the whole, and most test modes all can be by automated mean Lai real Existing test process, for Black-box Testing, if suitable test case can be selected for each test process, can set effectively Count out efficient automatic testing process.But, increasingly huge with software systems to be tested, the workload of test is exponentially Increase, be that software Black-box Testing work brings much new problem.Such as large software all can be carried out repeatedly before and after issuing Modification BUG(Or increase function)Version upgrading, each modification all can bring a series of change to software program;Correspondingly, How to determine produced change during version upgrading, how to carry out screening test cases for these changes, be all that black box is surveyed The problem that examination needs to consider.
In prior art, it is after version upgrading, the BUG of previous version to be entered for the current usual way of the problems referred to above Row regression test, all or part of same test before repeating.But comparatively existing black box regression test compares Subjectivity, has simply divided priority for test case, carries out complete or collected works' execution, press if the time does not allow if the time allows The high test of priority execution priority.But in actual conditions, software version replacement can produce many new unknown problems, such as repaiies Change the new BUG that can draw while BUG, do not only need to detect that whether the BUG of previous version repairs when therefore testing, also will examine Survey in software after substituting with the presence or absence of new BUG.For reaching this purpose, existing regression testing method needs to after tested Use-case all carries out repetition measurement, leads to moving in circles of test job, inefficient.
Content of the invention
(One)Technical problem to be solved
In order to solve the problems, such as that in prior art, regression test efficiency is low, the invention provides a kind of test case presumption side Method and system, by screening test cases, it is to avoid unrelated retest.
(Two)Technical scheme
For solving above-mentioned technical problem, the present invention adopts the following technical scheme that enforcement:
First, the present invention provides a kind of test case to estimate method, and methods described includes step:
S1, obtains the relation of test case and execution method;
S2, obtains the call graph between execution method in new beta version class bag;
S3, relatively new and old two beta version class bags, obtain the title of the execution method that there occurs change;
S4, using in step S2 obtain call graph, upwards inverse called the described execution side that there occurs change The title of the execution method of method;
S5, using the relation of the described test case obtaining in step S1 and execution method, extrapolates the survey needing test The information of example on probation.
Preferably, described step S1, S2 and S3 can executed in parallel.
Preferably, in step S1, before obtaining test case and the relation of execution method, also include:To need to record Class name incoming as parameter using in the form of regular expression, execute test using automatic testing instrument or manual test mode Use-case;
The described test case that obtains with the method for relation of the method for execution is:Obtain described test by SOCKET communication to use Example with execute method relation.
Preferably, in step S2, the method obtaining the call graph between execution method in new beta version class bag is:Logical Cross the bytecode that ergodic classes obtains class, described bytecode is operated, in the new beta version class bag of acquisition between execution method Described call graph.
Preferably, the method for step S3 is:Relatively submit new and old two beta version class bags of test to, by traversing operation List the class of change and newly-increased class, obtain the bytecode of class, by the operation to bytecode, obtain and list and change and new The method name increasing.
Preferably, the method for step S4 is:Input item is referred to as with the name of the described execution method that there occurs change, according to The call graph that step S2 obtains, according in predefined inverse level time acquisition execution method call order upwards respective stages time All execution methods title.
Preferably, described predefined inverse level time is three-level.
Preferably, also include step after step S5:
S6, using the information of the described test case needing test, finds out corresponding in test case management system Test case, is isolated thus directly being tested.
On the other hand, the present invention also provides a kind of test case deduction system simultaneously, and described system includes:
Execution analysis module, for obtaining the relation of test case and execution method;
Call analysis module, for obtaining the call graph between execution method in new beta version class bag;
Comparison module, for relatively new and old two beta version class bags, obtains the title of the execution method that there occurs change;
Inverse module, for using calling the call graph obtaining in analysis module, inverse called described upwards Give birth to the title of the execution method of execution method of change;
Presumption module, for using the described test case obtaining in execution analysis module and the relation of execution method, pushing away Calculate the information of the test case needing test.
Preferably, described system also includes:Separate test module, for the letter by the described test case needing test Breath finds out corresponding test case in test case management system, is isolated thus directly being tested.
(Three)Beneficial effect
In the inventive solutions, by the comparison of new and old edition and the inverse of call relation, obtain and change The associated method of item, thus automatically finding the use-case needing in regression test to be tested, improves regression tested execution Efficiency.
Brief description
Fig. 1 is the schematic flow sheet that in the present invention, test case estimates method;
Fig. 2 is the structural representation of java example bag to be tested in one embodiment of the present of invention;
Fig. 3 is the original category code of java example in one embodiment of the present of invention;
Fig. 4 is new category code after the version upgrading of java example in one embodiment of the present of invention;
Fig. 5 is the call graph that represents of XML format of java example in one embodiment of the present of invention;
Fig. 6 is the relation schematic diagram of the test case of java example and execution method in one embodiment of the present of invention;
Fig. 7 is the output result that represents of XML format of java example in one embodiment of the present of invention.
Specific embodiment
Below in conjunction with each accompanying drawing, clear, complete description is carried out to the technical scheme in the embodiment of the present invention it is clear that institute The embodiment of description is a part of embodiment of the present invention, rather than whole embodiments.Based on the embodiment in the present invention, this The every other embodiment that field those of ordinary skill is obtained on the premise of not making creative work, broadly falls into this The scope of bright protection.
Subject matter faced by regression test is the chain reaction that may cause after software program code is changed, that is, change one Place's code may cause uncertain impact to the additive method calling this section of code, example etc..For avoiding this kind of impact to become New BUG in software, regression test can not be tested just for former BUG place use-case, and whole test cases must be entered Row repetition measurement.But in actual conditions, the test case that code revision may relate to is generally little, existing repetition measurement mode is often right Much unrelated use-case has carried out retest, result in existing regression testing method inefficiency, waste the plenty of time and Material cost.
Due to not existing for the use-case separation method of Black-box Testing in prior art, even if or there is independent test The mode of use-case, also can only determine the priority of use-case by the subjective judgement of tester, thus cannot be effectively from complete Automatically find the related use-case of modification in portion's use-case targetedly to be tested.The present invention is directed to this situation, surveys for returning Examination provides a kind of aid decision instrument, helps tester automatically to find to be actually needed the use-case of test, such that it is able to separate Use-case carries out independent test, it is to avoid the retest of unrelated use-case, accelerates test speed, improves testing efficiency.
In an embodiment of the present invention, provide firstly a kind of test case presumption method, as shown in figure 1, the method tool Body includes step:
S1, obtains the relation of test case and execution method;
S2, obtains the call graph between execution method in new beta version class bag;
S3, relatively new and old two beta version class bags, obtain the title of the execution method that there occurs change;
S4, using in step S2 obtain call graph, upwards inverse called the described execution side that there occurs change The title of the execution method of method;
S5, using the relation of the described test case obtaining in step S1 and execution method, extrapolates the survey needing test The information of example on probation.
Wherein, step S1, S2 of said method and S3 can executed in parallel.For ease of reading at any time and using, in step S1 The relation of the test case obtaining and the method for execution can be stored in database or be stored in XML document mode;In step S2 The call graph obtaining also can be stored as XML document;The information of the last test case needing test obtaining of step S5 Can be stored with XML document form.
How each step taking java program as a example illustrating the inventive method further below is realized. First, in the java example being given, the structure of bag to be tested is as shown in Fig. 2 have two under bag testpackage to be tested Individual class TestClassA and the code of TestClassB.Source code before version upgrading is as shown in figure 3, fresh code after substituting As shown in figure 4, the relation that can be seen that two classes bag from the code of example is:Method methodD in TestClassB class In generate the example ta of a TestClassA class and have invoked method methodB in TestClassA class;Simultaneously Other method methodE in TestClassB class have invoked method methodD further.And have modified during version upgrading Method methodB in TestClassA class.Certainly, the above is the information that manual read's code is recognized, and below will It is further described the aid decision instrument how to provide by the present invention automatically to find during regression test, to need the test of test The information of use-case.
Specifically, in step S1, before obtaining test case and the relation of execution method, also include:The present invention provides Aid decision instrument together can start with java it would be desirable to the class name that records is passed as parameter using in the form of regular expression Enter, tester uses automatic testing instrument or manual test mode implementation of test cases.In addition, in this step, obtaining and survey Example on probation with the method for relation of execution method is:Communicated by SOCKET and obtain test case and the relation of execution method.This In SOCKET communicate as prior art.
In step S2, the method obtaining the call graph between execution method in new beta version class bag is:Auxiliary running After helping decision tool, obtain the bytecode of class by ergodic classes, bytecode is operated, obtain in new beta version class bag and hold Call graph between row method.In this step, call graph such as Fig. 5 institute of the above-mentioned example of document storage in xml format Show, this XML document describes the relation of two classes in the bag described in the preceding paragraph word in a structured way.
Subsequently, the method for step S3 is:Relatively submit new and old two beta version class bags of test to, arranged by traversing operation Go out to have the class of change and newly-increased class, obtain the bytecode of class, by the operation to bytecode, obtain and list change and increase newly Method name, thus obtain the title of the execution method that there occurs change.
The method of step S4 is:Input item is referred to as with the name that there occurs the execution method of change, is obtained according to step S2 Call graph, obtain all execution upwards in respective stages time for the execution method call order according to predefined inverse level time The title of method, that is, inverse called the title of the execution method of the execution method that there occurs change upwards.In this step, One example of inverse level time is:Have invoked method b in hypothesis method a, in method b, have invoked method c, then method c inverse One-level is method b, and inverse two-stage is method a.In the present invention, predefined inverse level time acquiescence is three-level, this area correlation technique Personnel will be understood that predefined level time is discreet value at present, and inverse three-level should reflect modification journey under normal circumstances The impact of ordered pair relative program, can also adjust this predefined inverse level according to specific program complexity in actual conditions Secondary.
In step S5, using the relation of the described test case obtaining in step S1 and execution method, extrapolate and need to survey The information of the test case of examination.Such as it is assumed that certain performs methodE method, in step S1, obtain test case and execution Pass coefficient test case test_case_1 of method is according to result in storehouse as shown in fig. 6, step S4 inverse has gone out the method changed MethodB is called by methodD and methodE, now just can extrapolate test case test_case_1 and be related to Method methodB changed in TestClassA class, is the use-case that must test, outputs it to tester and automatically arrange Its priority is limit priority(priority="1″), the result of output is as shown in Figure 7.
Further, obtain the information of test case of needs test in step S5 after, also include step S6:Using need The information of test case to be tested, finds out corresponding test case in test case management system, be isolated thus Directly tested.The use-case ID showing in such as Fig. 7(case id), in this use-case ID and test case management system Case_id field is associated, and just can find out corresponding test case in test case management system by this use-case ID, Thus be isolated out being directly used in test.By this way, the method for the present invention is found that automatically needs the use-case tested simultaneously It is isolated and carries out independent test, it is to avoid the retest of whole use-cases, improve regression tested execution efficiency.
Additionally, it will appreciated by the skilled person that realizing all or part of step in above-described embodiment method The program that can be by complete come the hardware to instruct correlation, and described program can be stored in an embodied on computer readable storage and be situated between In matter, upon execution, including each step of above-described embodiment method, and described storage medium can be this program:ROM/ RAM, magnetic disc, CD, storage card etc..Therefore, corresponding with the method for the present invention, the present invention also includes a kind of test simultaneously and uses Example presumption, this system includes:
Execution analysis module, for obtaining the relation of test case and execution method;
Call analysis module, for obtaining the call graph between execution method in new beta version class bag;
Comparison module, for relatively new and old two beta version class bags, obtains the title of the execution method that there occurs change;
Inverse module, for using calling the call graph obtaining in analysis module, inverse called described upwards Give birth to the title of the execution method of execution method of change;
Presumption module, for using the described test case obtaining in execution analysis module and the relation of execution method, pushing away Calculate the information of the test case needing test.
Further, this system also includes:Separate test module, for by the described test case needing test Information finds out corresponding test case in test case management system, is isolated thus directly being tested.
In sum, in the inventive solutions, by the comparison of new and old edition and the inverse of call relation, obtain The method that is associated with modification item, thus automatically find the use-case needing in regression test to be tested.The technology of the present invention Scheme can provide strong reference for tester's screening test cases, simultaneously using the call graph of output, can make Tester more fully understands the implementation procedure of system.Most of all, present invention achieves the automatically analyzing of test case, sending out Now and separate, it is to avoid the retest of unrelated use-case, accelerate test speed on the premise of ensureing accuracy, improve survey The execution efficiency of examination.
Embodiment of above is merely to illustrate the present invention, and not limitation of the present invention, common about technical field Technical staff, without departing from the spirit and scope of the present invention, can also make a variety of changes and modification, therefore all Equivalent technical scheme falls within scope of the invention, and the scope of patent protection of the present invention should be defined by the claims.

Claims (8)

1. a kind of test case presumption method is it is characterised in that methods described includes step:
S1, obtains the relation of test case and execution method;
S2, obtains the call graph between execution method in new beta version class bag;
S3, relatively new and old two beta version class bags, obtain the title of the execution method that there occurs change;
S4, using in step S2 obtain call graph, upwards inverse called the described execution method that there occurs change The title of execution method;
S5, using the relation of the described test case obtaining in step S1 and execution method, extrapolates and needs the test of test to use The information of example;
S6, using the information of the described test case needing test, finds out corresponding test in test case management system Use-case, is isolated thus directly being tested.
2. method according to claim 1 is it is characterised in that described step S1, S2 and S3 can executed in parallel.
3. method according to claim 1 is it is characterised in that in step S1, obtaining test case and execution method Before relation, also include:Will be incoming as parameter using in the form of regular expression for the class name needing record, using automatic test work Tool or manual test mode implementation of test cases;
The described test case that obtains with the method for relation of the method for execution is:By SOCKET communicate obtain described test case with The relation of execution method.
4. method according to claim 1 is it is characterised in that in step S2, obtain the side of execution in new beta version class bag The method of the call graph between method is:Obtain the bytecode of class by ergodic classes, described bytecode is operated, obtain new Described call graph between execution method in beta version class bag.
5. method according to claim 1 is it is characterised in that the method for step S3 is:Relatively submit new and old the two of test to Individual beta version class bag, lists the class of change and newly-increased class by traversing operation, obtains the bytecode of class, by byte The operation of code, obtains and lists and change and newly-increased method name.
6. method according to claim 1 is it is characterised in that the method for step S4 is:There occurs holding of change with described The name of row method is referred to as input item, the call graph being obtained according to step S2, obtains according to predefined inverse level time and holds The title of row method call order all execution methods in respective stages time upwards.
7. method according to claim 6 is it is characterised in that described predefined inverse level time is three-level.
8. a kind of test case deduction system is it is characterised in that described system includes:
Execution analysis module, for obtaining the relation of test case and execution method;
Call analysis module, for obtaining the call graph between execution method in new beta version class bag;
Comparison module, for relatively new and old two beta version class bags, obtains the title of the execution method that there occurs change;
Inverse module, for using calling the call graph obtaining in analysis module, inverse called described there occurs upwards The title of the execution method of execution method of change;
Presumption module, for using the described test case obtaining in execution analysis module and the relation of execution method, extrapolating Need the information of the test case of test;
Separate test module, for searching in test case management system by the information of the described test case needing test Going out corresponding test case, being isolated thus directly being tested.
CN201210533665.XA 2012-12-11 2012-12-11 Test case presumption method and system Active CN103870384B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210533665.XA CN103870384B (en) 2012-12-11 2012-12-11 Test case presumption method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210533665.XA CN103870384B (en) 2012-12-11 2012-12-11 Test case presumption method and system

Publications (2)

Publication Number Publication Date
CN103870384A CN103870384A (en) 2014-06-18
CN103870384B true CN103870384B (en) 2017-02-08

Family

ID=50908940

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210533665.XA Active CN103870384B (en) 2012-12-11 2012-12-11 Test case presumption method and system

Country Status (1)

Country Link
CN (1) CN103870384B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105260303A (en) * 2015-10-10 2016-01-20 浪潮电子信息产业股份有限公司 Agility testing scheme based on automatic testing
CN105389262B (en) * 2015-12-23 2019-02-15 北京奇虎科技有限公司 A kind of method and apparatus generating Test Suggestion for interface detection
CN106790902B (en) * 2017-02-22 2021-03-23 惠州Tcl移动通信有限公司 Mobile terminal power consumption testing method and system
CN107085555A (en) * 2017-04-19 2017-08-22 广州视源电子科技股份有限公司 code testing method, device, terminal and storage medium
CN107193739B (en) * 2017-05-23 2020-06-05 张泽祎 Black box regression testing method
CN107885660B (en) * 2017-10-31 2020-04-03 平安科技(深圳)有限公司 Fund system automatic test management method, device, equipment and storage medium
CN107992409B (en) * 2017-11-21 2020-08-21 平安养老保险股份有限公司 Test case generation method and device, computer equipment and storage medium
CN107992424A (en) * 2017-12-15 2018-05-04 平安科技(深圳)有限公司 Automatic test analysis method, application server and computer-readable recording medium
CN108829575B (en) * 2018-04-17 2021-08-24 平安科技(深圳)有限公司 Test case recommendation method, electronic device and readable storage medium
CN109947657A (en) * 2019-04-03 2019-06-28 广东电网有限责任公司 A kind of the mobility scale analysis method and system of enterprise-level information management system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1670714A (en) * 2004-03-16 2005-09-21 华为技术有限公司 Test case implementing method and software test method
CN101908017A (en) * 2010-06-01 2010-12-08 南京大学 Regression test case screening method based on partial multi-coverage
CN102750153A (en) * 2012-06-29 2012-10-24 南京大学 Regression testing case set construction method based on program change

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100547562C (en) * 2006-10-18 2009-10-07 国际商业机器公司 The method and system of the unit testing use-case of problem when generation can be reproduced operation automatically

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1670714A (en) * 2004-03-16 2005-09-21 华为技术有限公司 Test case implementing method and software test method
CN101908017A (en) * 2010-06-01 2010-12-08 南京大学 Regression test case screening method based on partial multi-coverage
CN102750153A (en) * 2012-06-29 2012-10-24 南京大学 Regression testing case set construction method based on program change

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
回归测试用例选择技术研究;游亮;《中国博士学位论文全文数据库》;20120915;正文第14-124页 *

Also Published As

Publication number Publication date
CN103870384A (en) 2014-06-18

Similar Documents

Publication Publication Date Title
CN103870384B (en) Test case presumption method and system
CN105022691B (en) A kind of increasingly automated method for testing software based on uml diagram
US10235277B2 (en) Method of detecting false test alarms using test step failure analysis
D'Ambros et al. On the relationship between change coupling and software defects
US9720971B2 (en) Discovering transformations applied to a source table to generate a target table
US9354867B2 (en) System and method for identifying, analyzing and integrating risks associated with source code
US8312440B2 (en) Method, computer program product, and hardware product for providing program individuality analysis for source code programs
US10275333B2 (en) Risk analysis of codebase using static analysis and performance data
CN110765639B (en) Electrical simulation modeling method and device and readable storage medium
KR101425868B1 (en) System and Method for processing of large scale data based rule set
CN101082876A (en) Software automatically evaluating tool bag
CN113821554B (en) Method for realizing heterogeneous database data acquisition
CN102567351B (en) Testing method and testing device for database modification effects
CN111773728A (en) Data table testing method, device, equipment and storage medium
CN113672506A (en) Dynamic proportion test case sequencing selection method and system based on machine learning
CN106991050A (en) A kind of static test null pointer dereference defect false positive recognition methods
CN109508204B (en) Front-end code quality detection method and device
CN116627804A (en) Test method, system, electronic equipment and storage medium based on artificial intelligence
CN113032254B (en) Test coverage condition evaluation method and device
CN114676061A (en) Knowledge graph-based automatic firmware detection method
CN114168408A (en) Inspection method and system based on Internet of things, electronic equipment and storage medium
CN112416727A (en) Batch processing operation checking method, device, equipment and medium
CN113495819B (en) Whole vehicle test report processing method and device and electric vehicle
CN118332453B (en) Evaluation method and system of fault diagnosis strategy of liquid rocket engine
Sahana Software Defect Prediction Based on Classication Rule Mining

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant