Re: [android-developers] Re: Reflection API:List all classes in a package that extend a specific super class

2011-02-25 Thread donV
Thanks!  This was very helpful!

I have it running now.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Reflection API:List all classes in a package that extend a specific super class

2011-02-25 Thread Kostya Vasilyev

Don,

ActivityInstrumentationTestCase2 has a method, getInstrumentation(), 
which gives you an Instrumentation object instance that's used in the test.


Instrumentation has getContext() which gives you your test package's 
context object, now you can access its resources (as opposed to 
resources of the target application - those are under getTargetContext()).


http://developer.android.com/reference/android/app/Instrumentation.html#getContext()

Now you can call getResources() on your test package's context, and the 
rest should be easy:


- Either call getAssets() to get AssertManager and then list() to get 
the list of script files;


- Define a 's within your test package resources, with 
references to individual XML entries, one array per test case. Load the 
array with res.getIntArray(), then call res.getXml() to open individual 
scripts.


I'd do the latter, to separate the scripts for individual tests from one 
another.


Hope this helps.

-- Kostya

25.02.2011 12:58, donV ?:

Thank you for your reply!

Very possibly there is another solution.

The problem to be solved is that I want to run some test scripts 
stored as assets to test multiple activities.


The test scripts need access to the activity to be tested.  This is 
normally done by subclassing ActivityInstrumentationTestCase2, so my 
plan was to generate subclass of ActivityInstrumentationTestCase2 for 
each activity to be tested, and let this class scan the assets 
directory for related test scripts and run them.


Using junit.framework, I would like to define one TestCase per script, 
or multiple TestCase instances per script.  If the suite() method of 
the ActivityInstrumentationTestCase2 subclass could scan the assets 
directory, I would not need to scan for classes.  Is this possible? 
 How can I scan assets in a static context?


--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en 



--
Kostya Vasilyev -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Reflection API:List all classes in a package that extend a specific super class

2011-02-25 Thread donV
Thank you for your reply!

Very possibly there is another solution.

The problem to be solved is that I want to run some test scripts stored as 
assets to test multiple activities.

The test scripts need access to the activity to be tested.  This is normally 
done by subclassing ActivityInstrumentationTestCase2, so my plan was to 
generate subclass of ActivityInstrumentationTestCase2 for each activity to 
be tested, and let this class scan the assets directory for related test 
scripts and run them.

Using junit.framework, I would like to define one TestCase per script, or 
multiple TestCase instances per script.  If the suite() method of the 
ActivityInstrumentationTestCase2 
subclass could scan the assets directory, I would not need to scan for 
classes.  Is this possible?  How can I scan assets in a static context?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Reflection API:List all classes in a package that extend a specific super class

2011-02-25 Thread Kostya Vasilyev
What for? Perhaps there is another solution?
25.02.2011 12:38 пользователь "donV"  написал:
> Hi!
>
> Did you ever solve this? I desperately need to list all classes in a
> package.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Reflection API:List all classes in a package that extend a specific super class

2011-02-25 Thread donV
Hi!

Did you ever solve this?  I desperately need to list all classes in a 
package.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en