1,549
Views
1
CrossRef citations to date
0
Altmetric
FOOD SCIENCE & TECHNOLOGY

Quantum algorithm for solving the test suite minimization problem

ORCID Icon, & | (Reviewing editor)
Article: 1882116 | Received 15 Sep 2020, Accepted 24 Dec 2020, Published online: 10 Mar 2021

Abstract

Test-suite minimization problem is an essential problem in software engineering as its application helps to improve the software quality. This paper proposes a quantum algorithm to solve the test-suite minimization problem with high probability in O2n, where n is the number of test cases. It generates an incomplete superposition to find the best solution. It also handles the non-uniform amplitudes’ distribution case for the system with multisolutions. The proposed algorithm uses amplitude amplification techniques to search for the minimum number of test cases required to test all the requirements. The proposed algorithm employs two quantum search algorithms, Younes et al. algorithm for quantum searching via entanglement and partial diffusion to prepare incomplete superpositions that represent different search spaces such that the number of test cases is incremented in each search space, and updated Arima’s algorithm to handle the multisolutions case. The updated Arima’s algorithm searches for a quantum state that satisfies an oracle that represent the instance of the test-suite minimization problem.

Public Interest Statement

Test-suite minimization problem is an essential software engineering problem that has special importance in software testing. Evolutionary algorithms and other algorithms have been proposed to solve this problem. In this paper, a quantum algorithm is proposed to solve the est-suite minimization problem with high probability. Applying quantum algorithms to software engineering problems gives better results than that obtained using classical methods. This paper proposes a quantum algorithm that uses amplitude amplification techniques to search for the minimum number of test cases required to test all the requirements. The proposed algorithm employs two quantum search algorithms, Younes et al algorithm for quantum searching via entanglement to prepare incomplete superposition, and an updated Arima’s algorithm for searching the prepared search space for a possible solution to the given problem instance.

1. Introduction

Software testing is an essential stage in the software development life cycle. Redundant test cases can arise through the development of software versions. New test cases may arise for new versions of the software that cover the requirements tested by previous test cases for earlier software versions. Thus, software testing minimization techniques are required to reduce the number of test cases that cover the same requirements. Software testing minimization techniques are also required to utilize resources efficiently to reduce the cost and time requirements and to detect software bugs (Harman et al., Citation2012; Rothermel et al., Citation1998). There are many metaheuristic algorithms used to solve optimization problems, for example, quantum algorithms, quantum inspired algorithms, genetic algorithms, differential evolution, simulated annealing, ant and bee algorithms, bat algorithm, particle swarm optimization, and others as surveyed (Ahmed, Citation2016) and discussed next in this section.

Reduction can be performed classically using clustering such as Subashini and Jeyamala in 2014 (Subashini & JeyaMala, Citation2014) and Wang, Qu, Lu in 2015 (Wang et al., Citation2015) such that the program can be tested using any one of the clustered test cases. These clusters can be classified with the similarity in profiling (Alian et al., Citation2016) or by using the data mining approach of clustering (Wang et al., Citation2015). Many quantum algorithms are proposed to solve minimization problems for various applications, such as Anindita and Anirban (Banerjee & Pathak, Citation2009) who proposed a minimization algorithm for quantum circuit cost in 2010, where they minimize the number of gates in various selected quantum circuits. This algorithm can be applied on other circuits, but to do so, templates have to be developed for the corresponding gate library or the circuit has to be converted into other gate library with a previously prepared template. In 2020, Hussein, et al. (Hussein et al., Citation2020) proposed a quantum inspired algorithm that performs better than the classical genetic version of the algorithm. Orsan Ozener and Hasan Sozer (Orsan Ozener & Sozer, Citation2020) proposed a formulation of the test-suite minimization problem in 2020 that solves the issues in heuristic techniques or integer linear programming focusing on a specific criterion or bi-criteria. In 2020, Yinxing Xue, and Yan Li (Xue & Li, Citation2020) proved that integer linear programming models multi-criteria test-suite minimization then they proposed a multi-objective integer programming approach to solve it.

The aim of the paper is to propose a quantum algorithm to solve the test-suite minimization problem. The proposed algorithm consists of two stages: the first stage prepares an incomplete superposition of a search space with certain properties using Younes et al. algorithm for quantum searching via entanglement (Younes et al., Citation2008). The second stage searches for a solution of the test-suite minimization problem in the prepared incomplete superposition using an updated version of Arima’s algorithm for incomplete superposition searching (Arima et al., Citation2009).

