Spek: How can I rewrite vertx async unit test with spek

Created on 30 Nov 2016  路  3Comments  路  Source: spekframework/spek

Hi, there
How can I rewrite the unit test code such as :
`
@Test
fun testMyApplication(context: TestContext) {
val async = context.async()
vertx.createHttpClient().getNow(port!!, "localhost", "/") { response ->
response.handler { body ->
context.assertTrue(body.toString().contains("Welcome!"))
async.complete()
}
}
}

`
There is no context object in spek.
How can I rewrite this test?

question

Most helpful comment

We're using Spek for testing vertx. We're using a tool called awaitility:
http://www.awaitility.org/

All 3 comments

Hi, unfortunately spek doesn't support vert.x unit tests. We will consider this use case when implementing extensions, see #115.

We're using Spek for testing vertx. We're using a tool called awaitility:
http://www.awaitility.org/

@iamsteveholmes Can one manage testing a Verticle without a TextContext? Do you have any examples out? Thanks!

Was this page helpful?
0 / 5 - 0 ratings