I am trying to use scalatest to test the application as follows:
object Main extends App {
val name = "Greg"
}
class JunkTests extends FunSpec with MustMatchers {
describe("Junk Tests") {
it("Junk-1 -- Must do stuff") {
println("Name: "+Main.name)
}
}
}
The output of my name is always zero. How can I get my main object to use its capabilities during the test? In actual use, I have an application that has an http server and I want to send it to messages, but now it has never been initialized, so the server never started. This simple example shows that Main is never initialized.
source
share