This paper is organized as follows: Section 2 reviews the required background and discusses the quantum search algorithms used in the proposed algorithm. Section 3 proposes the quantum algorithm to solve the test-suite minimization problem. Section 4 shows the analysis of the searching phase. Section 5 discusses the proposed algorithm. Section 6 concludes the paper and mentions the future work.

2. Background

2.1. Test-Suite minimization problem

The aim of the test-suite minimization problem is to cover a given set of requirements with the smallest number of tests. The problem can be defined as follows (Panda & Mohapatra, Citation2017).

Given: A test suite T with a set of n test cases {t1, t2, t3, …, tn} and a set R of m test requirements {R1, R2, R3, …, Rm} that must be satisfied. Each test case must cover one or more requirements and a requirement can be covered by one or more test cases.

Required: Find the minimum subset of T that tests all the requirements.

For example, illustrates a given test suite showing the requirements that are covered by each test case. Many solutions can be found that cover all the requirements, but the target is to find the minimum number of tests that cover all the requirements. For example, all the requirements can be covered with the test set {t1, t2, t3, t4} or {t1, t2, t4}, but the minimum set which covers all the requirements is {t1, t2, t4}. It becomes more complicated with large data sets. The TestNo column represents the test case number, while the R s columns represent the requirements that are satisfied by each test case.

Table 1. Example for test-suite minimization problem

A test requirement matrix (TR) has to guarantee covering all the requirements, for example, to minimize the number of test cases shown in the test-suite minimization problem shown in , we start to represent the problem by its TR matrix as follows:

(1) TR=010111011001010100100101.(1)

To solve this instance of the test-suite minimization problem that is shown in , the minimal number of true assignments that satisfy the following Boolean formula should be found as follows:

(2) fTR=t4r1t1t2t3r2t2r3t1t3t4r4t1r5t1t2t4r6,(2)

which is a reduction of the test-suite minimization problem to the SAT problem (satisfiability problem).

2.2. Quantum computing

The elementary unit of data in quantum computing is the quantum bit or qubit. The qubit can be in a superposed state that is a combination of state |0 and state |1 and when a measurement is performed, the superposition is collapsed to one of the states in a probabilistic way. A combination of |0 and |1 before measurement is called a superposition as shown in EquationEquation 3 where α,β are complex numbers representing the probabilistic amplitudes of |0 and |1 respectively. The amplitudes must satisfy the condition in EquationEquation 4:

(3) |ψ=α|0+β|1,(3)

and

(4) |α|2+|β|2=1.(4)

One of the quantum properties is entanglement, which means that each object of the quantum system can’t be described independently, and instead, the quantum state has to be described for the whole system (Menon & Ritwik, Citation2014). Another feature in quantum computing is the parallelism where it takes a quantum computer a single step to operate on N inputs with a single gate, while the classical computer takes N steps for the same input size. Parallelism does not require additional hardware or to wait for other processes to complete, but it performs multiple operations at a time. Quantum gates are unitary operators, considering that a gate has s inputs, and then it can be represented as 2s×2s unitary matrix assuming that state |0=10 and state |1=01. Examples of such gates are:

The Hadamard gate with the following effect on |0 and |1:

(5) H.|0=12111110=1211=12(|0+|1).(5)
(6) H.|1=12111101=1211=12(|0|1).(6)

The X gate which is equivalent to the NOT gate in classical computers maps |0 to |1 and |1 to |0 as shown in the following equation:

(7) X.|0=011010=01=|1.(7)
(8) X.|1=011001=10=|0.(8)

The Z gate that does not change the state |0 but it converts |1 to |1 as shown in the following equation:

(9) Z.|0=100110=10=|0.(9)
(10) Z.|1=100101=01=|1.(10)

Quantum circuits are combinations of elementary quantum gates to perform a certain task.

2.3. Quantum searching algorithms

The aim of this section is to review the three quantum algorithms that will be used in the proposed algorithm: Grover’s algorithm for searching an unstructured list via phase shift (Younes, Citation2008), Younes et al. algorithm for searching an unstructured list via entanglement (Younes et al., Citation2008), and Arima’s algorithm for searching in an incomplete superposition (Arima et al., Citation2009).

Grover’s algorithm is a fast searching algorithm, Ventura added the feature of searching in a subset of the whole superposition to Grover’s algorithm, Arima amended Ventura’s algorithm to guarantee high probability results, and the Partial diffusion operator that updated Grover’s algorithm to guarantee high probability results in case of having multiple copies of the searched data.

