Abstract
Software testing is an important process of detecting bugs in the software product thereby a quality software product is developed. Verification and Validation (V & V) activities are the effective methods employed to achieve quality. Static and dynamic testing activities are performed during V & V. During static testing, the program code is not executed while in dynamic testing (Black Box and White Box), the execution of the program code is performed. Effective test cases are designed by both these methods. Tables are employed to represent test case documentation. The most beneficial representation - State table based testing, for generating test inputs is explained with the help of state graphs and state tables. This technique is mainly employed in embedded system software testing, real time applications and web application based software product testing where time constraints are a major criteria. Automatic generation of test cases will help to reduce time overhead in testing activities. Our study is to develop optimum test cases by a modified Ant Colony Optimization (ACO) technique in an automated method and it ensures maximum coverage. The prediction model used in this paper ensures better accuracy of the design of test inputs. A comparison of the similar optimization techniques was also discussed that is used in automated test case generation. A case study of the various states during the execution of a task in an operating system has been presented to illustrate our approach.
You have full access to this open access chapter, Download conference paper PDF
Similar content being viewed by others
Keywords
1 Introduction
A software product should be reliable and measurable. These qualities are evaluated by way of effective testing activities. Hence testing is an important stage of Software Development Life Cycle (SDLC). Like SDLC, Software Testing Life Cycle (STLC) is also a process which detects bugs or faults so as to rectify them before delivery of the software product to the customer. The testing of the various phases of STLC by way of manual testing is difficult due to the overhead of time, cost and schedule slippage. Hence automated testing is complemented for majority of the testing activities [1]. This automated generation of test cases is necessary when a set of tests are to be done repeatedly, compatibility testing, regression testing etc. For this purpose, artificial intelligence techniques are adopted with a Meta heuristic approach. The problem of generating sets of test cases for functional testing, structural testing etc. are achieved by automated test case generation techniques [2].
In this paper, we propose an optimal algorithm for the automated generation of test cases based on Ant Colony Optimization (ACO). State table based testing - a black box testing technique is employed, which assures a higher level of functional testing of the individual modules. Here the process is categorized as – software environment modeling, test case selection, test case execution, test metrics and automated test suite reduction techniques [3].
A software product can be optimized by various algorithms such as genetic algorithms, ACO, Particle Swarm Optimization (PSO), Artificial Bee Colony (ABC) etc. The ACO algorithm is a metaheuristic intelligent optimization method. The algorithm is used for finding the optimal path in a graph. ACO is also employed for the optimization of test case generation techniques namely functional testing, Structural testing, Regression testing etc. [4]. Praveen et al. proposed an ACO based automated software testing technique which shows the generation of optimal test cases in an automated environment [5].
This paper proposes an automated method of generating test cases in functional testing technique mainly state table based testing, optimized by an ACO algorithm. The results are compared with other optimization models for effectiveness [6].
2 State Table Based Testing
State table based testing is defined as the black box testing technique in which changes in input conditions cause state changes in the application under test [7]. It is a convenient method for testing software systems where states and transitions are specified. Tables are used for representing information relating to the design of test cases. We have represented them using state transition diagrams and state tables. A state table representation has a) Finite State Machine (FSM), a model whose output is dependent on both previous and present inputs. An FSM model represents the software behavior and serves as a guide to design functional test cases. b) State transition diagram or state graph, is a software system which has different states depending on its input and time. The nodes in a state graph represent states. The nodes are connected by links denoted as transitions. With the help of nodes and transitions, a state graph is prepared. The pictorial representation of an FSM is depicted by a state graph and it represents the states that the system can assume. The state graph is converted to a tabular form known as state tables. They specify states, input events, transitions and outputs. The information contained in the state graph and the state table is converted into test cases.
The state table contains cells of valid and invalid inputs. Valid inputs causes a change of state and invalid inputs do not cause any change in transition in the state of a task. Due to the tremendous overhead of time and cost exhaustive testing is not possible. The solution is to formulate a strategy for test case reduction without affecting the functional coverage of the system under test. The genetic algorithms employed currently have to be modified for the above [8].
The method of state table based testing is depicted with a case study, showing the different states of a task in an operating system. A task or job assigned to an operating system has the states – New, Ready, Running, Waiting, Terminated. The state graph is drawn as the first step. The state graph can be represented as a directed graph G = (N, E), where N denotes the states (nodes) of the system under test and E denotes the edges or transition between the states.
The transition events are Admitted T1, Dispatch T2, Interrupt T3, I/O Wait T4, I/O Completion T5 and Exit T6. From the state graph, a state table is prepared.
Table 1 contains cells of valid and invalid inputs. From the state table, test cases are derived. The test cases generated are stored in a tabular form known as test case table and it contains six columns.
The test case table (Table 2) shows that 24 test cases are generated consisting of both valid and invalid test cases. We have to differentiate the valid and invalid test cases. Higher number of invalid test cases shows weak coverage. The solution can be obtained by reducing the test cases by prioritizing the test cases by following the rules.
-
a.
Develop test cases consisting of valid test cases that cause a change of state.
-
b.
Create test cases such that all test paths are executed at least once and the paths should be feasible.
-
c.
The inputs which do not cause change in transition have to be identified from the state table.
As shown in Fig. 1, there are two paths which satisfy rule b.
1. N0 → N1 → N2 → N4
2. N0 → N1 → N2 → N3 → N1 → N2 → N4
3 ACO Algorithm for Test Case Generation
ACO is a probabilistic technique which searches for optimal path in a graph. Ant behavior is looking a shortest path between their colony and location of food source. The path is discovered by pheromone deposits when the ants move at random. More pheromone deposits on a path increases the probability of the path being followed. The path is selected based on the maximum pheromone deposit from start node and the path is analyzed for optimality [9].
The behavior of ants can be used for solving the problem. Selection of paths depends upon the theory of probability. Ants generate pheromone and deposits on the paths for further remembrance and it is a heuristic technique. The path visibility is accomplished by the level of pheromone intensity and heuristic information. The feasible path is selected based on highest pheromone level and heuristic information. The algorithm needs four parameters for selecting the valid transitions of the state graph – Probability, Heuristic information, Pheromone intensity and Visibility of the path [10].
Kamna et al. evaluated the performances of genetic algorithm (GA), Bee Colony optimization (BCO), ACO and modified ACO (m-ACO) for test case prioritization in terms of Average Percentage of Faults Detected (APFD) and Percentage of Test Cases Required (PTR) metric [6]. The metrics was evaluated by the case studies for triangle problem, quadratic equation problem etc. (Table 3).
The comparison shows that m-ACO algorithm shows better coverage than the other optimization algorithms.
In order to classify or to select the valid test cases, we used the modified algorithm ‘Comprehensive Improved Ant Colony Optimization (ACIACO) for finding the effective optimization path and this path model is used to achieve highest coverage and reduce the number of iterations [11]. The establishment of transformation relationship makes effective use of ant colony algorithm for iterative optimization of test cases.
In this paper, generating the test cases from the state table is achieved by the modified ACO algorithm. The algorithm is for the effective traversing through the different states. Also the feasible test cases are generated so as to cover all transitions at least once. The procedure is given,
-
1.
Initialize parameters.
-
1.1
Set heuristic value (Æž).
Initialize heuristic value of each transition in the state graph È =2.
-
1.2
Set pheromone intensity (Æ®).
Initialize pheromone value for each transition in the state graph (Æ®=1).
-
1.3
Set visited status (Vs).
Initialize Vs = 0 (the condition in which ant not visited any state).
-
1.4
Set probability (P).
Initialize P = 0.
-
1.5
Initialize α =1, β =1, the parameters which controls the desirability and visibility.
-
1.6
Set count = maximum number of possible transitions.
-
1.1
-
2.
While (count > 0)
-
2.1
Update the paths or visited status of the paths Vs [i] = 1.
-
2.2
Evaluate feasible path F (P), if any from the first node to the next node in the state graph. Else go to step 6.
-
2.3
Evaluate probability of the path.
The probability has values between 0 and 1.
-
2.1
-
3.
Move to the next node.
-
3.1
Select the destination node. Ant will follow the rules.
-
3.1.1
If there is self-transition from (i → i), select it.
-
3.1.2
Else select the transition not visited. (Vs=0).
-
3.1.3
Else if two or more transition having the same visited status Vs[j] = Vs[k], then random selection of the node.
-
3.1.1
-
3.1
-
4.
Update values of Pheromone and heuristic.
-
4.1
Update pheromone intensity, Ʈij = (Ʈij)α * (ƞij)−β
-
4.2
Update heuristic, È ij = 2 * (Æžij).
-
4.3
Update count, Decrement count by one each step.
-
4.1
-
5.
Go to step 2.
-
6.
Stop.
4 Results and Discussion
We have discussed how the test cases are minimized while maximizing coverage of testing. If there are ‘n’ states in a state graph, then there will be a maximum of ‘n*n’ test cases both feasible and infeasible generated thereby increasing the testing time overhead. For the automated generation of test cases, we used an open source testing tool multidimensional modified condition/decision coverage which supports state graph based testing and generates test cases by traversing through the state transition graph [12].
The test cases given in Table 2, twenty four test cases both valid and invalid, which cause or do not cause change in transition from one state to another during the execution of a task has to be minimized.
4.1 Steps for Minimizing Test Cases
Wang’s algorithm [13] was used for the effective reduction of test cases.
-
1.
Calculate node coverage (NC) for each test case.
Let NC (tc) = t1, t2 … tn, where t1, t2, …. tn are transitions.
-
2.
If a number of set tc = 0, then tc is included in the effective set of test cases.
-
3.
Final set of test cases is generated.
In our case study, the algorithm is implemented as
N = {N0, N1, N2, N3, N4} representing the nodes.
ID = {ID1, ID2, …. ID6} representing input data.
OD = {OD1, OD2, …. OD6} representing output data.
T = {T1, T2, …. T6} representing transitions.
Ti is a transition from source node to the destination node.
Ti = {Np, Nq}, where Np is the source node and Nq is the destination node.
The next step is to extract each transition,
T1 = {N0, N1} to T6 = {N2, N4}.
After completely extracting all the transitions, the next step is to generate the test cases from TC1 to TC24.
The last step is to reduce the set of generated test cases by calculating the node coverage for each test case and determining which test cases are covered by other test cases. i.e. from NC(TC1) to NC(TC24). The test cases are valid if the node coverage is empty. All other test cases are invalid and can be ignored.
Hence the six valid test cases which causes state transitions in the execution of a task in an operating system are Test Suite, TS = {TC1, TC8, TC15, TC16, TC18, TC23} as shown in Table 4.
This reduction in test suite helps saving of time in resource constrained software projects. The ACIACO algorithm effectively covered the criteria such as reduced test suite size, improved fault detection capability, reduced time, cost and highest coverage criteria. A comparison of the three kinds of coverage – statement coverage, branch coverage and modified condition/decision coverage shows that the modified ACIACO algorithm obtained better values as shown in Table 5. It is evident that the ACO optimization algorithm will effectively improve the quality of the test cases generated.
5 Conclusion
We have proposed a modified ACO based approach for the automated and effective generation of valid test cases for the state transition based software testing. An FSM model is prepared. From the model, a state graph followed a state table and a test case table was generated. Also a test suite reduction algorithm is implemented thereby the optimization is achieved. ACO is a promising methodology for test case generation, selection and prioritization problem. ACO algorithm fully satisfies software coverage without having any redundancy. The power of nature inspired models in software engineering area is emerging because of its optimization outcome. The swarm based optimization is evolving in many of the software optimization fields. It is highly recommended, agent and swarm fused optimization algorithms can be used to generate efficient automated test environments.
References
Setiani, N., et al.: Literature review on test case generation approach. In: ICSIM 2019 Proceedings of the Second International Conference on Software Engineering and Information Management, pp. 91– 95, January 2019
Tahbildar, H., Kalita, B.: Automated software test data generation: direction of research. Int. J. Comput. Sci. Eng. IJCSES 2, 99–120 (2011)
Swain, T.R., et al.: Generation and optimization of test cases for object oriented software using state chart diagram, CS & IT – CSCP (2012)
Singh, G., et al.: Evaluation of test cases using ACO with a new heuristic function: a proposed approach. Int. J. Adv. Res. Comput. Sci. Softw. Eng. IJARCSSE (2014)
Srivastava, P.: Structured testing using ant colony optimization. In: Proceedings of the First International Conference on Intelligent Interactive Technologies and Multimedia, pp. 203–207. IITM, ACM India, December 2010
Kamna, S., et al.: A Comparative evaluation of ‘m-ACO’ technique for test suite prioritization. Indian J. Sci. Technol. 9(30), 1–10 (2016)
Li, H., Lam, C.P.: An ant colony optimization approach to test sequence generation for state based software testing. In: Proceedings of the fifth international conference on quality software, QSIC. IEEE (2005)
Thakur, P., Varma, T.: A survey on test case selection using optimization techniques in software testing. Int. J. Innov. Sci. Eng. Technol. IJISET 2, 593–596 (2015)
Vinod Chandra, S.S.: Smell detection agent based optimization algorithm. J. Insti. Eng. 97(3), 431–436 (2016). https://doi.org/10.1007/s40031-014-0182-0
Srivastava, P.: Baby: automatic test sequence generation for state transition testing via ACO, IGI, Global (2010)
Shunkun et al.: Improved Ant algorithm for software testing cases generation. The Sci. World J. (2014)
Maheshwari, V., Prasanna, M.: Generation of test case using automation in software systems – a review. Indian J. Sci. Technol. 8(35), 1 (2015)
Linzhang, W., et al.: Generating test cases from UML activity diagram based on gray-box method. In: Proceedings of the 11th Asia-Pacific Software Engineering Conference (APSEC04) (2004)
Author information
Authors and Affiliations
Corresponding authors
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2020 Springer Nature Switzerland AG
About this paper
Cite this paper
S, S.S., S S, V.C. (2020). An Ant Colony Optimization Algorithm Based Automated Generation of Software Test Cases. In: Tan, Y., Shi, Y., Tuba, M. (eds) Advances in Swarm Intelligence. ICSI 2020. Lecture Notes in Computer Science(), vol 12145. Springer, Cham. https://doi.org/10.1007/978-3-030-53956-6_21
Download citation
DOI: https://doi.org/10.1007/978-3-030-53956-6_21
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-53955-9
Online ISBN: 978-3-030-53956-6
eBook Packages: Computer ScienceComputer Science (R0)