โ๏ธREST Assured
Rest Assured is an open-source Java library that makes testing RESTful web services simple. It allows you to:
Validate response status codes
Validate headers
Validate response body (JSON, XML)
Perform authentication
Parameterize requests
Some main features of Rest Assured:
Request building - Easily build HTTP requests using a Domain Specific Language rather than manual header/body setup. Saves time.
Response validation - Inspect response status, body, headers and validate against expectations. Ensures API works as intended.
Parameterization - Externalize test data and define parameters for data-driven, maintainable tests across browsers in parallel.
Pre/post request specification - Define authentication, common headers etc. once to avoid duplication in each test case.
Response extraction using JSON path - Query and extract specific response values for assertions or for use in next request. Handy!
Assertions library - Validate responses using Hamcrest or JUnit matchers for clear pass/fail results in a readable manner.
Logging filter - Log request/response details across tests for easy debugging. Like recording an experiment!
Pretty printing - Print response in pretty/formatted JSON or XML rather than one long string. Makes visualizing responses simpler.
Interactive documentation - Automatically generate API documentation from tests. Great for code documentation and collaboration.
Test runners - Integrate tests with popular runners like JUnit to execute automated regression suites on multiple browsers or servers in parallel.
Postman vs Rest Assured โ๏ธ
User interface
Code based
Manual + automation
Automation only
Language agnostic
Java specific
Broad API testing
Focused on REST
Using Postman and Rest Assured ๐ค
They can be used together:
Postman to prototype APIs ๐
Rest Assured to automate tests โก๏ธ
Postman provides UI, Rest Assured provides a programmatic interface ๐ปโ๐ฒ
Combined they streamline API testing ๐โโ๏ธ
Last updated