2012-06-18 5 views
2

Robotium 테스트 스위트를 사용하고 있는데, 이는 첫 번째 테스트 만 실행 한 다음 그 후에 멈 춥니 다. 프로그램을 몇 분 동안 실행 시키지만 "테스트 실행 중"이라고 표시됩니다. 여기 내 코드 :Robotium이 (가) 모든 테스트를 실행하지 않습니다.

import com.jayway.android.robotium.solo.Solo; 
import android.test.ActivityInstrumentationTestCase2; 

@SuppressWarnings("unchecked") 
public class ODPRobotiumTest extends ActivityInstrumentationTestCase2 { 

    private static final String TARGET_PACKAGE_ID = "com.gravitymobile.app.hornbill"; 
    private static final String LAUNCHER_ACTIVITY_FULL_CLASSNAME = "com.vzw.odp.LaunchActivity"; 

    private static Class<?>launcherActivityClass; 

    static{ 
     try{ 
      launcherActivityClass = Class.forName(LAUNCHER_ACTIVITY_FULL_CLASSNAME); 
     } catch (ClassNotFoundException e){ 
      throw new RuntimeException(e); 
     } 
    } 

    @SuppressWarnings({ "unchecked", "deprecation" }) 
    public ODPRobotiumTest() throws ClassNotFoundException{ 
     super(TARGET_PACKAGE_ID, launcherActivityClass); 
    } 

    private Solo solo; 

    @Override 
    protected void setUp() throws Exception{ 
     solo = new Solo(getInstrumentation(), getActivity()); 
    } 

    public void testLine1(){ 


     solo.searchText("Easy to Find");   

    } 
    public void testLine2(){ 



     solo.searchText("Hassle-Free"); 


    } 
    public void testLine3(){ 




     solo.searchText("Trust"); 


    } 
    public void testLine4(){ 

     solo.searchText("Verizon Curated Wallpaper"); 


    } 
    public void testLine5(){ 

     solo.searchText("Taco's"); 

    } 
    @Override 
    public void tearDown() throws Exception{ 
     try{ 
      solo.finalize(); 
     }catch(Throwable e){ 
      e.printStackTrace(); 
     } 
     getActivity().finish(); 
     super.tearDown(); 
    } 
} 

도움이 될 것입니다. 감사! (나는이 문제가 될 것이라고 생각하지 않을지라도)

enter image description here

답변

1

따라서 답변을 찾았습니다. tearDown() 메소드에 solo.finishOpenedActivities();을 포함해야합니다. 그러면 테스트가 완료되고 새 테스트가 시작됩니다. 아휴!

도움을 주신 모든 분들께 감사드립니다!

1

당신은 당신의 테스트에서 어떤 주장을하지 않아도 그들은 '가 된 JUnit 패널 쇼 미상 무엇 : 여기

는 Junit와이다 다시 뛰고 있니?

또는 시도는 :

public void testLine1(){ 
    assertTrue(solo.searchText("Easy to Find"));   
} 
+0

assertTrue를 사용할 때 내가 추가 한 그림에서 볼 수 있듯이 테스트가 실패합니다. 그 테스트에서 당신이 제안한 것처럼 첫 번째 줄에 어설트 트루를 사용했는데 실패했습니다. 그러나 제가 찾고있는 것은 프로그램에 있습니다. 그것은 나에게 거짓 부정을주고 있습니다. – BlackHatSamurai

+0

@BlaineAnderson 잘 됐네요. 최소한 첫 번째 테스트가 달리고 매달려 있다고 지적 했어요. – Blundell

1

당신은 제품군의 일부로 실행 할 시험 항목을 주석해야합니다. 시도하십시오 :

@Smoke 
public void testLine1(){ 
    solo.searchText("Easy to Find"); 
} 

이 테스트에서 아무 것도 주장하지 않으므로 아직 유용하지 않습니다. 코드가 제대로 작동하는지 확인하려면 어설 션을 추가해야합니다.

+0

고마워요, 이걸 시도 할게요. – BlackHatSamurai

+0

죄송합니다. 그러나 이것은 작동하지 않습니다. ( – BlackHatSamurai

+1

이것은 Junit3입니다. 테스트에 주석을 달 필요가 없습니다. 메소드 이름을'public void test'로 시작하면됩니다. – Blundell

관련 문제