我試圖在android-sdk-plugin和ScalaTest中使用SBT,但沒有成功。在SBT中使用ScalaTest android-sdk-plugin
我可以在SBT控制檯中運行test
命令,但在我的src/test/scala
文件夾中沒有找到任何ScalaTest測試套件。
我從SBT得到以下輸出,它似乎根本沒有運行任何ScalaTest測試套件。
[info] Compiling 2 Scala sources and 3 Java sources to /home/brianhsu/AndroidProject/FindLost/target/android-bin/classes...
[info] Packaging /home/brianhsu/AndroidProject/FindLost/target/android-bin/classes.jar ...
[info] Done packaging.
[info] Packaging /home/brianhsu/AndroidProject/FindLost/target/scala-2.10/findlost_2.10-0.1-SNAPSHOT-tests.jar ...
[info] Done packaging.
[info] Run completed in 44 milliseconds.
[info] Total number of tests run: 0
[info] Suites: completed 0, aborted 0
[info] Tests: succeeded 0, failed 0, canceled 0, ignored 0, pending 0
[info] No tests were executed.
[info] No tests to run for test:test
下面是我如何創建項目:
使用
android create project -g
來創建gradle這個佈局中的Android項目。將
addSbtPlugin("com.hanhuy.sbt" % "android-sdk-plugin" % "1.2.11")
添加到project/plugins.sbt
將android-sdk-plugin包含到我的項目中。添加ScalaTest我在build.sbt
libraryDependencies
設置,這使得構建文件如下所示:import android.Keys._ android.Plugin.androidBuild name := "FindLost" scalaVersion := "2.10.4" organization := "org.bone.findlost" libraryDependencies += "org.scalatest" % "scalatest_2.10" % "2.1.0" % "test" platformTarget in Android := "android-19" run <<= run in Android install <<= install in Android
添加ScalaTest測試用例
src/test/scala
,其中包含從QuickStart頁例如測試套件的ScalaTest。
它是如何不記錄在任何地方,但在這裏,你應該把測試下使用android-sdk-plugin的androidTest文件夾!? – LightSystem