kiwiproject / kiwi-test Goto Github PK
View Code? Open in Web Editor NEWSome potentially useful Java test utilities...
License: MIT License
Some potentially useful Java test utilities...
License: MIT License
This is a RuntimeException thrown by CuratorTestingServerExtension
(see #26)
This is a JUnit Jupiter extension that resets the singleton Validator
instance in kiwi's KiwiValidations
class, which may be necessary if there are tests that modify the default validator.
May be useful when writing parameterized tests (that don't or can't for some reason use JUnit Jupiter's @ParameterizedTest
.
Depends on #67
A dropwizard Application extension that also spins up an embedded Postgres database with migrations
Just noticed there is (supposedly) 0% coverage on DropwizardAppTestsTest
. The reason is because in the Travis CI logs, none of the 14 tests are actually running anymore. I traced the origin of this problem back to the addition of the PostgresAppTestExtension
.
In build 109 (before PostgresAppTestExtension
was added), all 14 tests in DropwizardAppTestsTest
run and the coverage is 98.2%. The logs show:
[INFO] Running org.kiwiproject.test.dropwizard.app.DropwizardAppTestsTest
228316:01:28.149 [SessionTracker] INFO o.a.z.s.SessionTrackerImpl - SessionTrackerImpl exited loop!
2284INFO [2020-08-17 16:01:29,011] io.dropwizard.server.SimpleServerFactory: Registering jersey handler with root path prefix: /application
2285INFO [2020-08-17 16:01:29,020] io.dropwizard.server.SimpleServerFactory: Registering admin handler with root path prefix: /admin
2286INFO [2020-08-17 16:01:29,056] io.dropwizard.server.SimpleServerFactory: Registering jersey handler with root path prefix: /application
2287INFO [2020-08-17 16:01:29,058] io.dropwizard.server.SimpleServerFactory: Registering admin handler with root path prefix: /admin
2288INFO [2020-08-17 16:01:29,061] io.dropwizard.server.ServerFactory: Starting App
...
...lots more logging elided...
...
[INFO] Tests run: 14, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.527 s - in org.kiwiproject.test.dropwizard.app.DropwizardAppTestsTest
2309
In build 112 (after PostgresAppTestExtension
was added), no tests are run:
[INFO] Running org.kiwiproject.test.dropwizard.app.DropwizardAppTestsTest
2399[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.07 s - in org.kiwiproject.test.dropwizard.app.DropwizardAppTestsTest
The PostgresAppTestExtensionTest
is run in build 112 immediately before DropwizardAppTestsTest
, so I am guessing that something is happening that screws up the Dropwizard extension mechanism, but I have no idea what it could possibly be...
Links to builds:
109 - https://travis-ci.com/github/kiwiproject/kiwi-test/builds/179993436
112 - https://travis-ci.com/github/kiwiproject/kiwi-test/builds/181572334
Essentially a wrapper around ValidationTestHelper
that you instantiate with an AssertJ SoftAssertions
instance.
Depends on #66
Note: the original class name was JaxRsTestHelper
but to be consistent with all the other JaxrsXxx
classes in kiwi and in kiwi-test, we are renaming to JaxrsTestHelper
Utilities for tests making assertions on various date/time classes
Fix build and/or provide instructions so that PostgresAppTestExtensionTest
works on Mac OS both running via Maven and IntelliJ.
Solution seems to just be setting the LC_XXX
environment vars:
export LC_CTYPE="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
Which presumably we can do in the Maven POM.
Related to this:
Test helper to create Configuration
objects from YAML config files for Dropwizard apps.
Test helper for running parameterized validation tests and using AssertJ's SoftAssertions.
Depends on #67
Provides Mockito mocks for various Dropwizard objects like Environment
, JerseyEnvironment
, etc.
In #49 added only two methods in ValidationTestHelper
- this issue is to add the rest of this utility.
[![javadoc](https://javadoc.io/badge2/org.kiwiproject/kiwi-test/javadoc.svg)](https://javadoc.io/doc/org.kiwiproject/kiwi-test)
Instead of just always returning the content of the test fixture like Dropwizard's FixtureHelpers
, provide a test utility to return the Path
of a given test resource.
For example:
var path = Fixtures.fixturePath("ansible-vault/secret.txt"); // the returned type is java.nio.file.Path
Could consider also adding a second method to return a File
, e.g.:
var file = Fixtures.fixtureFile("ansible-vault/secret.txt"); // the returned type is java.io.File
Of course, you can simply convert a Path
to a File
using the toFile()
method, so that might not be worth much.
Dropwizard JDBI (v2) utilities for tests
One that doesn't just say "TODO: write some docs here" ๐
Migrate the StandardExceptionTests
test utility from dropwizard-curator.
This is a fluent API using AssertJ to perform assertions on Dropwizard Metrics health checks.
We are on really old versions of both Curator (2.13.0) and Zookeeper (3.4.13 3.4.14)
The most recent versions are:
We probably cannot update these until we update the Zookeeper servers, however!
Currently this is very specific to our Dropwizard services and how we name them, i.e. ending with -service
or -emulator
. It also contains only static
methods.
We can make this a bit more generic by changing from static
methods to instance methods, and having a bit of configurability, e.g. in constructor arguments, or maybe as a (Lombok) builder.
The PostgresAppTestExtensionTest
fails on mac OS Catalina due to these issues:
And since we have no idea if this works on other operating systems and only really care about Linux right now, we should only run this on Linux.
If there is more than one @Nested
test class in a Jupiter test, then the extension closes the CuratorFramework
and TetstingServer
after the first @Nested
class. Then when the second @Nested
class is started, the extension's beforeAll
throws an exception saying that the client cannot be started again.
The beforeAll
currently checks if the client state is STARTED
and simple returns if it is. But we also need to check if the state is STOPPED
and if so, we need to completely reset the CuratorFramework
and TestingServer
, basically by creating new instances and calling start()
on them. This will ensure that multiple @Nested
classes can work properly within one overall test class.
Wait until kiwi 0.8.0 is released, then update and remove the exclusions in the kiwi dependency in the POM.
Includes test utility methods for testing Dropwizard apps, i.e. integration tests that use theJUnit Jupiter DropwizardAppExtension
Annotating a test with @WhiteBoxTest
indicates a test of some internal implementation detail, e.g. a difficult to simulate exceptional condition.
Because some of the compile-time dependencies in kiwi-test free actually things like AssertJ, JUnit, etc. which are normally test scope, we will need to make sure to override these from the parent and set the scope to compile
(I think that's what we want anyway). The version should still be inherited. The dependencies that should not be test scope must be explicitly declared with the appropriate scope (provided), and must declare the version (though they can use the version properties inherited from kiwi-parent).
Very simple test helper class for testing code that uses Hibernate.
The class is named CuratorTestingServerExtension
Simple utility that contains (currently) only one method that may be useful when writing parametrized tests.
Necessary due to a dependency problem in kiwi 0.9.0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.