It's hard to tell, because you haven't told us very much other than
the error message.

The message itself is what you would expect if you invoked one of the
assert... methods in junit.framework.Assert and the method failed.
This is indicated in the fifth line:

"junit.framework.AssertionFailedError"

The JUnit Assert class contains methods that throw Exceptions if the
specified assertion is not true. For example,
assertEquals(String,String) will throw an Exception if the two String
objects are not equal.

The assert failed in
android.test.ApplicationTestCase.testApplicationTestCaseSetUpProperly().
This means, in effect, that Android was not able to set up your
application.

You must have created a test project, and it in added a test case
class that extends ApplicationTestCase<T extends
android.app.Application>. That test case class will, by default, call
testApplicationTestCaseSetUpProperly().

I can't tell much more than that. Did you create a test project? Did
you define a subclass of ApplicationTestCase<T>? Are you sure that T
is the same as the name of your application class?

As a side note, there's usually no reason to run a test on an
Application class. If you want to test an "application", you should
run unit tests on its Plain Old Java Objects (POJOs), and Android
functional tests on the application's Android components (Activities,
ContentProviders, etc.).

POJOs can be unit tested in regular JUnit. You're free to use the
Android testing framework, but if your POJO doesn't depend on Android
to run, then you don't *need* the framework.

Android components have to run within the Android framework, so
they're strictly speaking functional tests. You still construct them
with a unit testing philosophy, with one test method for each unique
path through a single Android class. You use the Android testing
framework to run these tests. This is described in the Developer
Guide. The newly-announced 2.3 online Guide contains an expanded
description of testing, under Dev Guide > Framework Topics > Testing.

I suggest that you start by testing one of your Activity classes. The
Dev Guide contains a tutorial on doing this, under Dev Guide >
Tutorials > Activity Testing.

On Dec 1, 12:48 pm, Kurtis Nusbaum <[email protected]> wrote:
> I'm trying my first hand at running some tests. I'm getting this weird
> error. I'm not sure exactly what's happening. Any ideas about what's going
> on?
>
> [echo] Running tests ...
>      [exec]
>      [exec] org.klnusbaum.linkschedule.test.ScheduleTests:
>      [exec] Failure in testApplicationTestCaseSetUpProperly:
>      [exec] junit.framework.AssertionFailedError
>      [exec]     at
> android.test.ApplicationTestCase.setupApplication(ApplicationTestCase.java: 
> 102)
>      [exec]     at
> android.test.ApplicationTestCase.testApplicationTestCaseSetUpProperly(Appli 
> cationTestCase.java:174)
>      [exec]     at java.lang.reflect.Method.invokeNative(Native Method)
>      [exec]     at
> android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
>      [exec]     at
> android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
>      [exec]     at
> android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.ja 
> va:520)
>      [exec]     at
> android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java: 
> 1447)
>      [exec] .
>      [exec] Test results for InstrumentationTestRunner=.F.
>      [exec] Time: 0.07
>      [exec]
>      [exec] FAILURES!!!
>      [exec] Tests run: 2,  Failures: 1,  Errors: 0
>      [exec]
>      [exec]
>
> -Kurtis

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

Reply via email to