[android-developers] Custom instrumentation test runner fails on android-8

2011-02-27 Thread donV
Hi all!

I have made a custom instrumentation test runner, see below.  This works 
fine on android-9, but fails on android-8.  Is this a known issue?  If so, 
is there are workaround for android-8?

 public class InstrumentationTestRunner extends 
android.test.InstrumentationTestRunner {

public TestSuite getAllTests() {

suite = new TestSuite(Sweet);

suite.addTest(new TestCase(Success 1) {

public void runTest() throws java.lang.Throwable {

// Success

}

});

suite.addTest(new TestCase(Success 2) {

public void runTest() throws java.lang.Throwable {

// Success

}

});

suite.addTest(new TestCase(Error) {

public void runTest() throws java.lang.Throwable {

throw new RuntimeException(Error!);

}

});


return suite;

}


logcat gives nothing useful:

I/TestRunner(  552): started: Success 
1(org.ruboto.test.InstrumentationTestRunner$1)

I/ActivityManager(   68): Force stopping package org.ruboto.sample_app 
uid=10036


-- 
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: Custom instrumentation test runner fails on android-8

2011-02-27 Thread donV
Found a workaround:  Set the name of the test to runTest.  Is there a way to 
detect the api-level of the device running the tests?

public class InstrumentationTestRunner extends 
android.test.InstrumentationTestRunner {

public TestSuite getAllTests() {

suite = new TestSuite(Sweet);

suite.addTest(new TestCase(runTest) {

public void runTest() throws java.lang.Throwable {

// Success

}

});

suite.addTest(new TestCase(runTest) {

public void runTest() throws java.lang.Throwable {

// Success

}

});

suite.addTest(new TestCase(runTest) {

public void runTest() throws java.lang.Throwable {

throw new RuntimeException(Error!);

}

});


return suite;

} 

} 

-- 
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] ant run-tests returns code 0 even if tests fail

2011-02-27 Thread donV
Hi all!

When running ant run-tests and getting test failures, ant still says 
BUILD SUCCESSFUL and return code 0.  This makes is hard to automate 
testing.

Is there a way to programmatically detect test failures?

-- 
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

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 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