It's interesting to test Scala code and my next step will be creating a simple suite for testing web browser with ScalaTest and Selenium, I was not able to run the test below?
import org.scalatest.FlatSpec
import org.openqa.selenium.WebDriver
import org.openqa.selenium.WebElement
import org.openqa.selenium.htmlunit.HtmlUnitDriver
class GoogleSearch extends FlatSpec {
val driver = new HtmlUnitDriver
"Google" should "have the proper title" in {
assert(driver.getTitle() === "Google")
}
}
C:\Users\james\Desktop>scala -classpath scalatestm4.jar;selenium.jar GoogleSearch
Exception in thread "main" java.lang.RuntimeException: Cannot figure out how to run target: GoogleSearch
at scala.sys.package$.error(package.scala:27)
at scala.tools.nsc.GenericRunnerCommand.scala$tools$nsc$GenericRunnerCommand$$guessHowToRun(GenericRunnerCommand.scala:38)
at scala.tools.nsc.GenericRunnerCommand$$anonfun$2.apply(GenericRunnerCommand.scala:48)
at scala.tools.nsc.GenericRunnerCommand$$anonfun$2.apply(GenericRunnerCommand.scala:48)
at scala.Option.getOrElse(Option.scala:108)
at scala.tools.nsc.GenericRunnerCommand.<init>(GenericRunnerCommand.scala:48)
at scala.tools.nsc.GenericRunnerCommand.<init>(GenericRunnerCommand.scala:17)
at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:33)
at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:89)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)