1

In my test class, i have multiple test cases written. Now when I run the test project, after each test case the app is getting stopped and started again. In teardown I am calling solo.finishOpenedActivities().

I want to run all test cases without closing the activities.

I tried to remove solo.finishOpenedActivities from the tearDown method. In that case the next testCases are not getting executed and the test hangs after the first one.

So what is the proper way to have multiple test cases and not close the activities and continue running all the tests?

serv-inc
  • 35,772
  • 9
  • 166
  • 188

1 Answers1

0

If the functionalities between your test cases are dependent on each other, then instead of writing them in separate testcases, write different functions related to different functionality and call then in same testcase according to their order of execution.

Because, after completion of each testcase, robotium will definitely close the activity and start a new activity for the other testcase.

serv-inc
  • 35,772
  • 9
  • 166
  • 188
kamal_prd
  • 543
  • 4
  • 16
  • Thanks but my tests are a bit complex. For example I have to add some items in a shopping cart by various ways like search, browse etc in other activities. And then I want another test case which tests checkout based on this cart. – Raquibul Bari Sep 10 '13 at 06:29
  • There you can make a function for searching, where you can select some items. Another function, where you can validate the checkout with same item which had been searched. Call the search function followed by checkout function in a testcase (keeping the same items in both the functions, so that there would not be any prolem regarding mismatch of selected and checkout item). – kamal_prd Sep 10 '13 at 07:06
  • Thanks @kamal will work on those. I am marking your item as answer. Can I order the test case execution, currently they are alphabetically done. Anyway, that might be a separate question. – Raquibul Bari Sep 10 '13 at 07:43
  • 1
    for your concern regarding order of execution following two links would be helpful : http://stackoverflow.com/questions/8217248/android-robotium-how-to-manage-the-execution-order-of-testcases and http://stackoverflow.com/questions/13149817/how-to-create-a-robotium-testsuite – kamal_prd Sep 10 '13 at 08:03