我正在使用µ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;
}
}
但是当我运行突变测试时,我发现突变体还活着。我想杀了它!我能做些什么 ??