I am trying to write a test that just checks to see that the correct database is setup, but the test is never firing, and everything ends successfully (even though it should fail):
import anorm._
import org.scalatestplus.play._
import play.api.db.DB
class Housekeeping extends PlaySpec with OneServerPerSuite {
// Make sure the test database is loaded
"test connection to test database" in {
DB.withConnection { implicit connection =>
SQL("SELECT * FROM accounts WHERE ID = 1").withResult(res => {
val row = res.head.row
val name = row.asMap("accounts.name")
println(name) // Prints to console
name mustEqual "this should fail"
println("HERE") // Never prints to console
})
}
}
}
Console:
[info] Housekeeping:
[info] - application - Creating Pool for datasource 'default'
tyler
[info] - test connection to test database
[info] - application - Shutting down connection pool.
I'm not sure why nothing is happening, since I am getting the name fine from the database. I couldn't find any documentation about performing asynchronous tests, which I think may be part of the problem.
Aucun commentaire:
Enregistrer un commentaire