Interface TestSuite

    • Method Detail

      • create

        static TestSuite create​(String name)
        Create and return a new test suite.
        Parameters:
        name - the test suite name
        Returns:
        the created test suite
      • before

        TestSuite before​(Handler<TestContext> callback)
        Set a callback executed before the tests.
        Parameters:
        callback - the callback
        Returns:
        a reference to this, so the API can be used fluently
      • beforeEach

        TestSuite beforeEach​(Handler<TestContext> callback)
        Set a callback executed before each test and after the suite before callback.
        Parameters:
        callback - the callback
        Returns:
        a reference to this, so the API can be used fluently
      • after

        TestSuite after​(Handler<TestContext> callback)
        Set a callback executed after the tests.
        Parameters:
        callback - the callback
        Returns:
        a reference to this, so the API can be used fluently
      • afterEach

        TestSuite afterEach​(Handler<TestContext> callback)
        Set a callback executed after each test and before the suite after callback.
        Parameters:
        callback - the callback
        Returns:
        a reference to this, so the API can be used fluently
      • test

        TestSuite test​(String name,
                       Handler<TestContext> testCase)
        Add a new test case to the suite.
        Parameters:
        name - the test case name
        testCase - the test case
        Returns:
        a reference to this, so the API can be used fluently
      • test

        TestSuite test​(String name,
                       int repeat,
                       Handler<TestContext> testCase)
        Add a new test case to the suite.
        Parameters:
        name - the test case name
        repeat - the number of times the test should be repeated
        testCase - the test case
        Returns:
        a reference to this, so the API can be used fluently
      • run

        TestCompletion run()
        Run the testsuite with the default options.

        When the test suite is executed in a Vertx context (i.e `Vertx.currentContext()` returns a context) this context's event loop is used for running the test suite. Otherwise it is executed in the current thread.

        The returned Completion object can be used to get a completion callback.

        Returns:
        the related test completion
      • run

        TestCompletion run​(TestOptions options)
        Run the testsuite with the specified options.

        When the test suite is executed in a Vertx context (i.e `Vertx.currentContext()` returns a context) this context's event loop is used for running the test suite unless the TestOptions.setUseEventLoop(Boolean) is set to false. In this case it is executed by the current thread.

        Otherwise, the test suite will be executed in the current thread when TestOptions.setUseEventLoop(Boolean) is set to false or null. If the value is true, this methods throws an IllegalStateException.

        The returned Completion object can be used to get a completion callback.

        Parameters:
        options - the test options
        Returns:
        the related test completion
      • run

        TestCompletion run​(Vertx vertx)
        Run the testsuite with the default options and the specified vertx instance.

        The test suite will be executed on the event loop provided by the vertx argument. The returned Completion object can be used to get a completion callback.

        Parameters:
        vertx - the vertx instance
        Returns:
        the related test completion
      • run

        TestCompletion run​(Vertx vertx,
                           TestOptions options)
        Run the testsuite with the specified options and the specified vertx instance.

        The test suite will be executed on the event loop provided by the vertx argument when TestOptions.setUseEventLoop(Boolean) is not set to false. The returned Completion object can be used to get a completion callback.

        Parameters:
        vertx - the vertx instance
        options - the test options
        Returns:
        the related test completion