Research Article

Multiobjective Genetic Algorithm for Class Testing using OCL Class Contract Specifications: A Framework

Algorithm 1

Chromosome fitness value by coverage (CCFA) [30].
INPUT:
One State Coverage Weight (wCoveredOnce),
Weight for state covered Twice (wCoveredTwice)
Weight for state covered more than Twice (wCoveredMoreThanTwice)
OUTPUT: Chromosome Fitness (CF)
(1)Initialize CF = 0
(2)for each Chromosome c in the current population do
(3)for each Gene in c do
(4)  if occurs once then
(5)   CF = CF + wCoveredOnce
(6)  end if
(7)  if occurs twice then
(8)   CF = CF + wCoveredTwice
(9)  end if
(10)  if occurs more than twice then
(11)   CF = CF + wCoveredMoreThanTwice
(12)  end if
(13)end for
(14) Set coverage fitness of c equals CF
(15)end for