IJRIT International Journal of Research in Information Technology, Volume 3, Issue 4, April 2015, Pg. 329-339

International Journal of Research in Information Technology (IJRIT) www.ijrit.com

ISSN 2001-5569

Test Case Prioritization and Test Suite Optimization Using Modified PSO Dr.R.Subha1, Najumamol TA2 Associate Professor, Department of CSE, Sri Krishna College of Technology, Coimbatore, India [email protected] PG Scholar, Department of CSE, Sri Krishna College of Technology, Coimbatore, India [email protected]

Abstract: Software Testing is an important activity in Software Development Life Cycle (SDLC). Software testing is a process of executing a program or application with the intent of finding the bugs. Testing is expensive and prone to mistakes and oversights when manually performed. The testing cost can be reduced by reducing the size of test suite. There are some modules within software that are more critical to the software’s operation than others. Error in modules with high criticality is accountable directly or indirectly, for causing the high failure rate of the overall software .The test cases are then prioritized for testing based on their estimated criticality. Then the prioritized test cases (TC) are selected by using Particle Swarm Optimization (PSO) algorithm. The proposed work implements Binary Constrained Particle Swarm Optimization (BCPSO) for selecting test cases out of a large pool of test cases. Modified PSO integrated with local search mechanisms (hill climbing and forward selection) is implemented to refine the solutions provided by Binary Constrained Particle Swarm Optimization (BCPSO). Key-words: Test Case, Test Case Prioritization, Binary Constrained Particle Swarm Optimization, Hill Climbing, Test Case Minimization *Corresponding author E-Mail: [email protected] (Dr.R.Subha) 1. Introduction Software engineers apply the principles of software engineering to the design, development, maintenance, testing and assessment of the software that make computers or anything containing software work. Software engineering process is to achieve a high quality, software and always follows a software development life cycle process. One of the main activity in every software development life cycle is the software testing. Software testing process requires a great deal effort with a human interface. Software testing is a technique of assessing the functionality of a software program. Software testing is a process used to identify the correctness, fullness, and quality of developed computer software. A moderate size application generally consists of a number of components. The components interact among themselves through a number of operations. It is not always feasible to test the components and their possible interactions thoroughly within the available test budget. It is also not needed to conduct more testing for ensuring the success of a product. There are some components within software that are more critical to the software’s operation than others. Dr.R.Subha, IJRIT-329

IJRIT International Journal of Research in Information Technology, Volume 3, Issue 4, April 2015, Pg. 329-339

Error in components with high criticality is accountable directly or indirectly, for causing the high failure rate of the overall software .The test cases are then prioritized for testing according to their estimated criticality. In TC optimization, prioritization and selection of test cases are the two important solutions . Test case (TC) prioritization and selections are closely related. It is experimentally observed that defects follow a Pareto distribution where 80% of all defects are found in 20% of the modules [3]. The presence of defects in some parts of the source code may cause frequent failures compared to that in other parts. Test suites frequently develop very large over many releases, such that it is not practical to re-execute all test cases within limited resources. Test case(TC) prioritization rearranges the test cases according to certain criteria, such that the test cases with higher priority are executed earlier. The main objective of the test case prioritization is to increase the fault detection rate. However, it is difficult to discover the fault detection information until the testing is finished. Thus, test case prioritization techniques rely on surrogates, hoping that early satisfying of these surrogates will lead to increasing the fault detection rate. Once the priority of a test case is determined, our test case selection procedure selects test cases from a pool of test cases. In our approach, selection of a finite number of test cases from a large pool of test cases turns out to be a computationally intractable. It is because not only the test cases that test the higher priority components should be selected. The prioritized test cases (TC) are selected based on the Particle Swarm Optimization (PSO) algorithm. The proposed work implements Binary Constrained Particle Swarm Optimization (BCPSO) for selecting test cases out of a large pool of test cases. Modified PSO integrated with local search mechanisms (hill climbing and forward selection) is implemented to refine the solutions provided by Binary Constrained Particle Swarm Optimization (BCPSO). The proposed algorithms were evaluated using real world test suites of mobile devices domain. 2. Related work Chhabi Rani Panigrahi [2] proposed a novel regression test case prioritization technique based on an analysis of a dependence model for object-oriented programs. It first constructs an intermediate dependence model of a program from its source code. When the program is customized, the model is updated to reflect the changes. Proposed regression TCP technique Heuristic based-Regression Test Prioritization (H-RTP). It is based on analysis of a dependency model extended system dependency graph (ESDG) for object oriented programs. More specifically, this technique first selects test cases based on an analysis of control and data dependencies as well as dependencies arising from object relations. Then, H-RTP prioritizes test cases by assigning decreasing weights to affected nodes in the ESDG model. Some of the activities in HRTP such as constructing the ESDG model, collecting test coverage information, marking the test coverage information on ESDG model and updating an ESDG model. Rubing Huang [5] proposed a new “aggregate strength prioritization” method, for joining the interface coverage at distinct strengths. In testing, it is often assumed that all combinatorial test cases have equal fault finding ability, however it has been shown that the execution order of an interaction test suite’s test cases might be serious, especially when the testing resources are inadequate. To improve testing cost effectiveness, TC in the interaction test suite can be prioritized, Test case(TC) prioritization is used to list the test cases in an order, so as to, according to some criteria; test cases with higher priority are executed earlier in the testing Dr.R.Subha, IJRIT-330

