Testing your API requires a clear vision and clearer goals to make sure you can accomplish something at every step of the way.
- [Instructor] Let's dive into behavior testing, and get an understanding of how it does and doesn't work. First of all, we need to be honest with ourselves. Our current approach is the API testing are broken. Odds are, we use click-around testing, where we have someone click around, and hope for the best. "No, wait, you say. We do have unit testing of our components." That seems like a great answer until you really think about it. Odds are your unit tests are looking at individual functions that your users never see.
Or alternatively, they test functions, to make sure they work within the boundaries that you imagined. It's still not really testing the API. Let's take a step back and think of our real goal. Despite the articles you've read, a 100% code coverage isn't the goal. It's not to use that new framework. It's not to make deployments easier, though that may happen. Our actual goals are simple. We want to prove that it works now, when we build it. Then we want to have confidence that it's working later, as we make changes.
That's it. Every other goal of testing comes back to one of these two things. If we get this right here, everything else is simpler. But when we're talking about API's, things are quite a bit different. Our users and customers don't and can't see our API the same way we do. They see it from the outside. They have no understanding of the internal components, and realistically, they shouldn't need that understanding.
- The benefits of behavior testing
- Setting up a test environment
- Building your first API test
- Sending requests
- Validating response codes and payload
- Making authenticated requests
- Refactoring tests
- Writing to the API
- Establishing a system state for tests
- Using extensions
- Performing batch operations