2.3.1. Grover’s Algorithm

Grover’s algorithm can search an unstructured database of size N in O(N) given that N=2n. Grover’s algorithm requires the following initialization (Younes, Citation2008) of qubits where the first n qubits are initialized to state |0 and an extra workspace qubit initialized to state |1,

(11) |ψG0=|0n|1,(11)

then it applies Hn+1 on each of the n+1 qubits so that the first n qubits contain the N states representing the list and the extra qubit will be in state (|0|1)/2 as follows:

(12) |ψG1=1Ni=0N1|i|0|12.(12)

Grover’s algorithm then applies the oracle operator OG that evaluates a Boolean function fG:{0,1}n{0,1}. The operator OG gives the amplitudes of the matches a phase shift of eiπ(Younes, Citation2008) as shown in EquationEquation 13, and the system can be written as shown in EquationEquation 14.

(13) OG|x=|x,fG(x)=0|x,fG(x)=1.(13)
(14) OG|ψG1=1Ni=0N1|i|0fG(i)|1fG(i)2.(14)

Next, it applies the diffusion operator D on the first n qubits. The diffusion operator D is as follows:

(15) D=Hn(2|0n0|nIn)Hn,(15)

where In is the identity matrix of size N×N. Consider a general system |ψG2 of n qubits as follows:

(16) |ψG2=i=0N1αi|i.(16)

Applying D on the general system |ψG2 has the following effect:

(17) D|ψG2=i=0N1[αi+2α]|i,(17)

where α=1Ni=0N1αi represents the mean of the states’ amplitudes.

The oracle operator OG and diffusion operator D must be iterated approximately πN4 times. Measurement is then performed on the first n qubits to reveal one of the searched items.

2.3.2. Younes et al Algorithm

An unstructured database of size N can be searched with higher probability of success with an algorithm that uses the partial diffusion operator (Dp) in O(N/M) where M is the number of matches satisfying 1MN. This algorithm amplifies the amplitudes of the solutions via entanglement of the search space with the extra qubit that is useful in the preparation of the incomplete superposition that can be done by applying the measurement on the extra qubit (Younes et al., Citation2003).

Younes et al. algorithm requires the following initialization of n+1 qubits where the n+1 qubits are initialized to state |0 (Younes et al., Citation2008):

(18) |ψY0=|0n|0,(18)

then applies H on the first n qubits as follows:

(19) |ψY1=1Ni=0N1|i|0.(19)

This algorithm then applies the oracle operator OY on n+1 qubits where OY evaluates the Boolean function fY:{0,1}n{0,1} as shown in the following equation:

(20) OY|x,0=|x,0,fY(x)=0|x,1,fY(x)=1.(20)

Next, it applies the Dp operator which can be described in the following form (Younes et al., Citation2008):

(21) Dp=(HnI1)(2|0n+10|n+1In+1)(HnI1),(21)

where |0‘s size is 2N=2n+1, and the identity matrix Ik is of size 2k×2k.

Consider a general system |ψY2 of n+1 qubits as follows:

(22) |ψY2=k=02N1δk|k.(22)

The state |ψY2 can be re-written to

(23) |ψY2=i=0N1αi|i|0+i=0N1βi|i|1,(23)

where αi=δk:keven and βi=δk:kodd.

Applying Dp on the general system has the following effect:

(24) Dp|ψY2=i=0N1(2ααi)(|i|0)i=0N1βi(|i|1),(24)

where α=i=0N1αi/N is the mean of the amplitudes of the subspace entangled with the |0 of the extra qubit. The OY and Dp operators are iterated qy times where qy is as follows:

(25) qy=π22NM,1MN.(25)

Assume that is the sum over the desired M matches, while represents the sum over the NM undesired matches. The system after qy1 iterations can be described as follows:

|ψY3=aqi=0N1(|i|0)+bqi=0N1 (|i|0)
(26) +cqi=0N1 (|i|1),(26)

where aq, bq, and cq values are as follows: Let y=1MN and v=1N, and then (Younes et al., Citation2008),

(27) αq=yaq1+(1y)cq1,(27)
(28) a0=v,a1=v(2y1),aq=2αqaq1,(28)
(29) b0=v,b1=2vy,bq=2αqcq1,(29)
(30) c0=0,c1=v,cq=bq1.(30)

Finally, the first n qubits are measured to get one of the searched items.

