samedi 3 octobre 2015

µJava Is not killing Mutants?

i am using µJava for mutation testing of my java program. as i am learning mutation testing.

i have 2 classes

1 : Parent

public class Parent 
{
public String temp;
public int number;

public Parent(String temp)
{
    this.temp = temp;
    this.number = 20;
}

public String printTemp()
{       
    return "temp is : "+temp+number;
} 
} 

and 2 : Child

public class Child extends Parent
{
public int number;

public Child(String temp)
{
    super(temp);
    this.number = 5;
}

public String printTemp()
{
    String temp = "i am fake !";
    int number = 766;
    return "temp is : "+super.temp+this.number+"c";
}
}

and i am applying IOD operation of muJava. `hence it is generating mutant . it is deleting overridden method printTemp of child class.

my TestCase is :

public class MyTest
 {
    public String test1 ()
      {  
      String result;

     Parent p1 = new Parent("i am temp of parent");

      Child c1 = new Child("i am temp of child");

      Parent p2 = new Child("i am both !");

      result = ""+ c1.printTemp() + p1.printTemp() + p2.printTemp(); 

      return result;
      }
   }

But when i am running Mutation Testing , i have found the mutant lived. i want to kill it ! What can i do ??

Aucun commentaire:

Enregistrer un commentaire