Thanks Perry, as always so helpful.  :-)

By using "sbt test", and the tests in src/androidTest, I'm still having the 
problem of not loading in the classpath the test dependencies.  :-(

Am Dienstag, 14. Oktober 2014 17:46:31 UTC+2 schrieb pfn:
>
> by default, all tests in android projects are set to be instrumented. 
> there isn't a really easy way to make it non-instrumented, use 'test' not 
> 'android:test'; and test dependencies should be picked up. you'll probably 
> also want to unset 'android:debug-includes-tests'
>
> On Tue, Oct 14, 2014 at 8:41 AM, David Pérez <david.pere...@gmail.com 
> <javascript:>> wrote:
>
>> Hi,
>>
>> I would like to be able to run my unit tests that use Robolectric from 
>> SBT, and also in IDEA.
>> I'm using the wonderful android-sdk-plugin.
>>
>> I've placed all my tests in src/androidTest/scala.
>>
>> The problem I have is that when I try to compile my test code with SBT, 
>> it doesn't find junit, or any other test lib.
>>
>> [error] 
>> /home/david/des/android/BiblS/src/androidTest/scala/es/fcc/bibl/bd/TestBd.scala:4:
>>  
>> object junit is not a member of package org
>> [error] import org.junit.Before
>> [error]            ^
>> [error] 
>> /home/david/des/android/BiblS/src/androidTest/scala/es/fcc/bibl/bd/TestBd.scala:5:
>>  
>> object robolectric is not a member of package org
>> [error] import org.robolectric.Robolectric
>>
>>
>> All the tests belong to a library project:
>>
>> My dependencies are as follows:
>>
>> libraryDependencies ++= Seq(
>> "com.novocode" % "junit-interface" % "0.9" % "test",
>> "junit" % "junit" % "4.11" % "test",
>> "org.scalatest" %% "scalatest" % "2.1.4" % "test",
>> "org.robolectric" % "robolectric" % "2.3" % "test"
>> )
>>
>>
>> I've tried to find working examples, but found none, except this one:
>> https://gist.github.com/pfn/5872909
>>
>> I've seen these options that I don't fully understand:
>>
>>     managedClasspath in Test <++= (platformJars in Android, baseDirectory) 
>> map {
>>       case ((j,_), b) =>
>>         Seq(Attributed.blank(b / "bin" / "classes"), 
>> Attributed.blank(file(j)))
>>     },
>>     exportJars in Test := false,
>>     fullClasspath in Test ~= ( _ filter ( _.data.getName != "classes.jar" ) 
>> ),
>>     fullClasspath in Test <+= (sourceDirectory in Test) map { s =>
>>       Attributed.blank(s / "resources")
>>     },
>>     testOptions in Test += Tests.Argument("-oD"),
>>     javacOptions += "-Xlint:unchecked"
>>
>>
>> but adding this options doesn't help much.
>>
>> Any help, please?
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "scala-on-android" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to scala-on-andro...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"scala-on-android" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to scala-on-android+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to