IJRIT International Journal of Research in Information Technology, Volume 3, Issue 4, April 2015, Pg. 329-339

process. A well prioritized test sequence may improve the likely hood of detecting faults earlier, which may be especially important when testing with limited test resources. A well documented function is a weighted average of the percentage of faults detected (APFD) (Elbaum et al., 2002), which is a measure of how quickly a test sequence can detect faults during the execution. The APFD metric, which has been used in practical testing, has a range of (0, 1), with higher values implying faster rates of fault detection. Two requirements of the APFD metric are that (1) all test cases in a test sequence should be executed; and (2) all faults should be detected. Adisriikanth [1] proposed an approach to solve the problem of Test Case Optimization by applying ABC algorithm. In the proposed method each test case (TC) would represent a food source and the goal of the approach would be to find best food sources. The food source location represents to a possible solution of the optimization problem and the nectar amount corresponds to the quality (fitness) of the associated solution. Initially the program is fed to the Test Case optimization tool, which converts the program into a corresponding Control Flow Graph (CFG). Now from control flow graph, the independent paths from the start node to the end node are generated. Each independent path would comprise number of normal nodes and predicate nodes. Every independent path would represent a Test Case [1].Now the ABC algorithm is applied to generate an Optimal Test suite by generating optimal test data which would traverse through the independent paths and hence into to the test cases. Chunrong Fang [4] proposed ordered sequences of program entities to improve the effectiveness of test case prioritization. Test case prioritization rearranges test cases to improve the efficiency of testing. The execution frequency profiles of test cases are collected and transformed into the ordered sequences. The purpose of similarity based techniques is to maximize the diversity of selected test cases. The variety of test cases is computed by a certain distinction measure between each pair of test cases. Consequently, this will increase the chance of detecting faults as early as possible if we maximize the diversity of the test cases. Similarity-based techniques are mainly classified into two types: distribution- based and adaptive random testing (ART)-inspired. Distribution-based techniques cluster test cases according to their dissimilarities. Clusters and nearby points can be used to guide test case selection and test case prioritization. We propose several novel similarity based test case prioritization techniques based on the farthest-first ordered sequence (FOS) algorithm and greed-aided-clustering ordered sequence (GOS) algorithm. 3. Methodology The Proposed strategy is used to solve the problem of Test Case Prioritization and Optimization using BCPSO Algorithm. Software testing is the process of executing and evaluating a program with the intent of finding error(Myers 1979). Software testing mainly focuses on any activity aimed at evaluating an attribute or capability of a program or system and finding that it meets its specification requirements (Hetzel 1988) [6]. There are some components within software that are more critical to the software’s operation than others. Error in components with high criticality is accountable directly or indirectly, it cause the high failure rate of the overall software .The test cases (TC) are then prioritized for testing according to their estimated criticality. It is ineffective to re execute every test cases for every program function if once change occurs. Test case (TC) prioritization is to be listed based on higher priority than lower priority to meet some performance goal.

Dr.R.Subha, IJRIT-331

IJRIT International Journal of Research in Information Technology, Volume 3, Issue 4, April 2015, Pg. 329-339

In this technique each test cases are assigned a priority. Priority value is set according to some criterion and test cases with highest priority are listed first. The test cases those prioritized are selected based on the Particle Swarm Optimization (PSO) algorithm. In the proposed work, it implements Binary Constrained Particle Swarm Optimization (BCPSO) for selecting test cases out of a large pool of test cases. Modified PSO integrated with local search mechanisms (hill climbing and forward selection) to refine the solutions provided by Binary Constrained Particle Swarm Optimization (BCPSO). 3.1 Overall design Fig. 1 shows the overall design of the proposed system.

Fig .1 Overall Designs A test case is a detailed procedure that fully tests a feature or an aspect of a feature. It may take many test cases to determine that a software program or system is considered sufficiently scrutinized to be released. Given a test suite T = { , , , . . ., } of n test cases, a candidate (subset) solution is represented as a binary vector t = ( ,  ,  ,. . .,  ), in which  ϵ {0,1}indicates the presence (1)or absence (0)of the test case T among the subset of selected TCs. Test suite for the mobile device is written and few test cases are selected to compute the effort. Table 1 shows the test case for mobile device. Table 1: Test Case for Mobile Device Test Test case case id name T0

UUID

T1

Mobile number

T2

Mobile number

T3

Landline number

Test data *318# 4 43351048 402 785

Expected output UUID Mobile number Mobile number Landline number

Dr.R.Subha, IJRIT-332

IJRIT International Journal of Research in Information Technology, Volume 3, Issue 4, April 2015, Pg. 329-339

Test execution effort is calculated to compute the test suites execution time (which is the constraint in our optimization search process). Test suite’s effort is computed based on the estimated time spent to manually execute each test case. Based on its specification the effort of executing each test is calculated; generally test specification includes precondition, procedure and post conditions. The effort indicates the cost (in time) needed to manually execute each test case on a particular mobile device. In the search process, the effort of the selected test cases (TC) is used as a constraint. Formally, each test case  ϵT has a cost scoreC . The complete cost of a solution t is calculated by using Eq(1). Cost( t) = 

, 

C

(1)

Where, C is the cost of each test case t . Forward Selection (FS) is a bottom up search procedure which builds a solution by iteratively adding new nodes to an empty set, until a stopping state is reached. The BCPSO-Forward Selection (FS) algorithm is similar to BSPSO, however, at every BCPSO iteration, the Forward Selection (FS) algorithm is used as a local search mechanism in order to refine each particle (solution). Each particle produced by BCPSO is given as an input to the FS, which refines the particles until the FS stopping criterion is reached. The Hill Climbing is a local search algorithm that starts with a random solution to a problem. At each iteration, this algorithm generates candidate solutions by performing small changes to the current solution. .A set of ‘n’ solutions S= {, . . . ,  } are generated at each iteration. Each neighbor is derived from the current solution by inverting the value of a randomly chosen  ϵ t. It performs general changes in the existing solution t in order to refine the search in the region being currently explored. The solution t is reorganized using Eq (2) ŝ ,   (ŝ ) >   () t=  , "ℎ $%

(2)

The BCPSO-HC method obtains the best result when compared to the BCPSO-FS. The outcome of BCPSO-HC is given as an initial solution for the test case prioritization. By using BCPSO-HC technique the prioritized test cases (TC) are optimized. 3.1.1 Test case prioritization. The test cases are then prioritized for testing according to their estimated criticality. It is inefficient to re execute every test cases for every program function if once change occurs. Test case (TC) prioritization is to be listed based on higher priority than lower priority to meet some performance goal. In this technique each test cases are assigned a priority. Priority value is set according to some condition and test cases with highest priority are scheduled first. Fig 2 shows the test case prioritization and optimization.

