Testing

Test Salesforce REST API with Postman

Postman is my favorite tool for testing REST APIs. Workbench is great for ad-hoc testing but I like Postman better because I can create a suite of repeatable, scriptable tests. You can download and install Postman from getpostman.com. When you run it you should see the main screen. Postman main screen Prerequisites In this post we will test the REST API we created in the last few posts. To follow along with this post you can clone the GitHub repo and push the code to a scratch org or start at the beginning of the series if you would like to follow along with building the API.

Unit Test a Salesforce REST API

This post is a continuation of the previous two posts where we created a Salesforce DX REST API project and then coded HTTP methods to perform CRUD operations. The full project is on GitHub. In this post we will cover some general unit testing concepts and specifically how to unit test HTTP methods in Apex. Arrange, Act, Assert There is a common pattern in unit tests called Arrange, Act, Assert. It states that each unit test does these three things.