Android Robotium - How to manage the execution order of testcases?

喜你入骨 提交于 2019-12-19 20:00:11

问题


I am trying to use Robotium to automate the testing of an application. The test cases were documented and they are supposed to be test in specific order. But it seems that Junit run the tests in alphabetic order.. how do I rearrange the order of execution? Here is the basic structure of my test class:

public class ETTerminalTest extends ActivityInstrumentationTestCase2<IdleActivity> {
   private Solo solo;
   private static final Logger LOGGER = LoggerFactory.getLogger(ETTerminalTest.class);

   public ETTerminalTest() {
       super("com.employtouch.etterminal.ui.activity", IdleActivity.class);
   }

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

   @Smoke
   public void testEnterPin() throws Exception {
       ...
   }

   @Smoke
   public void testWhatEver() throws Exception {
       ...
   }
   @Smoke
   public void testSomethingElse() throws Exception {
       ...
   }
    @Override
    public void tearDown() throws Exception {
        try {
            //Robotium will finish all the activities that have been opened
            solo.finalize();    
        } catch (Throwable e) {
                e.printStackTrace();
        }
        getActivity().finish();
        super.tearDown();
    } 
}

回答1:


I am not sure for Robotium, but the test order for normal jUnit test cases can be managed by creating a test suite. I guess it should be same in this case as well.(I haven't tried it myself). Some info here.



来源:https://stackoverflow.com/questions/8217248/android-robotium-how-to-manage-the-execution-order-of-testcases

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!