Testing with Fluent APIs

The more tests I write, the more love I feel towards fluent interfaces :) I hope to write someday soon more about Test Data Builders and FEST assertions, but for now only a short list of useful fluent APIs that can help you write nice(r) tests:

  • FEST Fluent Assertions Module - for those who prefer assertThat over assertEquals
  • AssertJ - "provides a rich and intuitive set of strongly-typed assertions to use for unit testing"
  • Awaitility - "a DSL that allows you to express expectations of an asynchronous system in a concise and easy to read manner"
  • FluentLenium - a fluent wrapper over Selenium/Webdriver
  • Test Data Builders - a nice way of object creation (useful not only for tests)
  • Rest-Assured - helpful for testing REST services
  • Restito - "a tool which is inspired by Mockito and functionally is diametrically opposite to the Rest Assured"
  • WireMock - "a flexible library for stubbing and mocking web services. Unlike general purpose mocking tools it works by creating an actual HTTP server that your code under test can connect to as it would a real web service."
  • MockServer - "MockServer is an API to enable the easy mocking of any system you integrate with via HTTP (i.e. services, web sites, etc) from either Java or JavaScript."
  • JsonPath - "JsonPath is to JSON what XPATH is to XML - maybe not so fluent as the rest, but also has something very DSL-ish about it :)

Aware of any other interesting fluent APIs that could help with writing beautiful tests? Please share the links!

P.S. Thanks to Bartosz Majsak for some pointers!

This used to be my blog. I moved to http://tomek.kaczanowscy.pl long time ago.


Please comment using