holmos.webtest.junitextentions.rules.RepeatRunStatement Maven / Gradle / Ivy
package holmos.webtest.junitextentions.rules;
import holmos.webtest.junitextentions.annotations.RunCount;
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.Statement;
/**
* @author 吴银龙([email protected])
* */
public class RepeatRunStatement extends Statement{
private Statement base;
private FrameworkMethod method;
public RepeatRunStatement(Statement base,FrameworkMethod method){
this.base=base;
this.method=method;
}
@Override
public void evaluate() throws Throwable {
int count=1;//默认为1次
RunCount runCount=method.getAnnotation(RunCount.class);
if(null!=runCount){
count=runCount.runCount();
}
while(count!=0){
base.evaluate();
count--;
}
}
}