Android 在Robolectric中多次运行测试

Android 在Robolectric中多次运行测试,android,testing,junit,robolectric,test-runner,Android,Testing,Junit,Robolectric,Test Runner,我想运行一个测试多次。例如,假设我有这样一个测试类:- RunWith(RobolectricTestRunner.class) public class Common { int n = 0; @Test public void shouldRun() { System.out.println(n++); ... } } @RunWith(ExtendedRobolectricTestRunner.class) publi

我想运行一个测试多次。例如,假设我有这样一个测试类:-

RunWith(RobolectricTestRunner.class)
public class Common {
     int n = 0;
     @Test
     public void shouldRun() {
          System.out.println(n++);
     ...
     }
}
@RunWith(ExtendedRobolectricTestRunner.class)
public abstract class Common  {    

    @Retention(RetentionPolicy.RUNTIME)  
    @Target({ElementType.METHOD})  
    public @interface Repeat {  
          int value();  
    }  

    int n = 0;

    @Test
    @Repeat(10)     
    public void shouldRunCase1Port() {      
        System.out.println(n++);
}
现在,我如何继续重复测试直到满足一个条件,比如假设n=10,然后停止

我尝试了中所述的方法,并创建了一个自定义测试运行程序,它扩展了RobolectrictTestRunner,并编写了如下测试类:-

RunWith(RobolectricTestRunner.class)
public class Common {
     int n = 0;
     @Test
     public void shouldRun() {
          System.out.println(n++);
     ...
     }
}
@RunWith(ExtendedRobolectricTestRunner.class)
public abstract class Common  {    

    @Retention(RetentionPolicy.RUNTIME)  
    @Target({ElementType.METHOD})  
    public @interface Repeat {  
          int value();  
    }  

    int n = 0;

    @Test
    @Repeat(10)     
    public void shouldRunCase1Port() {      
        System.out.println(n++);
}
但是没有成功。 有人能给我一些建议吗