Groovy
Gru - Groovy HTTP Testing Framework
@musketyr and the Agora Pulse team have released a new HTTP interaction testing framework named Gru
Gru is HTTP interaction testing framework with out-of-box support for Grails and REST interfaces.
I have just read the docs and it has great Grails 3 features. This is a great addition to complement the new Grails Testing Framekwork
Testing Legacy API Endpoints with Gru
Post by @musketyr about how to use Gru for a specific use case: Asserting an API endpoint responds a JSON payload similar to a fixture file.
One of Gru's goals is to provide simple tool to test existing API endpoints.
The example uses: JsonUnit
JsonUnit is a library that simplifies JSON comparison in unit tests.
Sponsored Link
Gradle Support Services
OCI is a certified Gradle partner. We offer Gradle consulting services, outsourced development, and Training.
We can help with:
- Build Migration
- Build Review
- Plugin Development
- Tooling Integrations (IDE, CI, Version Control, Artifact Repository)
- Performance Profiling
- Gradle Build/Remote Cache Setup and Rollout
- Gradle Enterprise Setup and Rollout
Grails
Consume and test a third-party REST API
Grails Guide which shows you how to consume an external API from a Grails Services.
Moreover, it shows how to use Ersatz, a "mock" HTTP library, for testing code dealing with HTTP requests
Grails Promises
Grails Async capabilities documentation can be found in async.grails.org.
This Grails Guide shows how to use Grails Promises to load multiple REST payloads in parallel.
Ratpack
Practical Ratpack Promises
A Promise is an object that will eventually yield or provide a value - often for an asynchronous computation e.g. some kind of network request. Promises are implemented with a fluent interface that allow you to build a chain of actions that will occur when the value of the Promise is yielded.
Promises in Ratpack from a practical perspective.
- How to deal with errors in Promises. How to deal with errors from which we can recover from.
- How to change one promised value to another you can use
- How to intercept the promised value. E.g. logging, or for fire-and-forget operations.
- Combine the promised value with another value
- Bail out of my promise chain early
Ratpack: Event-Driven Framework Base on Netty
If you are looking for a set of unordered lists of Ratpack's goals, key features, common use cases, this post on DZone may fulfill that need.
Comment
Family Movies are released in Summer. This year, Despicable Me 3 hit the movie theaters. To close the summer, we have a new testing framework in the Groovy ecosystem: Gru.
This issue contains links to Gru content plus Grails and Ratpack Promise support.
Sergio del Amo