WeTestAthens: Postman's AI & Automation Techniques

GetPostman 331 views 70 slides Jun 11, 2024
Slide 1
Slide 1 of 70
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58
Slide 59
59
Slide 60
60
Slide 61
61
Slide 62
62
Slide 63
63
Slide 64
64
Slide 65
65
Slide 66
66
Slide 67
67
Slide 68
68
Slide 69
69
Slide 70
70

About This Presentation

Postman's AI and Automation Techniques


Slide Content

All rights reserved by Postman Inc
Postman’s AI
and Automation
Techniques

Pooja Mistry
Developer Advocate
@poojamakes
Revolutionizing API Testing

Let’s start off by taking a trip
down memory lane …
the year was 2015

Manual Testing
at its Finest

UI Changes result in
many broken tests

We had to make
the switch

Goal was to empower
manual testers into
becoming software
test developers

However there was
a lot of disconnect

We ended up here

Discovered
Postman

Finally ended
up here

Flash forward
to 2022

Hi,
my name is Pooja
@poojamakes
•Developer Advocate, Postman
•Educating others about Postman is my Full Time Job!
•For many teams, Postman is an everyday tool that
helps people work with APIs more efficiently
@poojamakes

Making the switch:

Empowering manual
testers to automate their
API tests

API Testing Methods

Types of API Tests

Starting with a good testing plan is essential
Regardless of whether performing manual or automated testing, these are the
three major things everyone should do when embarking on the API testing process:
Understand the API’s
requirements

01
Specify the expected
inputs and outputs
02
Organize tests with similar
functionality
03

Inputs and Outputs

What should I test for ?
Correct status codes.
Response format (i.e. valid JSON)
Various error conditions, such as invalid input, missing required parameters, or exceeding rate limits.
Content-Type header based on the response format (e.g., "application/json" for JSON responses).
Authentication and authorization are enforced.
Data is accurate and matches the expected values.

Testing is a crucial part of API Projects

So much more to Postman than just sending requests ….
Postman API templates testing proxies
documentation collection runner Workspaces
authentication environments open-source projects
Newman JSON collaboration mock
servers CLI Interceptor runtime Monitors
converters automation variables integrations
version control API Network session Postman sandbox

Collections
the building blocks of
API development

Highly extensible, providing the
foundation to tackle org-wide API
initiatives at any scale.

Workspaces
the shared canvas for
executing & collaborating
on API assets

Enable an array of team types to
leverage Collections for API workflows.

Scripts
the logic provided to drive
dynamic workflows
Enable dynamic behavior to your API
requests with Postman's built-in JavaScript
runtime

Package Library

Status Code
pm.test("Status code is 201", () => {
pm.response.to.have.status(201);
});
Test a successful response
pm.test("Successful POST request" , ()=> {
pm.expect(pm.response.code).to.be.oneOf(
[200,201]);
});
Test that a status code is one
of a set of status codes

Response Format
const jsonData = pm.response.json();
pm.test("Test data type of the response" , () => {
pm.expect(jsonData.age).to.be.a("number");
pm.expect(jsonData.hobbies).to.be.an("array");
pm.expect(jsonData.email).to.be.null;
});
pm.test("Test valid json", function() {
pm.response.to.be.json;
});
Test the value types of a response Test that response is JSON

Test that the response time to be within a specified range
pm.test("Response time is less than 200ms" , () => {
pm.expect(pm.response.responseTime).to.be.below(200);
});
Response Time

Data Accuracy
pm.test("Check that invoice is paid" , function () {
pm.expect(pm.response.json().invoicePaid).to.eql(true);
});
pm.test("Response property matches environment variable" , function () {
pm.expect(pm.response.json().name).to.eql(pm.environment.get("name"));
});

Check if response property matches a hardcoded value
Check if a response property has the same value as a variable

Contract Tests
Test that the response validates contract
var contract = {
type: "array",
items: {
type: "object",
properties: {
title: { type: "string" },
author: { type: "string" },
id: { type: "string" },
},
required: ["title", "author", "id"]
}
};
pm.test("API response matches the predefined contract" , function () {
var response = pm.response.json();
pm.expect(tv4.validate(response, contract)).to.be.true;
});

Where Does
AI Play a Role ?

In the age of AI
Everything is an API.”

Abhinav Asthana
CEO - Postman

Postbot is your
AI Assistant
“As our technologies have
improved, so have our abilities”

Postbot’s goal is to increase developer productivity
by saving time writing API tests and documentation,
and helping debug requests.

How can Postbot help you
Postbot is your AI assistant
for API workflows in Postman
Postbot can help you:
Write tests
Visualize responses
Get help using AI Expert Curated Support
Write documentation
Debug

Increase productivity
through Test Script
Generation

In a request, Postbot will
provide contextual information
to guide the developer.
●“Add tests to this request”
●“Test for response”
Individual
Tests

Autocomplete allows developers
to use natural language to
write tests
●After the creating the test
name pause after the
closing single quotation

●Need to have a valid
response before using
autocomplete

●Like other copilots, tab to
confirm autocomplete
Autocomplete

Quickly debug issues
with requests
●Postbot can debug and
resend requests for you

●Googling issues is
so last year.

Fix Tests

Visualize
Responses
TIME SAVED

Create visual representation
of JSON responses
●No more scrolling through
endless JSON objects

●Non-developers can
quickly understand
response data
Visualization

Documentation
Generation
No more tribal knowledge

Writing documentation is made
simpler through Postbot
●No excuse to not write
documentation

●Easy tribal knowledge
transfer
Documentation

Postman AI
Expert Support
IN APP CURATED

You can ask Postbot questions
about Postman app and it'll
respond with expertly curated
instruction from multiple sources.
Postman
Support

v
Let’s talk about
Automation

Collection Runner

CI/CD - Postman CLI

CI/CD - Automation

Scheduled Runs

Flows

End-To End -
Picture

Thank you
@poojamakes

Means of Test Automation

What we covered
Tags