2.3.3. Arima’s Algorithm

Grover’s algorithm is effective when the initial amplitude distribution of dataset is uniform, which means that N is equal to the number of stored data, but it is not always effective in the non-uniform cases where N is not equal to the number of stored data. Arima’s algorithm was proposed to solve the search in an incomplete superposition.

Given an incomplete superposition |ψin and an oracle UTR that evaluates to |1 for states in |ψin, and an oracle Ufh. It is required to find any state in |ψin that makes Ufh evaluate to 1. Arima’s algorithm is summarized as (Arima et al., Citation2009),

• Initial state |ψin.

• Repeat qa times, where qa=π4N.

|ψin=UTR|ψin.

ψin=Dψin .

ψin=Ufhψin.

|ψin=D|ψin ′′′.

• Observe the system.

The test-suite minimization problem definition has been illustrated. Quantum computing basics have been shown. Quantum searching algorithms that will be used in the proposed algorithm have been explained in detail.

3. The proposed algorithm

3.1. Methodology

The main idea of the proposed algorithm is to search the power set of the set of test cases in rounds, excluding the empty set since the problem is promised to have a solution. Each round searches simultaneously the set of all subsets from the power set that have the same cardinality, and if no solution is found, then increment the cardinality of the subsets in the search space next round. For example, given the set of test cases {t1, t2, t3, t4}, the first round searches in a search space that contains a single test, i.e. t1,t2,t3,t4, the second round searches in a search space that contains two tests, i.e. t1,t2,t1,t3,t1,t4,,t3,t4, and so on.

The proposed algorithm prepares an incomplete superposition using Younes et al. algorithm where all the states in the incomplete superposition have the same Hamming distance with the state |0n. Starting with hamming distance equals to 1, the proposed algorithm searches for a state that satisfies the oracle that represents the TR using an updated version of Arima’s algorithm. If the TR oracle is satisfied with a state in the prepared incomplete superposition, then the algorithm terminates and the truth assignment from the incomplete superposition is reported as the minimum solution, and otherwise prepare the next incomplete superposition with an incremented hamming distance and restart the algorithm.

The proposed algorithm has a maximum of O(log2N) rounds, where the first round will search in  nC1 states and the second round will search in  nC2 states and so on. After log2N rounds in the worst case, the algorithm will search the N states since i=0nnCi=N, where state |0n is excluded since it is guaranteed that the m requirements will be covered with a subset of the n test cases.

3.2. Problem encoding

Given a test-suite minimization problem as shown in . Assuming that all the requirements will be satisfied by a subset of the set of test cases, the problem can be represented as TR matrix, for example, the problem shown in X can be represented as shown in the TR matrix shown in EquationEquation 1. The TR matrix will be the input to the proposed algorithm.

The idea of the proposed algorithm is to represent the tests to be applied as quantum states, for example, given a set of tests {t1, t2, t3, t4}. Applying the subset {t1, t2, t4} is represented as the quantum state |1101. The proposed algorithm prepares an incomplete superposition of states with the same Hamming distance as will be illustrated next, for example, |0001, |0010, |0100, and |1000 have the same Hamming distance with state |0000, which is equal to 1. The algorithm then searches if the operator representing fTR is satisfied by one of these states, otherwise, increment the number of 1‘s in the prepared states and repeat the algorithm until a solution with the minimum number of tests is reached.

3.3. Preparation of states with a given hamming distance

A TR matrix of size n×m is considered as an input, and this means we will need to prepare n+1 qubit system. The quantum circuit shown in illustrates the algorithm steps, which will be explained in detail in this section.

Figure 1. Quantum circuit for the proposed algorithm

Figure 1. Quantum circuit for the proposed algorithm

The algorithm first initializes n+1 qubit system to |0 so that the system takes the following state:

(31) |ψ1=|0n|0,(31)

then apply H on the first n qubits to prepare the complete superposition. The system will be

(32) |ψ2=(HnI)|ψ1=1Ni=0N1|i|0.(32)

The TR matrix shown in will be taken as a working example to illustrate the proposed algorithm. Using the working example, the complete superposition stored in |ψ2 will be equal to

(33) |ψ2=14(|0000+|0001+|0010+|0011+|0100+|0101+|0110+|0111+|1000+|1001+|1010+|1011+|1100+|1101+|1110+|1111)|0.(33)

The proposed algorithm prepares superposition of states containing a specific t number of 1‘s that is nt states. For a set of states that have t number of 1‘s, define fh as follows:

