WeTestAthens: Postman's AI & Automation Techniques
GetPostman
331 views
70 slides
Jun 11, 2024
Slide 1 of 70
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
About This Presentation
Postman's AI and Automation Techniques
Size: 10.98 MB
Language: en
Added: Jun 11, 2024
Slides: 70 pages
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