简体   繁体   中英

Junit method testing conditions

Suppose i have this java method :

boolean sample(){
  boolean returne = false;
  if( (a>b || b>c) && d>e ){
    returne = true;
  }
 return returne;
}

To be sure i have unit tested well my method, should i include all those scenarios in my unit tests methods :

  • Test where a>b or b>c and d>e
  • Test where a=b or b=c and d=e
  • Test where a
  • Test where a>b or b=c and d>e
  • .... and going with all the possibilities...

@abubakkar所建议的Pitest.org是此请求的答案,该工具通过更改类的字节码来进行突变测试,从而针对所有可能的失败,错误,未发现的错误进行测试...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM