Class AetgSatAlgorithm


  • public class AetgSatAlgorithm
    extends Object
    Implementation of the AETGSat variant of the AETG algorithm from "Constructing Interaction Test Suites for Highly-Configurable Systems in the Presence of Constraints: A Greedy Approach".

    The first step of generating a new test case is choosing a value for a single parameter. This value is chosen by taking the parameter-value pair that is contained in the most remaining uncovered t -way combinations. Subsequently, a random order of remaining parameters is chosen. These parameters are then iterated in this order, always greedily choosing a value so that the largest amount of additional combinations are covered. When all parameters are set, all contained combinations are marked as covered and the generation for the next test case can start. Once full coverage is reached all generated test cases are aggregated to a covering array. Because the size of this array heavily depends on the random parameter orders, this whole process is repeated for a fixed number times. In the end the covering array with the smallest number of test cases is selected.

    It also supports constraints by excluding invalid combinations from the covering array, as well as checking each test case with a SAT checker before adding it to the covering array.

    • Constructor Detail

      • AetgSatAlgorithm

        public AetgSatAlgorithm​(AetgSatConfiguration configuration)
        Constructor.
        Parameters:
        configuration - the configuration. It may not be null.
    • Method Detail

      • getMutatedTestCase

        public Optional<int[]> getMutatedTestCase​(int parameter,
                                                  int[] testCase,
                                                  List<int[]> lastMutations)
        Gets a mutated test case for localizing fixed parameters.
        Parameters:
        parameter - the parameter to mutate
        testCase - the test case to mutate
        lastMutations - the already done mutations.
        Returns:
        a single test case, or an empty optional if no test case could be found
      • getNextTestCase

        public Optional<int[]> getNextTestCase()
        Generate a singe test case.
        Returns:
        a single test case, or an empty optional if no test case could be found
      • generate

        public List<int[]> generate()
        Generate a complete covering array.
        Returns:
        a list of test cases that cover all t-way combinations
      • updateCoverage

        public void updateCoverage​(int[] testCase)
        Mark a test case as covered.
        Parameters:
        testCase - the test case that was covered
      • addForbiddenCombination

        public void addForbiddenCombination​(int[] combination)
        Add a forbidden combination to the constraints.
        Parameters:
        combination - the combination to add
      • selectDissimilar

        public int[] selectDissimilar​(int[] failureInducingCombination,
                                      int[] failure,
                                      List<int[]> lastFeedback)
        Select a combination that covers the most uncovered combinations and is the most dissimilar to a given other combination. This is used for feedback checking.

        Because this method is stateful, a list of the last feedback rounds need to be supplied.

        Parameters:
        failureInducingCombination - the combination that should be feedback checked
        failure - the failure the FIC belongs to
        lastFeedback - the last rounds of feedback checking
        Returns:
        a dissimilar test case that covers the most uncovered combinations