简体   繁体   中英

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

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();
    } 
}

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM