2010-04-22 3 views
4

я использовал SBT, чтобы создать проект, настроил его таким образом:Scala, как представляется, не запускать тесты

val scalatest = "org.scala-tools.testing" % "scalatest" % "0.9.5" % "test" 

Затем я вставил пример из ScalaTest в файл и побежал " sbt test ", чтобы узнать, работает ли он. Файл компилируется, но тест никогда не выполняется.

Насколько я могу судить, это так же просто, как и должно быть. Я что-то упускаю?

+0

Просто, чтобы убедиться, вы поместите тестовый файл в Maven-правильный путь? –

ответ

2

прежде всего, я считаю, что 1.0 является правильной версией в соответствии с их веб-сайтом. Моя project/build/def.scala выглядит следующим образом:

import sbt._ 

class Tests(info: ProjectInfo) extends DefaultProject(info) { 
    val scalatest = "org.scalatest" % "scalatest" % "1.0" % "test" 
} 

Затем сделать sbt update, то sbt reload (не уверен, что перезагрузка необходима, но это не больно)

Сейчас в /src/test/scala, использовать их примеру, но и импорт штраф для меня scala.collection.mutable.Stack и sbt test работы

[email protected]:~/dev/test2$ sbt test 
[info] Building project test 1.0 using Tests 
[info] with sbt 0.5.6 and Scala 2.7.7 
[info] 
[info] == compile == 
[info] Source analysis: 0 new/modified, 0 indirectly invalidated, 0 removed. 
[info] Compiling main sources... 
[info] Nothing to compile. 
[info] Post-analysis: 0 classes. 
[info] == compile == 
[info] 
[info] == copy-test-resources == 
[info] == copy-test-resources == 
[info] 
[info] == copy-resources == 
[info] == copy-resources == 
[info] 
[info] == test-compile == 
[info] Source analysis: 0 new/modified, 0 indirectly invalidated, 0 removed. 
[info] Compiling test sources... 
[info] Nothing to compile. 
[info] Post-analysis: 4 classes. 
[info] == test-compile == 
[info] 
[info] == test-start == 
[info] == test-start == 
[info] 
[info] == StackSpec == 
[info] A Stack 
[info] Test Starting - A Stack should pop values in last-in-first-out order 
[info] Test Succeeded - A Stack should pop values in last-in-first-out order 
[info] Test Starting - A Stack should throw NoSuchElementException if an empty stack is popped 
[info] Test Succeeded - A Stack should throw NoSuchElementException if an empty stack is popped 
[info] == StackSpec == 
[info] 
[info] == test-complete == 
[info] == test-complete == 
[info] 
[info] == test-finish == 
[info] Run: 2, Passed: 2, Errors: 0, Failed: 0 
[info] 
[info] All tests PASSED. 
[info] == test-finish == 
[info] 
[info] == test-cleanup == 
[info] == test-cleanup == 
[info] 
[info] == test == 
[info] == test == 
[success] Successful. 
Смежные вопросы