Bat is a tool to help you write runnable specifications for HTTP APIs, such as REST, RPC and GraphQL. Such specs can then be easily automated and integrated into your continuous integration pipeline. Bat runs on Node.JS and is based on Cucumber.JS.
It works well for API testing with Cucumber because, within reason, there are a finite number of actions and assertions associated with testing an HTTP API. Bat builds upon Gherkin to create a common vocabulary (a DSL) for describing HTTP interactions. When taking a BDD approach to API development, such specifications provide a great way to write and review your intentions before writing any implementation code.
Because Bat is essentially a plugin for Cucumber.JS, it’s easy to extend with custom step definitions. We most often do this at Harver for non-standard stuff related to setting up the context (Given steps), such as custom authentication procedures or setting up test data. Internally, it uses SuperAgent as an HTTP client and to maintain sessions.
Bat has more useful features for making it usable in the real world such as variable replacement, compatibility with Postman’s environment file format and integration points with Open API specifications. See the Readme for more details.
We’re delighted to share Bat as Harver’s first open source project. As it is used by a broader audience, more missing features will become apparent. So please raise issues on Github to request new features and raise bugs. If you want to contribute back to Bat, please check the Contributing Guide.