I've only dabbled in the JUnit with Android 1.5 so far, but I think
that if you take a look at the API Demos app you will see that they
have done exactly what you suggested (move the test classes into a
folder called "tests").

I'm not on my dev machine right now so I can't confirm but I think you
also need to tweak the Android manifest.  Again, the API Demos app has
a 2nd manifest so you can see how it's different from a production
manifest.  (It's the instrumentation stuff, not sure if you need that
for JUnit but that's how they did it in the API Demos.)

One thing I've seen is that when you run the Eclipse project as an
Android JUnit app, it goes through its tests and reports in the JUnit
panel, and that's it (the app does not run in the emulator or on the
device).  But if you run the apps as a regular Android app (not
JUnit), it skips the JUnit panel and you get the normal behavior
(loads to the device or emulator).  What I'm not sure is -- and
hopefully someone else knows this -- when you build to the device,
does that mean it left all of your test classes out of the package?

On Jun 4, 4:00 pm, Parakoos <parak...@gmail.com> wrote:
> Hello,
>
> I am looking to add some JUnit4 tests to my android application. I am
> going to test some classes that are totally decoupled from the Android
> framework, so I don't want to involve the instrumentation bit. I will
> be running these tests only from eclipse.
>
> The question I have is how I can ensure that the test classes I write
> will be excluded from the finished compiled program. After all, I
> won't need them at that point. I'd like to keep all the 'real' java
> packages in the default named source folder 'src' while I'd like all
> my tests to be in a source folder named 'tst'.
>
> Sorry if this is a stupid or simple question but after spending a
> great deal of time searching for the answer I gave up!
>
> Thanks,
>
> Gustav
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to