Dave Westerveld introduces you to what a web service is and helps you understand why we use them.
- [Instructor] You may have heard the term web services or possibly had discussions about a service-oriented architecture or maybe a company is even moving towards this kind of architecture, but what exactly does it mean? It can be hard to pin down this term, but for the purposes of this course, we want to understand how to test web services. So let's define it as a function that we can access over the web. Now let's look at the implications that this definition has for testing. To do that, I want to take a step back into something that I learned in grade school when the concept of mathematical functions were introduced to me.
And don't worry, we're not going to get into any deep math here or anything, but we can think about it this way. A function takes in an input and performs an action on the input and then produces an output. Therefore, we can think of a web service as this box here in the middle. We give it inputs. It uses those inputs to decide on calculations or other actions and then it produces an output. These inputs and outputs are what we call an API. So we can think of an API as a definition of what commands a service will accept from us and what kind of things it will produce for us.
So let's try to make this just a little more concrete. Let's think about it with a simplified example for a minute. So we'll look at this service here called Math.js and this is a service that takes in a math equation and produces the result for us. So we can see down here an example of it. We can give it this expression and if we do that, it will produce the answer for that expression. So let's just click on this and we can see the answer for that is eight.
So this is just a very simplified example of course that shows what a web service is. A web service takes in a command, in this case this URL, this formatted URL, and does some calculation on it and produces an output for us. So in the way that I've been talking about this, the service itself is a black box. We don't know how this Math.js service is implemented. And when we issue these commands, we don't know what it's doing to figure out the answer for us, but we just know that given a certain command, it should produce a certain output.
And so in this course, we're going to be focusing on this kind of approach to testing web services and APIs. We'll treat the services that we're looking at as black boxes and then we can use a lot of what we can call black box testing techniques to figure out how to do this. So let's move forward with that.
- Reviewing API terminology
- Mitigating risks related to testing APIs
- Mapping out the layout of an API
- API authorization and authentication
- Finding and using bearer tokens
- Testing GET, POST, PUT, and DELETE calls
- Using mocks, stubs, and fakes in API testing
- Testing microservices and the Internet of Things