2013-04-10 2 views
2

Robotium에서 안드로이드 응용 프로그램의 여러 데이터를 사용하여 단일 테스트 사례를 여러 번 실행할 수있는 방법이 있습니까? 매개 변수화 된 주스 테스트와 같습니다. 매개 변수가있는 Robotium

public class UserTest extends 
     ActivityInstrumentationTestCase2<MainActivity> { 

public UserTest() { 
     super(TestActivity.class); 
    }  

    @Override 
    public void setUp() throws Exception { 
     // setUp() is run before a test case is started. 

     // This is where the solo object is created. 
     solo = new Solo(getInstrumentation(), getActivity()); 
    } 

public void testUserData1() throws Exception { 

     // UserBean 
     Bean bean = setUp.get(0); 
     dataTest(bean); 

    } 



    public void testUserData2() throws Exception { 

     // UserBean 
     Bean bean = setUp.get(1); 
     dataTest(bean); 

    } 
public void dataTest(Bean bean) { 
     Log.e("testAddNote userbean", bean.toString()); 

     // Login 
     solo.enterText(0, bean.getUserName()); 
     solo.enterText(1, bean.getPassWord()); 
     solo.clickOnButton(0); 
} 

이 현재 내가 테스트 케이스를 실행하고 방법

이는 dataTest (콩) 내가 다른 매개 변수와 함께 하나의 메소드를 여러 번 호출해야 parameters.Means로 설정 요소를 여러 번 실행 할 수있는 방법입니다. 당신이이 경우 https://code.google.com/p/zohhak/

를 사용하는 경우

답변

2

난 그냥 당신이 할 수있는이 만 작동하는지주의 사항 :

@TestWith({ 
      “2, true”, 
      “6, false”, 
      “19, true” 
}) 
public void testPrimeNumberValidator(int number, boolean isPrime) { 
assertThat(… 
}