System test helpers #35961
dainiusjocas
started this conversation in
Ideas
System test helpers
#35961
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We've created a set of helpers for the system tests written in Java that we believe is worth sharing.
We've wanted BDD style (i.e. given-when-then) and fluent API. A nice aspect is that the implementation by default exposes/requires very little Java specifics and is already powerful enough to allow for granular comparison between multiple responses.
Here I want to present how it looks and fish for feedback. For the presentation I'm using the same application that demonstrates the system tests. This allows to compare the current example with the alternative.
Pasting here the entire equivalent test class (source):
Full application can be found here.
The proposed usage is that your system test class extends the
BaseSystemTestwhich brings this fluent style helpers likegiven, etc. And the tests can be run everywhere from an IDE all the way to the Vespa Cloud integrated CI/CD.For the matching we decided to use Hamcrest matchers. This is because it is not trivial to put Vespa responses into some class and then work with AssertJ.
For the selectors in the
JsonNodetheJsonPointerwas picked because Jackson has it by default. Maybe it would be worthwhile to bring in a Jackson-JQ dependency and use that as it allows for transformations.Happy to contribute the code.
Beta Was this translation helpful? Give feedback.
All reactions