I don't know of a way to pass arguments to a TestCase directly, but I
think if you sub-class android.test.InstrumentationTestRunner, and
override its onCreate method, you should be able to get access to key
value pairs passed to am via the Bundle argument.
ie public class FooRunner extends android.test.InstrumentationTestRunner {
@Override
public void onCreate(Bundle args) {
super.onCreate(args);
String value = args.getString("fookey");
// ...
}
You would run your tests via:
adb shell am instrument -w -e fookey <value> <package>/.FooRunner
On Wed, Jun 10, 2009 at 9:29 PM, dev<[email protected]> wrote:
>
> Any input would be of great help...
> Thanks,
> Dev
>
> On Jun 10, 6:16 pm, dev <[email protected]> wrote:
>> Hi,
>>
>> I intend to right a simple instrumentation class using
>> android.test.InstrumentationTestCase.
>> I have two simple testcases inside it which does nothing but printing
>> the Log.
>> My instrumentation code does not launch any activity or connect to
>> service,or has intents etc.
>>
>> What I am looking for is,
>> Pass some arguments from commandlline , this can be along with am
>> command, and access it in my testcases as input configuration for my
>> tests. (something similar to argc argv in c programming)
>>
>> I know that using 'am' we can pass key,value pair to intents , but I
>> have instrumentation, not an activty or any intetnt.
>>
>> I wven though of having parameters my testcases, but then they are not
>> identified as tests by test runner.
>>
>> How do I produce commandline input to my test cases.
>> Is there any way to do this ?
>>
>> Any input would be of help.
>>
>> Thanks and Regards,
>> dev
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---