spek icon indicating copy to clipboard operation
spek copied to clipboard

How can I rewrite vertx async unit test with spek

Open windyboy opened this issue 10 years ago • 3 comments

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?

windyboy avatar Nov 30 '16 04:11 windyboy

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

raniejade avatar Nov 30 '16 11:11 raniejade

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

iamsteveholmes avatar Dec 06 '16 05:12 iamsteveholmes

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

dave08 avatar Sep 04 '17 16:09 dave08