Software testing has been attracting a lot of attention for effective software development. In model driven approach, Unified Modelling Language (UML) is a conceptual modelling approach for obligations and other features of the system in a model-driven methodology. Specialized tools interpret these models into other software artifacts such as code, test data and documentation. The generation of test cases permits the appropriate test data to be determined that have the aptitude to ascertain the requirements. This paper focuses on optimizing the test data obtained from UML activity and state chart diagrams by using Basic Genetic Algorithm (BGA). For generating the test cases, both diagrams were converted into their corresponding intermediate graphical forms namely, Activity Diagram Graph (ADG) and State Chart Diagram Graph (SCDG). Then both graphs will be combined to form a single graph called, Activity State Chart Diagram Graph (ASCDG). Both graphs were then joined to create a single graph known as the Activity State Chart Diagram Graph (ASCDG). Next, the ASCDG will be optimized using BGA to generate the test data. A case study involving a withdrawal from the automated teller machine (ATM) of a bank was employed to demonstrate the approach. The approach successfully identified defects in various ATM functions such as messaging and operation.
Software testing is a vital yet resource-intensive portion of the software development life cycle that uses up a considerable share of the budget as well as time. Testing automation is a routine and essential part of the software development path in our efforts to address these concerns. A test case can be mined automatically from different Unified Modelling Language (UML) models. When software testing is carried out on such test cases with adequate test data, it enhances trust in the software produced. In addition, test data can be mined from the test cases that use the test specifications [
Model-driven testing is used to mechanically devise test cases by means of models with system features and software stipulations. It also provides details about the software specifications that can be executed. This type of testing describes the behavioural, systemic dimensions for employing the software [
In the case of a genetic algorithm (GA), every person is chosen on the basis of the populace-based candidate solution for the problem. The relevant GA facets are crossover, selection, and mutation. The key steps of the GA are as follows: First is the initialization of individuals. Next comes choosing the best person utilising the Roulette Wheel approach. Crossover is then employed for generating the most appropriate solution and generating the finest strings by mutation. The GA seeks the best possible solution from several likely solutions within a search field. The GA depends on an approach that is purely a globally random search. A GA is an optimization algorithm that is obtained from consideration of natural selection and evolution and is commonly utilized to address intricate issues. The GA produces a preliminary number of different populaces. It then creates the succeeding generation through crossover and mutation, which produces a fresh batch of individuals [
In this study, we consider the Automatic Teller machine (ATM) as an example for our approach. The ATM is a machine that mainly dispenses cash money and performs several automatic banking services. This machine is convenient. It allows customers to perform quick self-service transactions such as cash withdrawals, deposits, mutual account transactions, and bill payments. However, conventional ATM services are inefficient and time-consuming. The optimization of withdrawal operations at ATMs helps decrease financial inefficiencies due to unused stocked cash. Predicting cash demand is very challenging because of the unpredictability of withdrawal operations. Moreover, these specific processes are characterized by huge inherent redundancy dynamics and large sets of randomized test cases [
This paper is organized as follows. Section 2 presents a synopsis of the literature for this research field. Section 3 presents the recommended system and also elucidates the Activity State Chart Diagram Graph (ASCDG). Section 4 defines the approach and presents the discussion and simulation outcomes. Lastly, Section 5 describes the conclusion and makes recommendations for future work.
Test cases are produced and optimized by requirement stipulations and, in particular, by the program code that can be tough to imbrute [
Researchers have focused on a technique that looks at how test cases are produced but are not optimized using the Hybrid Particle Swarm Optimization (HPSO) algorithm [
The Ant Colony Optimization (ACO) algorithm, a state-based system, has also been used in software testing [
In a comparative study, Abdul et al. [
Another study described a technique that is utilized to produce the test cases from combinational UML diagrams such as sequence and activity diagrams [
Researchers have elucidated how the test cases are spawned from a combinational diagram such as a sequence and use case diagram [
Suresh et al. [
The creation and optimization of test cases has been carried out by means of various soft computing methods centered on test coverage norms within a Java setting [
The authors of another study stated that the best possible optimisation methods should be utilised in finding solutions for multi-objective functions [
Explanations about test case generation and optimization from UML models instead of combinational models [
The following constraints have been noted and require further work.
Most studies explain the generation and optimization of test data but fail to take execution time into consideration.
Most studies have not focused on test scenarios.
Most research has not focused on model-driven testing techniques.
This study describes and evaluates a method that uses GA to generate test cases from UML diagrams.
Problems of prediction for heuristic data are challenging due to the random and redundant features of such time series and the conventional global-learning models used for computational intelligence [
The GA implements the rules of transformation of individuals and provides a solution to these constraints. It identifies all suitable individuals by observing their values for functional fitness before combining these individuals and their values to create new potential candidate solutions.
The most crucial steps are
Generation or initialization of individuals.
Choosing the best individuals using roulette wheel selection.
Crossover to create enhanced solutions from the best solution.
Mutation to generate best strings.
The GA flowchart is shown in
The activity diagram offers a way to symbolize the step-by-step business workflow and relates to operational components. The activity diagram and the corresponding graph (ADG) that describe the general operation of a bank ATM as presented earlier [
Symbol | Activity name | Possible number of outputs | Dependence | Input | Expected outputs | |
---|---|---|---|---|---|---|
A | Insert PIN | 1 (B) | X | Enter PIN by using user prompt | B: PIN validation | |
B | Validate PIN | 2 (C, F) | A | PIN is provided by the user | C: PIN Valid | |
F: PIN Invalid | ||||||
C | Entering the withdrawal amount | 1 (D) | B | Enter the withdrawal amount through user prompts | D: Check for the amount and forward | |
D | Withdrawal of amount checked | 1 (D1) | C | Withdrawal amount is entered by the user | E: Amount is checked | |
E | Enquiry about the balance | 1 (Z) | D | Remaining balance is found after withdrawal operation | Z: Correct final result | |
F | Error message displayed | 1 (Y) | B, D | Invalid input | Y: Message displayed for incorrect withdrawal amount |
The state chart mostly offers descriptions of state transitions. It also focuses on the events that influence state changes. The state chart diagram (SCD) and its corresponding diagram (SCDG) are shown in
Symbol | Activity name | Possible number of outputs | Dependence | Input | Expected outputs | |
---|---|---|---|---|---|---|
D1 | Check the amount whether it is positive or non-zero | 2 (D2, Y1) | X1 | The user entered the amount | D2: Check for the amount and forward | |
Y1: Invalid amount | ||||||
D2 | Check withdrawal limit | 2 (D3, Y1) | D1 | The user entered the amount | D3: Check for the amount and forward | |
Y1: Invalid amount | ||||||
D3 | Check if the amount is a multiple of 100 or not | 2 (D4, Y1) | D2 | The user entered the amount | D4: Check for the amount and forward | |
Y1: Invalid amount | ||||||
D4 | Checked the withdrawal limit for today | 2 (D5, Y1) | D3 | The user entered the amount | D5: Check for the amount and forward | |
Y1: Invalid amount | ||||||
D5 | Check bank balance availability | 2 (Y1, Z1) | D4 | The user entered the amount | Z1: Amount is checked |
In this case, a combination of nodes, edges, and branches is used to serve as the coverage criteria in ASCDG. The ASCDG corresponding to a cash withdrawal operation from a cash point is shown in
Symbol | Activity name | Possible number of outputs | Dependence | Input | Expected outputs | |
---|---|---|---|---|---|---|
A | Insert PIN | 1 (B) | X | Enter PIN by using user prompts | B: Validate the PIN and is forwarded | |
B | Validate PIN | 2 (C, F) | A | PIN provided by the user | C: Valid PIN | |
F: Invalid PIN | ||||||
C | Enter the withdrawal amount | 1 (D) | B | Enter withdrawal amount by using user prompts | D: Amount is forwarded to be checked | |
D | Check withdrawal amount | 1 (D1) | C | Withdrawal amount entered by the user | D1: Amount is forwarded to be checked | |
D1 | Check the amount if it is positive or non-zero | 2 (D2, F) | D | The user entered the amount | D2: Forwarded amount is further checked | |
F: Invalid amount | ||||||
D2 | Check withdrawal limit | 2 (D3, F) | D1 | The user entered the amount | D3: Forwarded amount is further checked | |
F: Invalid amount | ||||||
D3 | Check if amount is a multiple of 100 or not | 2 (D4, F) | D2 | The user entered the amount | D4: Forwarded amount is further checked | |
F: Invalid amount | ||||||
D4 | Check the withdrawal limit for today | 2 (D5, F) | D3 | The user entered the amount | D5: Forwarded amount is further checked | |
F: Invalid amount | ||||||
D5 | Check bank balance availability | 2 (E, F) | D4 | Amount entered by the user | E: Amount is checked | |
F: Invalid amount | ||||||
E | Balance enquiry | 1 (Z) | D5 | Remaining balance after withdrawal operation | Z: Correct final result | |
F | Display error message | 1 (Y) | B, D1, D2, | Invalid input | Y: Message displayed for incorrect withdrawal amount | |
D3, D4, D5 |
An initial population of individuals is generated in this method. The corresponding fitness function values for individuals are also assessed. Next, the current best solution is evaluated. The best solution is chosen using the roulette wheel selection method. The best solution selected is put in the mating pool. An improved best solution is produced by performing a single point crossover using two solutions from the mating pool. The genetic mutation was conducted on the improved solutions before the best solution is computed. This process is performed until the termination condition is achieved. Random generation of the initial population is performed using their fitness functional value. Next, the best initial optimum solution is stored. If there is a high fitness functional value, then the solution tends to lean towards the optimum value. The GA is divided into three primary phases: selection, crossover, and mutation. In the selection process, the relative fitness and total fitness functional values for every solution are assessed using the roulette wheel selection technique. In the crossover phase, the selection of the best solutions for the mating pool is performed, and the rest are discarded. This phase generates new solutions. In the mutation phase, candidate solutions are enhanced by changing the values in small increments. If a better solution is identified, the old solution is replaced, and the replacement serves as the new solution.
Net-amt indicates the total balance amount in the account of the customer as defined in the program code. Min-bal indicates the lowest balance that needs to be maintained by the customer. Wd-amt represents the amount to be withdrawn by the customer. The successful transactions are represented by Test-data. Fail-bal and Suc-bal indicate the transactions that failed or were successful, respectively. The test cases in this scenario are created and optimised through ASCDG by the application of BGA.
The generation of test cases by the application of BGA was carried out as follows:
Ensure the application of GA to the ASCDG. Find the fitness functional value of every component of ASCDG.
The functional fitness value was determined as follows:
where
Hint: The fitness functional expression described in
Find the initial best solution and subsequently group the fitness functional values according to the population.
while generation < 500 do:
//Selection//
Assess the relative fitness and total fitness of each solution using the roulette wheel selection method, where every chromosome is dependent on the fitness functional value.
Determine the actual count and the exact count.
Place the best solutions in the mating pool and remove the remaining solutions.
//Crossover
Execute single point crossover on each individual to form the new population.
//Mutation
By modifying the values by a slight amount, determine the mutation value of each individual.
Test the boundary conditions.
//New fitness function is evaluated
Update the best solution
//
The best or the most optimal solution is ascertained based on the fitness functional value.
The relative fitness, during the selection process of the genetic algorithm, can be computed using the following relationship:
where
The actual count and exact count can be computed as follows:
where
Let us take into consideration the mathematical function
The best solution is selected and placed in the mating pool using the roulette wheel selection method. Single point crossover is performed to generate an enhanced best solution that uses two solutions from the mating pool. Next, the genetic mutation is performed on the amended solutions to further compute the best solution. The process continues until the termination criterion is met. The optimum solution is established after BGA is applied and the function is maximized through MATLAB-7.0. The various iterations are represented in
Sol. # | Actual value | Chromosome before crossover | Chromosome after crossover | Actual value | |||||
---|---|---|---|---|---|---|---|---|---|
1 | 1300 | 5.2364e −010 | 0.21684 | 1.0842 | 1 | 0 0 0 1 0 1 0 1 | 0 0 0 1 0 1 0 1 | 4000 | 5.9488e −010 |
2 | 3600 | 5.8344e −010 | 0.20007 | 1.0004 | 1 | 0 0 0 0 1 0 1 1 | 0 0 0 0 1 0 1 0 | 2000 | 5.4083e −010 |
3 | 800 | 5.1186e −010 | 0.19823 | 0.99115 | 1 | 0 0 0 0 1 0 1 0 | 0 0 0 0 1 0 1 0 | 1800 | 5.3583e −010 |
4 | 1900 | 5.3832e −010 | 0.19462 | 0.97308 | 1 | 0 0 0 0 10 0 0 | 0 0 0 0 1 0 0 1 | 1800 | 5.3583e −010 |
5 | 1700 | 5.3336e −010 | 0.19024 | 0.95119 | 1 | 0 0 0 0 0 1 0 1 | 0 0 0 0 0 1 0 1 | 1100 | 5.1888e −010 |
SUM | 2.73e −009 |
Sol. # | Actual value | Chromosome before crossover | Chromosome after crossover | Actual value | |||||
---|---|---|---|---|---|---|---|---|---|
1 | 4000 | 5.9488e −010 | 0.2182 | 1.091 | 1 | 0 0 0 1 0 1 1 1 | 0 0 0 1 0 1 1 0 | 4200 | 6.0073e −010 |
2 | 2000 | 5.4083e −010 | 0.19838 | 0.99189 | 1 | 0 0 0 0 1 1 0 0 | 0 0 0 0 1 1 0 0 | 2500 | 5.5363e −010 |
3 | 1800 | 5.3583e −010 | 0.19655 | 0.98273 | 1 | 0 0 0 0 1 0 1 0 | 0 0 0 0 1 0 1 0 | 1900 | 5.3832e −010 |
4 | 1800 | 5.3583e −010 | 0.19655 | 0.98273 | 1 | 0 0 0 0 1 0 1 0 | 0 0 0 0 1 0 1 0 | 1900 | 5.3832e −010 |
5 | 1100 | 5.1888e −010 | 0.19033 | 0.95164 | 1 | 0 0 0 0 0 1 1 0 | 0 0 0 0 0 1 1 1 | 1500 | 5.2847e −010 |
SUM | 2.76e −009 |
Sol. # | Actual value | Chromosome before crossover | Chromosome after crossover | Actual value | |||||
---|---|---|---|---|---|---|---|---|---|
1 | 4200 | 6.0073e −010 | 0.2177 | 1.0885 | 1 | 0 0 0 1 1 0 0 0 | 0 0 0 1 1 0 0 1 | 4600 | 6.1268e −010 |
2 | 2500 | 5.5363e −010 | 0.20063 | 1.0031 | 1 | 0 0 0 0 1 1 1 0 | 0 0 0 0 1 1 1 1 | 2900 | 5.642e −010 |
3 | 1900 | 5.3832e −010 | 0.19508 | 0.97541 | 1 | 0 0 0 0 1 0 1 1 | 0 0 0 0 1 0 1 1 | 2000 | 5.4083e −010 |
4 | 1900 | 5.3832e −010 | 0.19508 | 0.97541 | 1 | 0 0 0 0 1 0 1 1 | 0 0 0 0 1 0 1 0 | 2100 | 5.4335e −010 |
5 | 1500 | 5.2847e −010 | 0.19151 | 0.95755 | 1 | 0 0 0 0 1 0 0 1 | 0 0 0 0 1 0 0 0 | 1800 | 5.3583e −010 |
SUM | 2.80e −009 |
The simulation results taking into consideration 20 test cases, which have been optimised through the use of BGA, are presented in
A comparative study with the work of Suresh [
Iteration number | ||
---|---|---|
Present work | BGA | 160 |
Work of Yeresime Suresh [ |
BCA | 180 |
PSA | 172 | |
GA | 169 |
The results obtained from the BGA strategy (
The main advantage of the designed approach is that the BGA needs less CPU time to achieve a global optimum than other testing methods. In addition, the density of global solutions is reduced when compared to the whole input search area. Equally important, our study demonstrates that BGA-generated test data are efficiently enhanced compared with data generated randomly. Nevertheless, it should be noted that one of the disadvantages of the GA is the random selection of the test case in each testing progression. Consequently, the selected test may not cover the maximum, and it can generate large fault rates of detection.
The most elementary steps for an automated testing process comprise developing the dependence table, designing the dependence graph, and creating the possible paths. The strategy recommended here has the capability to develop the dependence table and regulate the flow graph with less CPU execution time and more accuracy. The issue of automated generation was analysed in this study. Optimization of test cases was achieved by adopting BGA through UML combinational diagrams (ASCDG). The suggested scheme helps to create a more efficient process that enables improvement of software quality performance. Additionally, it offers inspiration to researchers to attain further enhancement of software features. Future software will be used with BGA in the future to improve software performance and reduce costs. The processes that will be developed in this way are likely to be used through various UML models using combinational graphs.
Future directions for this research include improving the generation of automated test data for large-scale and complex platforms. The current techniques create test data based on small programs and simple structures. Moreover, areas of future research should establish test data that exploit a multiple path fitness function for the flow graph control. Exploiting BGA can be enhanced by investigation of code coverage and merging with other meta-heuristic techniques such as chaotic particle swarm algorithms.