Rick, Thanks so much for posting your findings. They are helpful.
Zhao On Apr 28, 9:36 am, Rick <[email protected]> wrote: > Android functional testing across multiple activities: > > Since no one has really shown how to do this, and Android really only > shows us testing a single activity, > testing more complex applications will need cross-activity testing. > How to do it? > > 1. Use InstrumentationTestCase > 2. Use an ActivityManager to maintain the scope of the application, > allowing you to grab the activity you want. > 3. Use Instrumentation to put the application in the desired state > 4. Most importantly, make sure to clean up after your test, other wise > it will hang. > > All android testing runs through the setUp and TearDown before each > test. So if you have a test class with 5 tests, > it will run through the set up and tear down before each test. > > You might be able to get around this by implement the @BeforeClass and > @AfterClass for a global setUp and TearDown > that can be spread across the test suite, I haven't explored that yet. > Hope this helps anyone looking for this. > > On Apr 17, 4:58 pm, Richard Cook <[email protected]> wrote: > > > So I've learned a bit more about the Instrumentation, but now I am at a > > point where it HANGS if I have more than one test case running. > > > I'm running a cross-activity functional test case using > > InstrumentationTestCase. > > > I have to run handles for the ActivityGroup, currentActivity, and the > > activityManager. > > I also instantiate an activity monitor so I know when to wait for other > > activities to finish executing. > > > The problem now is, I run more than one test, and the instrumentation test > > runner hangs on the second test case in the stack. > > > Anyone!? > > > On Fri, Apr 17, 2009 at 10:41 AM, z <[email protected]> wrote: > > > > +1 > > > > On Apr 16, 8:52 am, Rick <[email protected]> wrote: > > > > I've been exploring the Android test package and I'm very confused on > > > > how to implement functional testing for endpoint-to-endpoint. > > > > > Consider the example below, I have 4 activities: > > > > 1. A Contact List Activity > > > > 2. A View Contact Activity > > > > 3. An Add/Edit Contact Activity > > > > 4. A Sync Contact List activity > > > > > I want to automate a few tests that will go through multiple test > > > > cases simulating a user experience: > > > > From launching the application, to selecting 'Add contact;' opening > > > > the add contact activity, > > > > entering data, saving it, going back to the list activity, and > > > > verifying the new contact was saved properly. > > > > > As I understand it, ActivityInstrumentationTestCase<T extends > > > > Activity> and ActivityUnitTestCase<T extends Activity>, are only > > > > useful for testing single activity functionality. > > > > > But what if I need to switch between 2 or more activities inside a > > > > single functional test case? > > > > > Any help would be greatly appreciated. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