Dr.R.Subha, IJRIT-333

IJRIT International Journal of Research in Information Technology, Volume 3, Issue 4, April 2015, Pg. 329-339

Fig 2. Overall design of Test Case prioritization and optimization 3.1.2 Component Dependency Diagram A component dependency diagram (CDD) is a directed graph. Each node of a CDD corresponds to a component of the program. A component is a basic executable unit. In a procedure-oriented program, a component can be a function where as it is as simple as a class in object-oriented program. A component dependency diagram represents the program in a single diagram. However, unlike a DFD which represents a program in a hierarchy of diagrams, a CDD represents a program in a single diagram. Also, a CDD captures control aspects unlike DFDs which represent data flows alone. Further, the nodes of a DFD may or may not correspond to the functions of a program. We can view a CDD as a simplified form of a system dependence graph (SDG) but, a CDD does not have as many types of edges as SDG. Once the intermediate graph (CDD) is constructed, we use it to extract slices with respect to various scenarios for prioritizing components. 3.1.3 Test Case Prioritization The source code of the test case is given as the input for the program slicing. Slicing is a popular program analysis technique. The slice of a program with respect to some program point p and variable x consists of all statements and predicates of the program that might affect the value of x at point p. For a program not having function calls, the slice with respect to any variable x can be obtained using a program dependence graph.In the proposed work it extract the for ,if, else if loop from the source code. Let Ui, 1 ≤ i ≤ k be the various use cases of a program. The operational profile of the program assigns each use case Ui a probability pi , such that '

 p = 1 (

,-. Let fi ( j ) is the frequency of j -th scenario of i -th use case such that ∑ / ( (+) = 1,

Where 0( is the total number of scenarios of i-th use case. Then, the probability of execution of k-th scenario of i -th use case is p(i ) ∗ fi (k).Once the probability is determined, the priority value is assigned for each test cases.

Dr.R.Subha, IJRIT-334

IJRIT International Journal of Research in Information Technology, Volume 3, Issue 4, April 2015, Pg. 329-339

3.1.4 Test Case Selection using BCPSO-HC Each particle produced by BCPSO iteration is given as an initial solution to the HC. Which refines it until the HC stopping criterion is reached.It starts with a random solution to a problem, and progressively tries to find better solutions by using a local search operator. At each iteration, this algorithm generates candidate solutions by performing small changes to the current solution (these solutions are said to be the neighbors of the current solution).The best candidate solution of one iteration becomes the new current solution only if it yields a better fitness value than the previous one. This process stops when no better neighbors to the current solution can be found. The solution t is reorganized using Eq(3) ŝ ,   (ŝ ) >   () t=  , "ℎ $%

(3)

This process is repeated until a maximum number of restarts is performed. The final solution returned by the algorithm is the best solution of all random restarts. 4. Results The test cases are prioritized and optimized to reduce the time taken to execute the test cases. To implement this system, a test suite is written for the mobile application and test case is generated automatically. Then component dependency diagram is generated for the mobile number, sms and sim card number test cases. Once the intermediate graph (CDD) is constructed, extract slices with respect to various scenarios for prioritizing components. Then optimize the test cases after prioritizing it.

Fig 3. Component Dependency Diagram Fig 3 shows the component dependency flow of mobile number test case. It shows how the components are depended. In main function it calls the MobileNumber, Messaging and SimNum functions.

Dr.R.Subha, IJRIT-335

IJRIT International Journal of Research in Information Technology, Volume 3, Issue 4, April 2015, Pg. 329-339

Fig 4. Loop Extraction Fig 4 shows the slices of the source code of test cases. Test cases are generated for mobile number, sim card number and for the sms. From the source code of these test cases it extract the for , if, and else if loop.

Fig 5 . Frequency of test case execution Fig 5 shows the frequency of test case execution. After extracting the slices in the program, it check how many times each test cases executed under the environment for the time period 500ms.and also it calculate the time taken to execute each test cases for calculating the priority of test cases.

Fig 6 . Priority computed for each test case Dr.R.Subha, IJRIT-336

IJRIT International Journal of Research in Information Technology, Volume 3, Issue 4, April 2015, Pg. 329-339

Fig 6 shows the priority calculated for each test case. The test cases corresponding to the priority value is shown in fig 7.

Fig 7 . Test cases corresponding to the priority value The test cases are optimized after prioritizing it. Fig.8 shows the output of BCPSO-HC. It shows the test cases in the global positions that match both expected and the current result is same. The local search algorithm HC refines the solutions provided by BCPSO by performing a local search.

Fig 8 . Optimized test cases using BCPSO-HC 5. Performance Evaluation The performance of the proposed system is measured based on number of test cases optimized. The test cases are optimized using BCPSO-HC technique. The HC is a simple iterative local search algorithm that starts with a random solution to a problem, and progressively tries to find better solutions by using a local search operator. The current solution is then returned as the solution for the search process. The solution is represented by a binary vector t. The algorithm starts with an empty solution (i.e., with all tj = 0), and then performs several iterations, each one potentially producing a new better solution, until the adopted stopping criterion is reached.

Dr.R.Subha, IJRIT-337

Execution Time(ms)

IJRIT International Journal of Research in Information Technology, Volume 3, Issue 4, April 2015, Pg. 329-339

98 97 96 95 94 93 92 91 90 89 1 BCPSO-HC (Test cases with prioritization )

2 BCPSO-HC (Test cases without prioritization)

Fig 9 : Performance Analysis The test case optimization after prioritizing given the best performance, since it reduces the number of test cases. Fig 9 shows the performance analysis of the optimized test cases. The number of test cases optimized after test case prioritization is minimum as compared to the test cases optimized without prioritization. Table 2 shows the optimized test cases with and without prioritization. Table 2 : Optimized test suits Sl No

Test cases with Test cases without prioritization prioritization

1

8

19

2

5

14

3

12

25

4

11

20

6. Conclusion The proposed work implements Component Dependency Diagram (CDD), and then applies slicing technique to get the slices with respect to various scenarios. The slices and execution probabilities of various use cases are used to estimate the complexity. The test cases are then prioritized according to their estimated complexity. Once the components are prioritized, the test cases are selected using Modified PSO technique. Test cases are selected using two BCPSO algorithms which are integrated with local search technique Hill Climbing (HC) to improve the performance. The proposed work reduce the time taken to execute the test cases. 7. References [1] AdiSrikanth, Nandakishore J. Kulkarni “Test Case Optimization Using Artificial Bee Colony Algorithm”, In proceedings of the 22nd international conference on software engineering and knowledge engineering (SEKE 2010) Redwood City,CA,USA,2010.

Dr.R.Subha, IJRIT-338

IJRIT International Journal of Research in Information Technology, Volume 3, Issue 4, April 2015, Pg. 329-339

[2] Chhabi Rani Panigrahi · Rajib Mall “A heuristic-based regression test case prioritization approach for object-oriented programs”, In Proceedings of the 23rd international conference on tools with artificial intelligence (ICTAI2011)Boca Raton, FL,USA,2011. [3] Chunrong Fang , Zhenyu Chen , Kun Wu , Zhihong “Similarity-based test case prioritization using ordered sequences of program entities”, 2010,243–253. [4] Kaur.A,Bhatt,D,“Hybrid particle swarm optimization for regression testing”, The Journal of Systems and Software 99 (2015) 36–51 1815–1824. [5] Rubing Huang, Jinfu Chen,“Aggregate-strength interaction test suite prioritization”, Information and Software Technology,51(4),2009,679–690. [6] Walcott,K.R.,Soffa,M.L.,Kapfhammer,G.M.,&Roos,R.S,Time aware test suite prioritization, In Proceedings of the 2006 international symposium on software testing and analysis ,2006,(pp. 1–12). Authors’ Profiles 1. Dr.R.Subha received B.E in Computer Science and Engineering from Periyar University and M.E in Computer Science and Engineering from Anna University, Chennai and Ph.D. degree in Information and Communicative Engineering from Anna University. At Present, she is working as Associate Professor in the department of Computer Science & Engineering, Sri Krishna College of Technology, Coimbatore. She has more than 10 years experience in teaching. Her area of interest includes Software Engineering, Theory of Computing, Compiler Design and NLP. 2. Mrs. Najumamol TA was born in Ernakulum, India in 1988. She received Bachelor of Technology degree in Computer Science and Engineering under Mahatma Gandhi University, in 2010. She is currently pursuing Master of Engineering degree in Computer Science and Engineering under Anna University, Chennai, India. Her area of interest includes Software Testing and Software Quality Assurance.

Dr.R.Subha, IJRIT-339

Test Case Prioritization and Test Suite Optimization ...

Abstract: Software Testing is an important activity in Software Development Life Cycle. (SDLC). Software testing is a process of executing a program or application with the intent of finding the bugs. Testing is expensive and prone to mistakes and oversights when manually performed. The testing cost can be reduced by ...

2MB Sizes 1 Downloads 240 Views

Recommend Documents

COLLADA Conformance Test Suite and ... - Khronos Group
best solution for developers with regard to COLLADA. The WG agreed ... COLLADA Conformance Test Suite (CTS) should support OpenCOLLADA plugins for. MAX and ... MAYA plugins based on Feeling software FCOLLADA API. The core ...

COLLADA Conformance Test Suite and ... - Khronos Group
Other company and product names may be trademarks of the respective ... MAYA plugins based on Feeling software FCOLLADA API. .... Budget: $15K (US) ... framework, and of any test development you have previously performed in this.

Test Suite Compiler (TSC)
Mar 27, 2016 - redirects stdout to a string buffer. After. sizeOfBuffer bytes printed, the test is aborted with a FATAL failure. int _printFault(const char* limit,.

Design and Implementation of a Combinatorial Test Suite Strategy ...
Design and Implementation of a Combinatorial Test Su ... rategy Using Adaptive Cuckoo Search Algorithm_ p.pdf. Design and Implementation of a ...

Automated and Scalable T-wise Test Case Generation ...
of features F ⊆ N representing a valid product according to ... implemented mostly in JAVA (approximatively 2.3 KLOC) for. T-wise generation and metrics ...

Test Case Evaluation and Input Domain Reduction Strategies for the ...
Mar 4, 2009 - Test Case Evaluation and Input Domain Reduction Strategies ... The application of Evolutionary Algorithms to test data gen- ...... clear(int,int).

Skeleton Test Suite: Testing Results Software Version ... - GitHub
Dec 1, 2012 - DROID 6.1 was used alongside Signature File v65. As of 25 October 2012, ... fmt/436: Digital Negative Format (DNG) 1.0. Gave explicit .... forward adding manually created skeleton-files for each new DROID signature created.

Test Case Evaluation and Input Domain Reduction ...
Mar 4, 2009 - for the Evolutionary Testing of Object-Oriented Software. José Carlos .... For OO programs, classes and objects are typically consid- ered to be the ..... of fitness, accounting for the ability of the test cases to satisfy a coverage .

Logic Puzzles: A New Test-Suite for Compositional ...
The quality of this matching would be im- proved if it also relied on knowledge of structural semantics. This knowledge would be used to help capture and represent more precisely the meaning and information that are actually conveyed by the texts and

A Review Study of NIST Statistical Test Suite
Development of an indigenous Computer Package .... A concept of degrees of freedom is introduced in these tests in the form of blocks or classes. For such ...

ParTes. Test Suite for Parsing Evaluation - Semantic Scholar
Resumen: En este artıculo se presenta ParTes, el primer test suite en espa˜nol y catalán para la evaluación cualitativa de analizadores sintácticos automáticos. Este recurso es una jerarquıa de los fenómenos representativos acerca de la estru

Introducing a Test Suite Similarity Metric for Event ...
test suite. ▫ The parameter, n, allows the metric to consider event sequences ... Test Case. Executor. Matrices. Coverage. Matrices. TS3. TS2. TS1. TS3. TS2. TS1.