Giter VIP home page Giter VIP logo

testtools's People

Contributors

lance avatar narigo avatar pidster avatar purplefox avatar richardwarburton avatar vietj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

testtools's Issues

@Test(expected = ...) annotation

Expected parameter does not work if the exception is triggered on a different tick of the event loop.

Perhaps a way to get around this is to have a VertxAssert.expected(Class<? extends Exception>) method, and then compare any thrown exceptions with the expected exception in handleError().

Daryl

Declarative verticle and module deployment

The old test annotations project had a way of declaring which verticles and modules you wanted to have deployed, ie what your test depended upon, before a test was run. This has been removed in testtools in favour of manual deployment.

The freedom given by manual deployment is good, but it would be helpful if there was some support for declaring things you want to deploy. This could come in the form of an annotation or it could come in the form of a method, for example:

public List<Deployable> getModulesToDeploy() {
    return Arrays.asList(new Deployable("io.vertx~mod-mongo-persistor~2.0.0-beta1", "config.testdb.json"));
}

At the moment when using testtools we're finding we do this a lot. Its a requirement that verticles are brought up and deployed before tests start executing.

Use publish rather send for reporting test results

Currently you're sending a message to TESTRUNNER_HANDLER_ADDRESS when a test succeeds/fails. This works fine, but it would be helpful from a developer debugging perspective if this was a publish.

That way it would be possible to reliably listen to messages sent to this address. It would also help anyone who wanted to write tools on top of the testtools project, such as logging the results of test runs.

Please add missing methods from vertx-testframework

The old test utility had the following 3 methods available. They are no longer present in vert-x/testtools, and as a result mod-lang-js has a dependency on both the old and new testing utilities.

TestUtils#generateRandomBuffer
TestUtils#randomUnicodeString
TestUtils#buffersEqual

Thanks!

"IllegalStateException: Timed out waiting for event" does not trigger a task failure

Tests currently do not fail if testComplete() is not called. This occurs regardless of any @test(expected) parameters.

Exception is thrown, and outputted to stderr, but test is still considered a pass.
JavaClassVerticle.java could perhaps call VertxAssert.fail() to fail the test.

Might be wise to set timeout to a couple of seconds for this one...

  @Test(expected = IllegalStateException.class)
  public void timeoutTest() {
  }

A test throwing an unserializable InvocationTargetException passes as green

TestVerticle.startTests() catches InvocationTargetExceptions, but in one of my Groovy-based tests, it caught a groovy.lang.MissingMethodException, and tries to handle it. This causes a serialization error in VertxAssert on line 51. This exception is uncaught, and causes no failure to be logged to Vertx, making the test pass as successful.

I tried 'fixing' this by again surrounding the VertxAssert.handleThrowable(targetEx); with a try/catch, but that messes up the output stream for some reason. I haven't found time to look deeper into it, so I don't have a patch to offer. I'm afraid. My workaround so far is to override startTests():


    @Override
    protected void startTests() {
        String methodName = container.config().getString("methodName");
        try {
            Method m = getClass().getDeclaredMethod(methodName);
            m.invoke(this);
        } catch (InvocationTargetException e) {
            // Conflict with Groovy causes sometimes silent InvocationTargetExceptions, so we always fail here.
            VertxAssert.fail(e.getMessage());
        } catch (Throwable t) {
            // Problem with invoking
            VertxAssert.handleThrowable(t);
        }
    }

The exception causing the problems:

groovy.lang.MissingMethodException: No signature of method: ...

vertx.modulename is incorrect if pom.xml has a parent POM

With this in pom.xml:

<parent>
    <groupId>com.unbounce.vertx</groupId>
    <artifactId>vertx-java-module-parent</artifactId>
    <version>2.1RC4.1-SNAPSHOT</version>
</parent>

<artifactId>vertx-http-dispatcher</artifactId>

JavaClassRunner sets vertx.modulename to com.unbounce.vertx~vertx-java-module-parent~2.1RC4.1-SNAPSHOT.

Better handling of multiple testComplete calls

I have some tests where I want to have two handlers and check something happens at both of them. At the moment if I put a 'testcomplete()' call at either of the handlers then the test will end without checking the asserts at the other handler.

One potential solution is to have an annotation on the test which declares how many expected testcomplete() handlers there are to be called.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.