(34) fh(x)=1,ifham(x)=h,h=1,2,,n0,o.w..(34)

Using the working example, fh can be written as follows (Younes & Rowe, Citation2015), where n=4 and t=3,

(35) fh=(t1t2t3t4)(t1t2t3t4)(t1t2t3t4)(t1t2t3t4).(35)

This can be represented as Reed–Muller expansion (Younes & Miller, Citation2004) so it can be represented as follows:

(36) fh=(t2t3t4)(t1t3t4)(t1t2t4)(t1t2t3),(36)

then the proposed algorithm applies the oracle Ufh for the function fh as shown in the quantum circuit in (Younes & Miller, Citation2004). Ufh is defined as follows:

(37) Ufh(|x>|0>)=(|x>|1>),fh(x)=1,(|x>|0>),fh(x)=0.(37)

Figure 2. Quantum circuit for the Ufh in .EquationEquation 36 and EquationEquation 37

Figure 2. Quantum circuit for the Ufh in .EquationEquation 36(36) fh=(t2∧t3∧t4)⊕(t1∧t3∧t4)⊕(t1∧t2∧t4)⊕(t1∧t2∧t3),(36) and EquationEquation 37(37) Ufh(|x>⊗|0>)=(|x>⊗|1>),fh(x)=1,(|x>⊗|0>),fh(x)=0.  (37)

In this paper, the quantum circuits for boolean functions will be represented as Reed–Muller expansions for illustration. In the proposed algorithm, the query complexity will be considered where using a boolean function will be counted once since the optimization of the quantum circuits for boolean functions is a different research area irrelevant to the scope of the paper.

After applying Ufh, we apply the partial diffusion operator as will be shown next. The current system can be rewritten as a summation of two subspaces, the subspace of the non-matches that is denoted as and the subspace of the matches that is denoted as ,

(38) |ψ3>=1Ni=0N1(|i>|0>)+1Ni=0N1(|i>|1>).(38)

Let us consider the following equation:

(39) |ψy>=|0>n|0>.(39)

The proposed algorithm applies DpUfh for q times, where

(40) q=π22Nnt.(40)

Then, the system will be updated to be

|ψy>=i=0N1 aq|i>|0>
+i=0N1bq|i>|0>
(41) +i=0N1cq|i>|1>.(41)

Using the working example with t=3 and n=4, q will be equal to π2, which is approximately 2 and the system will be updated as follows:

(42) |ψy>=18(|0000>+|0001>+|0010>+|0011>+|0100>+|0101>+|0110>+|1000>+|1001>+|1010>+|1100>+|1111>)|0>+38(|0111>+|1011>+|1101>+|1110>)|0>14(|0111>+|1011>+|1101>+|1110>)|1>.(42)

Then, the proposed algorithm applies measurement on the extra qubit and proceeds by applying Z then H on the extra qubit, if the outcome is |1>, otherwise restarts the preparation stage. The probability to get |1> on the extra qubit is nt|cq|2. If the outcome is |1>, then the superposition can be represented as

(43) |ψy >=1ntfh(i)=1|i>|1>(43)

Using the working example, assuming that Ufh is an oracle to prepare all possible states with t=3, applying DpUfh for q=2 times prepares all the possible solutions with t=3 resulting in the following incomplete superposition:

(44) |ψy >=12(|0111>+|1011>+|1101>+|1110>)|1>.(44)

3.4. Searching the incomplete superposition

Given an incomplete superposition of states that have a specific t number of 1‘s, we amended Arima’s algorithm (Arima et al., Citation2009) to search for the assignment that satisfies UTR in the case of having multisolutions. Considering the given matrix TR in EquationEquation 1, fTR can be represented as shown in EquationEquation 2 (Younes & Rowe, Citation2015). This can be represented as Reed–Muller expansion (Younes & Miller, Citation2004) so it can be represented as follows:

(45) fTR=t1t2t4,(45)

then use the oracle UTR for the function fTR in the algorithm as shown in the quantum circuit in (Younes & Miller, Citation2004).

Figure 3. Quantum circuit for the UTR

Figure 3. Quantum circuit for the UTR

The proposed algorithm amended Arima’s algorithm to search for the states that satisfy fTR in the prepared incomplete superposition in the case of having multisolutions, so we are searching for states recognized by fh and to satisfy fTR if exists, and otherwise, we prepare another an incomplete superposition with an incremented Hamming distance and repeat the algorithm. The updated Arima’s algorithm is applied for πN4 times and report whether or not the prepared superposition contains a state that satisfies fTR.

