Abstract
The model based testing approaches are not always capable of suggesting exact optimized and prioritize test cases, like conventional approaches, therefore some popular metaheuristic algorithms are gradually fabricated with model based testing methodologies for generating optimized test data. The metaheuristic algorithms are complex in terms of their algorithm specific parameter settings; they cannot provide good results without proper parameter settings. In accordance with the above-described issues, here in this work a novel methodology is proposed for test suite generation, using an improved metaheuristic Jaya algorithm along with UML state machine model. Experimenting with the benchmark triangle classification problem, the results prove, the performance as well as exploitation capability of the improved JAYA algorithm is quite good; over the widely popular Differential Evolution algorithm.
Access provided by Autonomous University of Puebla. Download conference paper PDF
Similar content being viewed by others
Keywords
1 Introduction
The object-oriented program testing is quite complex and still remains a critical research area since decades [1, 2]. The traditional testing approaches are unsuitable for object-oriented testing, thus a different testing practice, model-based testing is followed for deriving test cases [3, 4]. Gradually the Nature inspired algorithms proved their efficiency in proving sub-optimal solutions in various fields of engineering [11], thus researchers started fabricating those nature inspired metaheuristics with the software testing process [5,6,7]. The popular and widely accepted nature inspired metaheuristics mainly includes the evolutionary and swarm based algorithms, starting from the Genetics algorithm to recently popular [19, 20, 22], Bacteria foraging algorithm (BFO), Grey wolf algorithm and the list goes on [11]. Every metaheuristic algorithm has its own specific set of parameters and without proper knowledge of those parameters the algorithms are unable to provide their best results [11]. Keeping in mind those problems arising in metaheuristics due to improper parameters settings, a parameter free algorithm known as teacher learning based algorithm (TLBO) was proposed [12]. The Teacher learning based algorithm includes two stages and it has only two parameters, the size of the population and iteration numbers. Very recently keeping in mind the popularity of the TLBO algorithm, a parameter free algorithm, the JAYA algorithm was introduced, this algorithm is even simpler than the TLBO algorithm, having one stage only [12]. The JAYA algorithm is gradually getting popular, efficiently handling the engineering optimization problems [12], in facial emotion recognition [13], Dimensional optimization [14], economic optimization [15] etc. Thus, keeping in track with the above research findings, this paper proposes a novel improved JAYA algorithm as well as the framework for testing object-oriented programs. The metaheuristic Improved JAYA algorithm is employed in the proposed framework to automatically select a set of test suites to test the object-oriented triangle classification program. Results indicate that the JAYA algorithm provides good exploitation feature to generate test suits. The proposed work targets the following modules for fulfilling the above mentioned objectives,
-
Generation of test suites for testing the feasible test sequences of triangle classification problem using a novel Improved JAYA algorithm.
-
Generation of test suites for testing the feasible test sequences of triangle classification problem using Differential Evolution algorithm.
-
A set of experiments were carried out using the standard triangle classification problem followed by an exhaustive comparison between the metaheuristics i.e. JAYA, Differential Evolution and improved JAYA algorithms.
The remaining sections of this work are systematized as follows, the Sect. 2 conveys a detailed explanation of the classical JAYA algorithm, the novel improved JAYA algorithm and their specific set of parameters; Sect. 3 explains the suggested framework for the generation of feasible test suits, Sect. 4 includes the extensive experimental set up Sect. 5 provides experimental results and discussions with the detailed statistical analysis. Lastly, the conclusions and prospective future directions are projected in Sect. 6.
2 Proposed Algorithm
The metaheuristic Jaya algorithm [16] was introduced by Venkata Rao [14], it’s a very simple and parameter free algorithm that has been already used for numerous optimization problems in diverse domains of continuous space. In this paper an improved Jaya algorithm with improved exploration and convergence speed is proposed by adding an efficient mutation scheme the conventional JAYA algorithm. This improved Jaya algorithm was applied in one research work for automatic ear image enhancement of the ear biometric system [18]. It was noticed that the improved JAYA algorithm show better performance for image enhancement in comparison to other two metaheuristics i.e. PSO and Differential Evolution based image enhancement techniques. Therefore, this paper used the Improved JAYA algorithm as well as the Conventional JAYA algorithm and compared the performance of the respective algorithms with widely popular Differential evolution algorithm, in terms of test data generation and computational speed, for the first time in the field of object-oriented testing.
2.1 JAYA Algorithm
The metaheuristic JAYA algorithm is a parameter free optimization algorithm The principle of the algorithm is to obtain good solutions avoiding bad solutions. Iteration-wise updating each solution is mathematically expressed in [18] as follows:
where \(X_{i,j} \left( g \right)\) is the jth parameter value for ith solution at g iteration. \(X_{i,best} \left( g \right)\) is the value of the best solution for ith parameter at gth iteration and \(X_{i,worst} \left( g \right)\) is the value of the ith parameter for the worst solution at the same gth iteration. Two random numbers \(r_{1,i,j } {\text{are}}\) \(r_{2,i,j}\) generated in the range of [0, 1] at iteration g, \(X_{i,j} \left( {g + 1} \right)\) hold the updated values of the jth parameter for ith candidate solution in \(\left( {g + 1} \right).\) The neighborhood positions are exploited and candidate solutions are continuously upgraded in subsequent iteration using Eq. (1) to lead the convergence towards global solution. The two random numbers \(r_{1,i,j}\) and \(r_{2,i,j}\) help in improving the searching capability of Jaya algorithm. Initially the candidate solutions are updated at current iteration n, then based on fitness values the best individual solutions are updated after comparing the current solution \(X_j \left( g \right)\) and updated solution \(X_j \left( {g + 1} \right)\) for the next iteration \(\left( {g + 1} \right)\) as described in [22]:
Thus the solutions of subsequent iteration are better than the corresponding solutions of current iteration. The modified fitness values of the candidate solutions are the inputs for next iteration. In this manner the algorithm always converges towards best solution.
2.2 Improved JAYA Algorithm
In order to improve convergence rate, a mutation operator has been introduced with Jaya algorithm and the proposed technique is known as an improved version of Jaya algorithm (IJA). It is revealed in [18], that the Differential evolution metaheuristic algorithm shows better performance than the Particle Swarm Optimization algorithm in robust performance and faster convergence towards global optima. Therefore the mutation operator of the Differential Evolution algorithm has been used in the JAYA algorithm to add diversification. In order to establish balance between the exploitation and exploration strategies an adaptive mutation operator is introduced. Mathematically the mutation operator is defined in the following Eq. (3),
here \({\text{j}} \in \left\{ {1, \ldots ,{\text{K}}} \right\}\), jth candidate solution of the population of size K. Correspondingly, \({\text{r}}_1\), \({\text{r}}_2\), and \({\text{r}}_3\) are the indices of the candidate solutions \(\left\{ {1, \ldots ,{\text{K}}} \right\}.\) Here, F is the scaling factor used to avoid the population stagnation and to control the difference vector in the mutation operation, it is in the range of \(\left[ {0,\,1} \right].\) The an adaptive scaling factor has been used here is described as in Eq. (4).
where g and \(G_{max}\) are the current iteration and maximum number of iterations respectively. The rate of mutation in Eq. (3) can also be evaluated adaptively, and when in this manner a random real number, greater than the rate of mutation. is generated then the mutation operation will be performed.
The rate of mutation fluctuates between 1 to 0, through initial iteration to a maximum number of iterations.
3 Projected Framework
This work proposes a framework; Fig. 1 for testing object oriented programs using the UML state machine model of the triangle classification problem and a novel improved JAYA algorithm. Initially the UML state machine model; Fig. 2 is developed and then it is converted to state chart graph. After that the nodes and edges are assigned weights [1, 2]. Then the SCG graph is traversed using the DFS algorithm in order to find out the total path cost and the feasible paths. The fitness function of the feasible paths is the total path weight [1, 2]. The JAYA, improved JAYA and DE metaheuristic algorithms are applied to generate test suits, fulfilling the transition coverage criteria.
4 Experiments
First of all, a UML state machine model was generated using ArgoUML, for the example problem, i.e., classification of triangles. After that metaheuristic JAYA, improved JAYA and DE algorithms, are used to generate test suits automatically using Matlab R2016b.
The fitness function of the problem is the total path weights of respective feasible paths, it is a maximization problem. The range of data variation is –10000 to 10000. To verify the exploitation and exploration capabilities of the metaheuristic algorithms, i.e. JAYA, Improved JAYA and DE a number of experiments were conducted with varying populations (10, 20, 30) and fixed generation (10), and then with varying generations (20, 30, 50) and fixed populations (10). After that again the different combination of generation, 20, 30 and population 50, 100 were taken to thoroughly test the time complexity and exploration capabilities of the algorithms.
-
Case study
Triangle classification problem is the benchmark problem in software testing domain [1, 2], specifically test data generation [3, 9]. The distinctive attribute of the problem is, it needs separate groups of test data to test first the triangle properties and then the types of triangles like scalene, equilateral and isosceles. [1]. This problem is selected as the case study to automatically generate test suites using Improved JAYA, DE and JAYA algorithms. This example problem has four feasible path sequences and six states (S1, S2, S3, S4, S5, S6). The statistical results after using JAYA, DE, and improved JAYA algorithms are depicted in Table 2 and Table 3. The test suits generated for respective path sequences using improved JAYA, algorithm are represented in Fig. 3 and Fig. 4 respectively. The Fig. 5 and Fig. 6 are showing the test suites generated by all the three algorithms i.e., JAYA, DE and Improved JAYA. The Table 2 and Table 3, show the detailed statistical analysis of the test suits generated using the proposed framework and metaheuristic algorithms. In these tables the minimum and maximum point outs the lower number of test cases and maximum number of test cases generation for the individual path. The maximum point outs the upper bound in test cases generation for a particular path. The table shows a minimum value to be zero when in at least one of the executions no data is available for covering a path, in the same way if the maximum value provided is zero then it signifies no data is generated at all for testing that path. Lastly the Table 4 shows the execution time of the three algorithms (Table 1).
5 Results and Discussions
The aim of conducting the experiments with varying generations and populations was to figure out the exploration and exploitation capabilities of the algorithms. The detailed statistical analysis of the results like max, min, and average performance of the algorithms along with standard deviations were recorded in Table 2 and Table 3. The worst-case analysis of the algorithms shows that for path sequence 3, the critical path of the problem only improved JAYA achieved the best results, with large population size. The same trend is observed in average case analysis too. In most of the iterations the JAYA, improved JAYA, DE algorithms generated no data for path sequence2 and 3 whereas the Improved JAYA generated test data uniformly for every path sequence in case of maximum. The Fig. 3(a, b, c) depicts the test cases generated by improved JAYA with generation 10 and population variation 10, 20, 30, similarly Fig. 4(a, b, c) shows the test cases generated by improved JAYA with generation 20, 30,50 and population variation 10. In the next experiment the results of all the three algorithms for generating all four paths are recorded in Table 3 by varying the population to 10, 20, 50 and keeping the number of generations fixed at 10. The best, worst, and average case analysis of the results along with statistical analysis is provided in Table 3. Here it is observed that for path sequence 3, all of the three algorithms are providing almost zero results for best case in population 10 and 20, the DE is giving best result for only path sequence1 and JAYA for path sequence4 in all the three generations. The worst-case analysis shows that DE is giving best results for path sequence1, JAYA for path sequence 4, Improved JAYA for path sequence2 and 3. The average case analysis shows the same results. The Fig. 5(a, b, c) depicts the test cases generated by all the three algorithms at generation fixed at 10 and population size (30, 50,100). The Fig. 6(a, b, c) show the generated test cases, at generation fixed at 20 and population size (30, 50,100). When the results of Table 2, and Table 3 were compared, it was clear that the JAYA, DE and Improved JAYA, are not able to provide adequate number of test suits, when the population size and generations are small. The improved JAYA algorithm generated stable and uniform test suits, only when the population size is large.
6 Conclusions
The testing of object-oriented programs, particularly the test suite generation from design artifacts is a very difficult task. This work provided a novel Improved JAYA algorithm-based framework to generate optimized test suits. The optimal test suites were generated using the proposed framework and UML behavioral model. The proposed framework efficiently generated uniform test suits for all the feasible paths. The obtained simulation results ensured the efficiency of the improved JAYA algorithm over the performances of the individual JAYA and DE algorithm in terms of the exploration and exploitation capabilities. The framework can be further improved by using the hybrid version of this metaheuristic JAYA algorithm along with different UML diagrams.
References
Panda, M., Dash, S.: Test-case generation for model-based testing of object-oriented programs. In: Jena, A.K., Das, H., Mohapatra, D.P. (eds.) ICDCIT 2019. SBPR, pp. 53–77. Springer, Singapore (2020). https://doi.org/10.1007/978-981-15-2455-4_3
Panda, M., Dash, S.: Test suit generation for object oriented programs: a hybrid firefly and differential evolution approach. IEEE Access 8, 179167–179188 (2020)
Shirole, M., Kumar, R.: UML behavioral model-based test case generation: a survey. ACM SIGSOFT Softw. Eng. Notes 4(38), 1–13 (2013)
Utting, M., Pretschner, A., Legeard, B.: Taxonomy of model-based testing approaches. Softw. Test. Verif. Reliab. 5(22), 297–312 (2012)
Saeed, A.S., AbHamid, H., Mustafa, M.B.: The experimental applications of search-based techniques for model-based testing: taxonomy and systematic literature review. J. Appl. Soft Comput. 49, 1094–1117 (2016)
Harman, M., Jones, B.F.: The seminal workshop: reformulating software engineering as a metaheuristic search problem. ACM SIGSOFT Softw. Eng. Notes 6(26), 62–66 (2001)
Harman, M., McMinn, P.: A theoretical and empirical study of search-based testing: local, global and hybrid search. IEEE Trans. Softw. Eng. 2(36), 226–247 (2010)
Price, K.V.: Differential evolution. In: Zelinka, I., Snášel, V., Abraham, A. (eds.) Handbook of Optimization. Intelligent Systems Reference Library, vol. 38. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-30504-7_8
Panda, M., Dash, S.: Automatic test data generation using bio-inspired algorithms: a travelogue. In: Handbook of Research on Modeling, Analysis and Application of Nature-Inspired Metaheuristic Algorithms, pp.140–159. IGI Global (2018)
Samual, P., Mall, R., Bothra, A.K.: Automatic test case generation using unified modeling language (UML) state diagrams. IET J. Softw. 2(2), 79–93 (2008)
Molina, D., et al.: Comprehensive Taxonomies of Nature and Bio-inspired Optimization: Inspiration versus Algorithmic Behavior, Critical Analysis and Recommendations. arxivpreprint arXiv:2002.08136 (2020)
Rao, R.V.: A self-adaptive multi-population based Jaya algorithm for engineering optimization. Swarm Evol. Comput. 37, 1–26 (2017). https://doi.org/10.1016/j.swevo.2017.04.008
Wang, S.H., et al.: Intelligent facial emotion recognition based on stationary wavelet entropy and Jaya algorithm. Neurocomputing 272, 668–676 (2017). https://doi.org/10.1016/j.neucom.2017.08.015
Rao, R.V., et al.: Dimensional optimization of a micro-channel heat sink using Jaya Algorithm. J. Appl. Therm. Eng. 103, 572–582 (2016). ISSN: 1359-4311
Rao, R.V., et al.: Economic optimization of shell-and-tube heat exchanger using Jaya algorithm with maintenance consideration. Appl. Therm. Eng. 116, 473–487 (2017)
Rao, R.: Jaya: a simple and new optimization algorithm for solving constrained and unconstrained optimization problems. Int. J. Ind. Eng. Comput. 7(1), 19–34 (2016)
Cohen, B.: The Maturation of Search-Based Software Testing: Successes and Challenges. In: 12th International workshop on SBST (2019). ISBN: 978-1-7281-2233-5
Sarangi, P.P., et al.: An evaluation of ear biometric system based on improved Jaya algorithm and SURF descriptors. J. Evol. Intell. 13, 443–461 (2019)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2022 Springer Nature Switzerland AG
About this paper
Cite this paper
Panda, M., Dash, S. (2022). An Improved JAYA Algorithm Based Test Suite Generation for Object Oriented Programs: A Model Based Testing Method. In: Luhach, A.K., Jat, D.S., Hawari, K.B.G., Gao, XZ., Lingras, P. (eds) Advanced Informatics for Computing Research. ICAICR 2021. Communications in Computer and Information Science, vol 1575. Springer, Cham. https://doi.org/10.1007/978-3-031-09469-9_10
Download citation
DOI: https://doi.org/10.1007/978-3-031-09469-9_10
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-09468-2
Online ISBN: 978-3-031-09469-9
eBook Packages: Computer ScienceComputer Science (R0)