上周基于JUnit写了个简单的性能测试框架,其实就是用了下Annotation,发现还是很好用的。
/**
* Performance test annotation.
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface PerformanceTest
{
public String name() default "";
public int times();
public boolean stopOnError() default false;
}