Using the working example with t=3 and n=4, the number of iterations of Arima’s algorithm, qa=2. The system of the working example will be updated as follows:

(46) |ψy  >=182(|0000>+|0001>+|0010>+|0011>+|0100>+|0101>+|0110>|0111>+|1000>+|1001>+|1010>|1011>+|1100>|1110>+|1111>)|0>+182(|0000>|0001>|0010>|0011>|0100>|0101>|0110>+|0111>|1000>|1001>|1010>+|1011>|1100>+|1110>|1111>)|1>+782(|1101>)|0>782(|1101>)|1>.(46)

The probability of the desired pattern is calculated as in Arima et al., (Citation2009) with a minimized value of the number of stored data because of our incomplete superposition preparation step, which in turn improves the probability. In the working example, the desired pattern of |1101> is obtained with probability 2(782)20.766.

The methodology of the proposed algorithm has been illustrated. Problem encoding, preparation phase, and searching the incomplete superposition phase have been explained.

4. Analysis of the searching phase

To analyze the dynamics of the searching phase, |ψy  > can be generalized to the form:

(47) |ψy  >=1hk=1hαk(tx)(|i>|1>)+1mhi=h+1mβi(tx)(|i>|0>)+1Nmj=m+1Nγj(tx)(|i>|1>)=α(tx)(|i>|1>)+β(tx)(|i>|0>)+γ(tx)(|i>|1>),(47)

where we define the average of the amplitudes of the subspace 1hk=1hαk(tx)(|i>|1>) of possible solutions at time tx by αk(tx) where k starts with 1 and increments to h where h representes the number of possible solutions. The average of the amplitudes of the subspace 1mhi=h+1mβi(tx)(|i>|0>) of non-solutions by βi(tx) where i takes the range of h to m. Thus, αk(tx) and βi(tx) are the average amplitudes of the subspace 1Nmj=m+1Nγj(tx)(|i>|1>) of the stored data, while the amplitude of the other data that were not in the prepared superposition at time tx is defined by γj(tx) where j takes values from m to N.

To calculate the averages of such amplitudes, we use the following equations:

(48) α(tx)=1hk=1hαk(tx),(48)
(49) β(tx)=1mhi=h+1mβi(tx),(49)
(50) γ(tx)=1Nmj=m+1Nγj(tx),(50)

considering that the initial distribution at tx=0 is arbitrary. The weighted average over states is calculated as follows:

(51) w(tx)=1N[j=m+1Nγj(tx)+i=h+1mβi(tx)k=1hαk(tx)]=1N[(Nm)γ(tx)+(mh)β(tx)(h)α(tx)].(51)

Then, the following relation holds based on (Biron et al., Citation1998):

(52) α(tx+1)=2w(tx )+α(tx ),(52)
(53) β(tx+1)=2w(tx )+β(tx ),(53)
(54) γ(tx+1)=2w(tx )γ(tx ).(54)

After solving EquationEquation 52, EquationEquation 53, and EquationEquation 54, the following amplitude averages can be calculated as follows:

(55) α(tx+1)β(tx+1)γ(tx+1)=N28N+8(mh)N28(mh)(Nm)N24(Nm)(N2m2h+1)N28(N(mh))N28(mh)(Nm)N2N24(Nm)(N2m2h+1)N24(N2(mh))N24(mh)(N2m)N28m(Nmh+1)+N2N2α(tx)β(tx)γ(tx).(55)

The analysis of the searching phase has been explained in detail. The amplitude averages can then be calculated at any given time tx.

5. Discussion

A pseudocode is shown in Algorithm 1 to summarize the proposed algorithm.

Algorithm 1: Pseudocode for the proposed algorithm

1. Prepare |ψ1>.

2. Apply H on the first n qubits.

3. for q=1 to π22Nnt do

4. Apply DpUfh on |ψ2>.

5. end for

6: Measure the extra qubit.

7. if The outcome is |1> then

8. Apply Z on the extra qubit.

9. Apply H on the extra qubit.

10. for qa=1 to π4N do

11. Apply DUfhDUTR on |ψy >.

12. end for

13. else

14. Go to step 2.

15. end if

