Hello and welcome to the first section
of this course. In this section we're
gonna talk about getting started with
API testing, and dive right in. Here we're
going to learn a little bit about
understanding web services and APIs. So
you may have heard the term web services
before, her talk about a service-oriented
architecture, or maybe your company is
even moving towards us, but what exactly
is meant by this? It can be hard to pin
down exactly what we mean, but for the
purpose of this course we want to think
about how we can test web services, and
so we're going to think of them as being
functions that we can access over the
web. Now let's think about that
definition for a minute, and think in
particular about the implications that
has for testing. And so to do that I want
to take a step back into something that
I learned in grade school when the
concept of a mathematical function was
introduced to me, and don't worry we're
not gonna get into any deep math here or
anything. But we can think about it in
this way, a function takes in some input,
it does something with those inputs and
then it produces some kind of output. So
when thinking of it in these terms, we
can think of the web service as this
little black box here in the middle. We
give it some inputs, the web service
takes those inputs and does something
with them to produce outputs that we
want, and so these inputs and outputs
define something that we call an API. So
we can think of an API as a definition
of what commands the service will accept
from us, the inputs, and what kinds of
things it will produce for us, the
outputs. So these of course are not the
only kinds of inputs and outputs that
you might have in a service, there could
be a database behind the scenes, or some
other code, or logging, or things like
that that we don't have access to
through the API, but in this course we're
going to be focusing on what you can
figure out about this black box here in
the middle by using the API calls. So
let's make this just a little more
concrete, and we can see here that I've
got a URL in Postman, and I've got
something called
GET. So we're going to get this URL, and
let's just send that command. Now you can
see that we've gotten back a whole bunch
of stuff down here,
and this is in something that's called
the JSON format. So before we get into
what JSON is, let's just talk for a
minute about what we did here. So we have
this URL which is an API call, so we're
telling the API at GitHub.com that we
want to get user 1. And we said we want
to GET it, we send that URL to the GitHub
API and we tell it that it's a GET call.
GitHub will return us a whole bunch of
information about user 1. And so you can
see the power of doing something like
this, it's very simple, it's very
straightforward, it's a simple command
that we can execute to give us back this
information. And as I said before, this
gets us back the information in a JSON
format. And JSON is just a way of mapping
keys to values, so it's a dictionary, map,
whatever term you prefer, but it takes a
key like login and maps that to a value
like 1. And you can see here there's a
whole bunch of different information
that is mapped to different keys. And so
if we think about this we can see maybe
why it's helpful to think of our
services of black box. All we did here
was provide a very simple input, just
this URL and the fact that it was a GET
request, and we turned we got this whole
object full of rich information and data
for us. But we have no idea about the
implementation details, like what kind of
database they used, what kind of
programming language it was written in,
how they pull all this data together,
where they're getting it, maybe it's from
multiple databases, we don't know. All we
know is that if we give this URL and
this GET command to the GitHub API, we'll
get back a summary of the information
about that user. And so when we think of
it in this way it helps us to abstract
the way underlying details, and to focus
on testing it as a black box. And that's
it for this video. So in the next video
we're going to be talking about mapping
your APIs, and I hope to see you there.