Thanks Richard.
I think for now at least, though crude way, I found a way to get
through this.
1. I added this code as a debug to find the list of all methods
available during the findgetter:
com.googlecode.autoandroid.positron.ReflectionUtils.java -> findGetter
(..):
try {
Method [] methods = target.getClass().getMethods();
for (Method m : methods) {
Log.d("ReflectionUtils-AllMethods", "Method :" + m.getName() + "
in " + target.toString() );
}
} catch (SecurityException e) {
throw new RuntimeException(e.getMessage(), e);
}
I went through all the methods available for the TabActivity().
It has the "getCurrentActivity()". So using this I was able to get the
listView that belonged to the Activity being run in the Tab just like
any activity.
-- stringAt("CurrentActivity") -> returned me the activity that was
embebeded in the Tab.
-- int selectedItemPosition = intAt
("CurrentActivity.selectedItemPosition") --> returned the selected
item Position that I could use.
This is really cool.
Now l am looking to see if I use two Positron enabled applications to
do some functional + concurrent test scenarios.
Example:
1. Launch a story/testcase of one app (say apidemos), perform a few
actions.
2. Launch another story of another app(notepad), say add a note
3. Return to a 2nd story in the first app (apidemos) and continue with
other actions.
Probably I am not the first one to try this, Any ideas if we can do
this, even if it means creating every small operation into its own
test case and may be use ant to invoke one test at a time and piece
together a full functional scenario.
So far I have found that at the end of each case, the application is
closed. Is it how JUnit works? I browsed through to see if there is
any place the application is closed, I have not yet found it.
--
On Apr 30, 12:19 pm, Richard Cook <
richardgc...@gmail.com> wrote:
> Looks like TabActivity inherits ActivityGroup functionality which provides
> you access to the LocalActivityManager.
>
> Check out the LocalActivityManager, see if that puts you in the right
> direction.
>
> TabActivity seems similar to an embedded activity. Here is how I have seen
> embedded activities work:
>
> SuperActivity extends ActivityGroup - This is the parent Activity
> Activity1 - embedded in SuperActivity
> Activity2 - embedded in SuperActivity
> Activity3 - embedded in SuperActivity
>
> When testing, I start up superactivity, which by default spawns activity 1 2
> or 3. I Can then use the localactivitymanager to click through each activity
> by controlling the super activity. Hard to explain with out code, but i
> can't show the code since it is for work.
>
> Hope that puts you on the right direction.
>
> On Thu, Apr 30, 2009 at 12:03 PM, Raghu <
rghve...@gmail.com> wrote:
>
> > Thanks Phil, Richard,
>
> > That solved both 2 and 3.
>
> > For TabActivity, I can seem to get access to tabWidget that belongs to
> > the main app.
> > The one thing I am able to get is the name of the tab etc (stringAt
> > ("tabWidget.1.1.text");
>
> > The Tab view in the tabActivity is an activity on its own like in
> > Tabs3 in the apisdemo sample (
http://developer.android.com/guide/
> > samples/ApiDemos/src/com/example/android/apis/view/Tabs3.html<
http://developer.android.com/guide/%0Asamples/ApiDemos/src/com/exampl...>
> > )