The target of the proposed algorithm is to search for the best solution for the test-suite minimization problem. EquationEquation 31 shows the system initialization. The n+1 qubits are initialized to |0> and then H is applied to the first n qubits as shown in EquationEquation 32. These steps prepares the complete superposition. A superposition of t number of 1‘s is needed; thus, the oracle Ufh and the partial diffusion operator Dp are applied for q times as shown in EquationEquation 40. This step prepares the incomplete superposition that contains a candidate solution we are trying to find. The extra qubit is then measured to amplify the amplitudes of the solutions via entanglement of the search space with this extra qubit. In case that the outcome is |1>, Z is applied on the extra qubit, and then H is applied on this extra qubit to update the system to be as shown in EquationEquation 44. The updated version of Arima’s is then applied to search for the best solution in the prepared incomplete superposition. EquationEquation 47 shows the system after applying the updated Arima’s algorithm qa times in its general form. EquationEquation 47 also shows the average amplitudes for the possible solutions represented by α(tx), the average amplitudes for the non-solutions represented by β(tx), and the average amplitudes for the other data that were not in the prepared superposition represented by γ(tx) and the weighted averages are shown in EquationEquation 51. The average of the amplitudes can be calculated at any time tx by EquationEquation 55. The proposed algorithm has a maximum of O(log2N) rounds.

This paper proposes a solution to the test-suite minimization problem. It is crucial to software testing because it helps developers to improve the software quality by finding the minimum test that covers all the requirements. Test sizes increase with software modifications over time in the maintenance phase; thus, the proposed algorithm is significant to find the minimum number of tests through this periodic test size growth. The proposed algorithm saves software testing resources such as time and money by finding the minimum sized solution with high probability.

6. Conclusion and future work

This paper proposed a quantum algorithm to solve the test-suite minimization problem. The proposed algorithm used quantum search algorithms to search for the minimum number of test cases required to test all the requirements. The algorithm encoded a subset of the power set of the set of test cases as quantum states. The two main phases of the algorithm are the states preparation phase and the searching phase. In the preparation phase, the algorithm used Younes et al algorithm for quantum searching via entanglement and partial diffusion to prepare an incomplete superposition that represents a subset of sets from the power set that have the same cardinality. The searching phase was applied by amending Arima’s algorithm to find a possible solution to the given test-suite minimization problem instance in the prepared incomplete superposition. If no solution is found, then the algorithm prepares another incomplete superposition with the cardinality of the subsets in the search space incremented next round. Applying this algorithm to a test-suite minimization problem instance gives the best solution with the minimum required test cases that saves software testing resources such as time and money. The proposed algorithm is crucial while testing the software in the maintenance phase as test sizes increase with software modifications over time. Applying the proposed algorithm is important in case of software growth from a version to another where a requirement that is tested in a previous version will be tested again in the newer version that may result in redundant test cases.

The algorithm needs Olog2N rounds to search the power set of all possible solutions. It was shown that the algorithm can find a solution with high probability in O2n, where n is the number of test cases.

For future work, we intend to propose efficient quantum algorithms to solve other software engineering problems such as next release problem and the structural test data generation problem (Harman et al., Citation2012).

Disclosure statement

No potential conflict of interest was reported by the authors.

Data Availability

The data are readily available upon request.

Additional information

Funding

The authors received no direct funding for this research

Notes on contributors

Hager Hussein

Hager Hussein is an Assistant Lecturer in Software Engineering Department, College of Computing and Information Technology (CCIT), Arab Academy for Science, Technology and Maritime Transport (AASTMT). She received her MSc degree in software engineering from CCIT in AASTMT in 2012. Her research interests include quantum algorithms, software engineering.

Ahmed Younes

Ahmed Younes is a Professor of Computer Science at Alexandria University and Honorary Research Fellow at School of Computer Science, University of Birmingham, United Kingdom. He is the founder and leader of Alexandria Quantum Computing Group. He obtained his PhD from University of Birmingham, United Kingdom, in 2004. He published many papers on Quantum Algorithms and Reversible Circuits.

Walid Abdelmoez

Walid M. Abdelmoez is an Associate Professor in Software Engineering Department, CCIT, AASTMT. He received PhD degree in computer engineering at Lane Department of Computer Science and Electrical Engineering, West Virginia University, Morgantown, WV, USA, in 2006. His research interests are software engineering, software quality assurance, software risk assessment.

