1

Java プログラムの突然変異テストにµJavaを使用しています。私は突然変異テストを学んでいるので。

私は2つのクラスを持っています

1 : 親

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;
} 
} 

および 2 : 子

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";
}
}

そして、muJavaのIOD操作を適用しています。`したがって、それは変異体を生成しています。子クラスのオーバーライドされたメソッド printTemp を削除しています。

私のテストケースは:

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;
      }
   }

しかし、 Mutation Testing を実行していると、変異体が生きていることがわかりました。殺したい!私に何ができる ??

4

1 に答える 1