# Adaptive Test Suits Generation for Self-Adaptive Systems Using SPEA2 Algorithm
## 3 Proposed Approach-SPEA2-SAS  
### Optimizing Test Cases Generation for Large Adaptive Systems  
The SPEA2-SAS approach is based on a feature model for handling runtime testing. SPEA2-SAS is a framework specifically designed for running testing operations. A framework for handling runtime testing activities, such as the adaptation in terms of SAS feature model configuration and execution of test cases and test suites, is called SPEA2-SAS. SPEA2-SAS carries out two primary jobs to aid in this strategy. Each SAS configuration has an adaptive test strategy specified at design time, where each adaptive test strategy consists of numerous test suites and each SAS configuration corresponds to a specific operational scenario. Second, each time a new SAS configuration is run, SPEA2-SAS conducts a testing cycle that may include numerous iterations that each run a distinct test suite. Anadaptive test strategy includes every test suite that might be created for a specific operating environment or set of system and environmental characteristics. To do this, for each SAS setup, SPEA2-SAS creates an adaptive test strategy that consists of a default test suite and several intermediate, automatically created test suites. We also need to discuss how the intermediate test suites are derived at runtime as well as how the default test suites are derived at design time.  
For illustration purposes, consider that a SAS test engineer is setting up an adaptive test strategy for a certain SAS configuration in response to a specific set of operational conditions. In our case, two objectives need to be optimized: (1) testing cost and (2) the number of test cases that need to be optimized using the SPEA2 algorithm. There will be two types of test cases, valid tests and invalid tests, depending on the valid and invalid configurations of the feature model as a SAS configuration. To achieve optimized test adaptation, the SPEA2-SAS approach dynamically develops test suites at runtime. A new optimized test suite is generated based on the SAT solver methodology adopted in our research work. The SAT solver approach has been mentioned in this research work, which helps to select the features, and the SPEA2-SAS optimizer used a recursive loop that searched for feature combinations dynamically. Due to the continuous dynamic environment, the encoded recursive loop continuously adapts the SAS in order to enhance quality in terms of two-objective optimization. The adaptation process monitors the SAS and parameter values then finally updates the objective functions. The proposed selection searches for the best-balanced solution for adaptation in the form of non-dominated solutions. We consider a solution's execution order as a separate concern from optimization. We thus expect that, given a legitimate and optimal solution, the proposed method will enforce the proper order of execution by assessing the dependencies in the feature model.  
If any fault occurs in terms of invalid test suits, the SAS infrastructure should reconfigure the feature model system and launch a fresh testing cycle with the reactivation of the valid test cases. The SAS can change features at runtime to optimize for different nonfunctional quality parameters like response time, cost, etc. SAS is frequently built to dynamically search for the feature combinations that lead to the best solutions to accomplish this aim and the adoption of search algorithms.  
Figure 1 shows the SPEA2-SAS architecture with two main components: (1) describes the configuration scenario that creates valid configurations, (2) responsible for an adaptable scenario based on an evolutionary algorithm with the capacity to adapt feature combinations at runtime to optimize for various nonfunctional quality metrics, such as reaction time and cost.