References

  • Ahmed, B. S. (2016). Test case minimization approach using fault detection and combinatorial optimization techniques for configuration-aware structural testing. International Journal of Engineering Science and Technology, 19(2), 737–16.
  • Alian, M., Suleiman, D., & Shaeout, A. (2016). Test case reduction techniques - Survey. (IJACSA) International Journal of Advanced Computer Science and Applications, 7(5), 264–275.
  • Arima, K., Shigei, N., & Miyajima, H., A proposal of a quantum search algorithm, Fourth International Conference on Computer Sciences and Convergence Information Technology, Korea. https://doi.org/10.1109/ICCIT.2009.126, (2009).
  • Banerjee, A., & Pathak, A. (2009). An algorithm for minimization of quantum cost, Applied Mathematics & Information Sciences. arXiv: 0910.2129v2, 6(1).
  • Biron, D., Biham, O., Biham, E., Grassl, M., & Lidar, D. A. (1998). Generalized grover search algorithm for arbitrary initial amplitude distribution. Lecture Notes In Computer Science, 1509, 140–147.
  • Harman, M., McMinn, P., de Souza, J. T., & Yoo, S., Search based software engineering: Techniques, taxonomy, tutorial, LASER Summer School 2008–2010, LNCS 700, Springer, pp. 1–59 (2012).
  • Hussein, H., Younes, A., & AbdelMoez, W. (2020). Quantum- inspired genetic algorithm for solving the test suite minimization problem. WSEAS TRANSACTIONS on COMPUTERS, 19, E-ISSN: 2224-2872. https://doi.org/10.37394/23205.2020.19.20.
  • Menon, P. S., & Ritwik, M., A comprehensive but not complicated survey on quantum computing, International Conference on Future Information Engineering, China, pp. 144–152 (2014).
  • Mohapatra, S. K., & Prasad, S. (2015). Test case reduction using ant colony optimization for object oriented program. International Journal of Electrical and Computer Engineering (IJECE), 5(6), 1424–1432. https://doi.org/10.11591/ijece.v5i6.pp1424-1432
  • Orsan Ozener, O., & Sozer, H. (2020). An effective formulation of the multi-criteria test suite minimization problem. Journal of Systems and Software, 168. ISSN: 0164-1212. https://doi.org/10.1016/j.jss.2020.110632
  • Panda, S., & Mohapatra, D. P. (2017). Regression test suite minimization using integer linear programming model. Software: Practice & Experience, 1539–1560.
  • Rothermel, G., Harrold, M. J., Ostrin, J., & Hong, C.(1998). An empirical study of the effects of minimization on the fault detection capabilities of test suites, International Conference on Software Maintenance, Luxembourg. https://doi.org/10.1109/icsm.1998.738487 .
  • Srivastava, P. R., & Kim, T. (2009). Application of genetic algorithms to software testing. International Journal of Software Engineering and Its Applications, 3(4).
  • Subashini, B., & JeyaMala, D., Reduction of test cases using clustering technique. International journal of innovative research in science, engineering and technology, vol. 3, Special Issue 3, International Conference on Innovations in Engineering and Technology (ICIET’14), Malaysia, pp. 1992–1995 (2014).
  • Wang, R., Qu, B., & Lu, Y. (2015). Empirical study of the effects of different profiles on regression test case reduction. IET Software, 9(2), 29–38. https://doi.org/10.1049/iet-sen.2014.0008
  • Xue, Y., & Li, Y. (2020). Multi-objective integer programming approaches for solving the multi-criteria test-suite minimization problem: Towards sound and complete solutions of a particular search-based software-engineering problem. ACM Transactions on Software Engineering and Methodology, 29(3), 1–50. https://doi.org/10.1145/3392031
  • You, L., & Lu, Y. (2012). A genetic algorithm for the time-aware regression testing reduction problem, International Conference on Natural Computation, China.
  • Younes, A. (2008). Strength and weakness in grover’s quantum search algorithm. arXiv:0811.4481v1.
  • Younes, A., & Miller, J. F. (2004). Representation of boolean quantum circuits as reed-muller expansions. International Journal of Electronics, 91(7), 431–444. https://doi.org/10.1080/00207210412331272643
  • Younes, A., Rowe, J., & Miller, J. (2003). Quantum search algorithm with more reliable behaviour using partial diffusion, AIP Conference Proceedings, USA. https://doi.org/10.1063/1.1834408
  • Younes, A., Rowe, J., & Miller, J. (2008). Enhanced quantum searching via entanglement and partial diffusion, Physica D: Nonlinear Phenomena, 237(8), 1074-1078.
  • Younes, A., & Rowe, J. E. (2015). A polynomial time bounded-error quantum algorithm for boolean satisfiability. arXiv:1507.05061v2.