4.46 sur 5
4.46

Postman : Le guide complet – Test de l’API REST

Test API Postman pour les tests manuels et automatisés. Automatisez avec Newman, Jenkins ou tout autre outil de CI.
Instructeur :
Mahefa Abel
English En savoir plus
Créer une requête GET, POST, PUT, DELETE
Comprendre la méthode de requête GET vs POST
Travailler avec des API du monde réel (API Github, API Trello)
Les bases de JavaScript pour les tests
Ecrire des tests API dans Postman
Utiliser les données de fichiers Excel (CSV) ou JSON
Utiliser les variables Postman pour créer des workflows et des scénarios
Exécuter des tests API avec Newman dans Jenkins, GitLab CI ou TeamCity
Utiliser OAuth2, clés API, jetons, JWT, authentification de base
Testez les téléchargements de fichiers
Utiliser des serveurs fictifs
Collaborer à l'aide des espaces de travail d'équipe

Les API RESTful (ou simplement API REST) ​​sont partout de nos jours, mais en même temps, elles deviennent de plus en plus complexes pour démarrer : différentes méthodes HTTP, en-têtes, cookies, gestion des téléchargements de fichiers ou de l’authentification avec des clés API, des jetons, OAuth et bien plus encore.

Mais avant de passer du temps à écrire du code pour récupérer les données proposées par l’API, pourquoi ne pas tester d’abord la requête pour vous assurer que tout fonctionne comme prévu ?

C’est ici qu’intervient l’Application Postman ! Postman vous permet de créer très rapidement une demande avec la méthode et les paramètres HTTP requis, de soumettre la demande et d’inspecter facilement les résultats.

Postman peut vous aider si vous développez également des API ! J’ai créé ce cours pour les ingénieurs de test ainsi que pour les développeurs de logiciels. Postman peut vous aider pendant le développement de votre API ainsi qu’une fois l’API terminée, en exécutant des tests qui s’assurent que votre API fonctionne toujours comme prévu.

Dans la première partie du cours, nous commencerons explorer les fonctionnalités de Postman et continuer en écrivant des tests d’API avec l’intention de les intégrer dans un serveur CI où les tests s’exécuteront sur une base actuelle.

Mais ce n’est pas le cours normal auquel vous participez. Parce que vos besoins peuvent être différents et parce que je déteste vous laisser vous demander quoi faire ensuite, la deuxième partie du cours comprendra des questions et des réponses des utilisateurs à des problèmes qui n’ont pas encore été abordés dans le cours ou qui sont plus spécifiques et peuvent ne pas intéresser tout le monde .

Regardons donc ce que vous allez apprendre :

  • Commencez par des requêtes simples et avancez vers des scénarios plus complexes
  • Apprenez à gérer les mécanismes d’authentification/autorisation tels que Basic Auth, API Keys ou OAuth.
  • St tests d’API d’écriture d’art
  • Organisez les tests dans des collections et partagez-les avec votre équipe
  • Exécutez des tests d’API dans Jenkins ou tout autre Serveur CI
  • Vous demandez, je réponds

Donc après ce cours vous saurez utiliser Postman en tant que pro .

Heureux d’apprendre Postman ? Inscrivez-vous aujourd’hui !

Introduction and first steps in Postman

1
Course overview

In this lecture, I wanted to give you an overview of the entire course. 

2
Introduction and first steps in Postman
3
Introduction and first steps in Postman (continued)
4
The Postman Landscape
5
First steps in Postman

Let's just recap what you have learned in this lecture.

Creating with API requests

1
Note about requestbin
2
How to create a request in Postman

In this lecture we look at all the aspects involved when creating a request with Postman. We will cover different HTTP methods, how to manage complex URL parameters  and path variables, different headers and body types.

3
How to import a request from your browser in Postman

This video will show you how to easily create Postman request by importing them directly from your browser.

4
How to inspect HTTP responses in Postman

Let's have a closer look at responses in this lecture.

5
Handling cookies in Postman

This lecture discusses how to deal with cookies in Postman.

6
Troubleshooting Postman issues

So the API you are calling is not working? Don’t panic and keep calm because in this lecture I will show you a couple of tips on how to troubleshoot the most common problems in Postman.

7
Saving requests to a collection in Postman

Saving requests ensures that you can later run the again or share them. In this lecture we deal with exactly that.

8
Working with API requests

Writing tests and scripts

1
Introduction

In this section your are going to start writing tests but at the same time explore more features of Postman such as variables and environments for adding a dynamic behaviour to your requests, workflows and scripts for more advanced scenarios.

2
The Postman Cheat Sheet & Quick Reference Guide
3
Your first API test in Postman

Let's write a simple test together and understand how everything works.

4
Resources for this section
5
Testing an API

In this and the following lectures, you will be testing a real-world API and at the same time discover more and more feature of Postman.

We will take trello.com’s API (which is an online tool for managing lists and tasks) and create and test a few requests.

6
Testing an API - Writing more tests
7
Troubleshooting
8
Recap: Path parameters vs query parameters

In this tutorial, I wanted to explain the difference between path params and query params and will exemplify this in Postman.

9
Create additional requests and tests
10
Refactoring Tests

Now let's refactor the tests that we have written so far, so that they are easier to read.

Writing tests and scripts using variables

1
Variables in Postman

Variables allow you can create more dynamic requests. 

Postman allows you to save repetitive information in a variable (which is very similar to what a variable is in any programming language). The main motivation for using variables would be to not repeat yourself.

2
Global variables

This lectures explain what are global variables and what is their scope.

3
Environments

This lecture discusses environment variables, which are defined inside environments, are quite similar to global variables but they have a more narrower scope, which means they are more specialised.

4
Session variables (new in Postman 6.2!)

Postman 6.2 introduces a new feature called sessions, which allows you and your team to work more effectively through the addition of session-specific collection, environment, and global variables also called session variables.

In this video, I will show you how to configure and use session variables.

5
Bulk editing removed new in Postman 6.2!)

Bulk editing has been removed in Postman 6.2 but in this video I will show you a way on how you can achieve the same result.

6
Pre-request scripts in Postman

This lecture deals with pre-request scripts, which are similar to test scripts except as the name implies, pre-request scripts give you a chance to modify the request but before the actual HTTP request is made. 

7
Make the requests dynamic by taking advantages of variables
8
Understanding different variable scopes / types

In case you are confused about the different variable types in Postman (global, collection, environment, local, data variables), this lecture is a good way to get an overview.

9
How to setup different URLs using environments in Postman

In this video i will show you how to setup different URLs for different servers / environments. 

10
Debugging tests

This lectures deals with debugging tests and scripts using the Postman Console.

11
Notice about the old Postman scripting API

Hands-on Practice: Building & Testing an API workflow using Github & Twilio

1
About this section

This section gives you the opportunity to practice the skills you have learned so far. It uses real-world APIs to help you gain even more practical experience.

In this section lecture we will use the Github API to create a simple workflow.

We will create a new git repository, post an issue with some content, comment on that issue and so on. We will introduce 2FA authentication in the game and work with the Twilio API to receive a text message (SMS).

So if you have the time, this will be a fun project to work on.

2
Github API changes starting November 2020
3
Introduction to the Github API
4
Create a simple workflow using the Github API
5
Introduction to 2FA

This lecture briefly explains what Two-Factor Authentication (2FA) is.

6
Setting up 2FA on Github
7
Setting up 2FA in Postman
8
Automating two-factor authentication (2FA) workflow - overview
9
Introducing twilio
10
Get a new Twilio phone number & 2FA setup
11
Setting up 2FA on Github with Twilio
12
Troubleshooting why Twilio did not receive the SMS
13
Assignment: Read the SMS code and replace it in the workflow
14
Using the Twillio API in Postman
15
Conclusion
16
Additional assignment

Advanced assertions

1
Section overview

Overview of the assertions section.

2
Postman assertion basics

Let's understand what are the prerequisites for writing assertions. 

3
Chai Assertion Library

Short introduction to the Chai JS assertion library used in Postman.

4
Assertions
5
Chai Assertion Library

Let's make sure you have a good understanding of the basics when using the Chai Assertion Library.

6
Assertions on arrays

In this lecture we will have a look at an example on how to make assertions on nested JavaScript objects and arrays.

7
Assertions on nested objects

In this lecture we will have a look on how to make assertions on nested JavaScript objects.

8
How to write assertions in Postman (objects, arrays, nested properties)
9
Testing headers and cookies

Sometimes it is needed to test headers and cookies as well. This lecture deals with that.

Automatically running tests

1
Overview

In this short lecture I wanted to give you an overview of what you will learn in this entire section. 

What we want to achieve is to run the entire collection (one request after another) and to get an overview of successful or failed tests. There are multiple ways to automate things and next I will give you an overview.

2
Postman collection runner

The collection runner is included in Postman and facilitates the first step toward automation. It is a useful way to run the entire collection or just a subset of it (by selecting a specific folder) without any other external tools.

3
Postman monitors

Postman Monitors allows you to run your collection at regular intervals. While this is a Pro feature, you can still try it out with a free account (currently you can make 1000 API calls per month).

4
Automating with Newman (Overview)
5
Short introduction to NodeJs and NPM
6
Installing Newman
7
Troubleshooting Node.js / npm / Newman Problems (for Windows)
8
Running a collection with Newman
9
Newman v3 to v4 Migration Guide

This video shows how you can update fro Newman v3 to Newman v4 and briefly presents what has changed.

10
3 ways to access your Postman collection from Newman
11
Specifying environments with Newman
12
Prerequisites for running Newman on Jenkins
13
Troubleshooting Jenkins Problems (for Windows)
14
Troubleshooting Jenkins Problems (for macOS, Linux)
15
Running a collection with Jenkins and generating a report
16
Creating an HTML report in Jenkins
17
Generating better HTML reports

This lecture explains how you can use a 3rd party reporter to generate nicer HTML reports.

18
Customizing HTML reports

This lecture looks into customizing HTML reports generated by Newman.

19
Troubleshooting HTML reports
20
Running a collection from a Git repository with Jenkins

Running Newman with other CI servers / tools

1
Gitlab CI

In this lecture explains how you can use Gitlab CI to automate the execution of Postman tests. It will be using the official Newman Docker image.


2
TeamCity

This videos deals with running Postman tests in TeamCity with the help of Newman.

3
Short introduction to Docker (optional)

Short introduction to Docker.

4
Running Jenkins with Docker
5
Running Newman with Docker

Workflows and Scenarios

1
Overview
2
Creating a basic workflow / scenario
3
Advanced workflows
4
Clearing unused Trello boards
5
Multiple workflows with the same collection

Data driven tests: Running a request multiple times with different data sets

1
Using workflows to create data-sets

In this video I will show you how you can take advantage or pre-request scripts and workflows to submit the same request over and over again but with different data each time.

2
Using external data files - Basic usage

In this lecture you can learn the basics of using external data files to generate multiple iterations in Postman.

3
Using external data files - Writing tests

In this lecture continues the previous lecture and shows how to adapt the tests and scripts when using external data files and data variables.

4
Using external data files - Advanced usage

In this lecture continues the previous lectures and shows more advanced use-cases for data variables and iterations.

Team Collaboration

1
Introduction

Workspaces provide a way to organise Postman collections in order to make it easier to manage. Team workspaces allow you to collaborate on a number of collections with other team members in a seamless way.

Anytime somebody makes a change, this will be reflected in your Postman App almost instantly.

2
Using the Git version control system - Overview

This lectures gives an overview on how you can share you Postman collection by using Git.

3
Using the Git version control system - Hands on

This lectures shows you hands-on how you can share you Postman collection by using Git.

4
Team Workspaces - Creating and sharing a workspace

In this lecture we will go over the basics of team workspaces, will create a team workspace, add a collection and invite others to collaborate on it.

5
Team Workspaces - Understanding users and permissions

This lectures explains the basics of teams, users, workspaces and permissions when using Team workspaces.

6
Team Workspaces - Managing user permissions

This lecture explains how to manage permissions when using Team Workspaces.

Mock servers

1
Introduction to mock servers

What is a mock server? A mock server is a fake API that simulates a server response, usually for testing purposes. A mock server allows you to mock any server or service that can be accessed by using HTTP.

2
Why use a mock server?

Let's first understand what are the use-cases for using a mock server:

  • API Design, prototyping and development (1)

  • API testing (2)

3
Create your first mock server

Learn how to create your first mock server with Postman.

4
Practical example: using mock servers for front-end development

I have an Angular application which needs to data from the backend which is not ready yet. Using mock server I will demonstrate how to continue with the development.

5
Recording responses from an existing API
6
Known limitations

As with any software tool, there are always limitation or disadvantages. So let's what a look at what you should be aware of.

File uploads (testing, automatic uploads, uploading multiple files)

1
Sending and testing multipart/form-data requests (file upload form)

In this lecture I will show you how to debug an upload script and demonstrate it with Postman which can also make requests encoded as "multipart/form-data" so that you can send also a file.

2
Automatic the upload and testing process with Newman

We continue the file upload project and move towards automatically running tests by using Newman. 

We will also look into uploading multiple files in a single test-run.

Authentication / Authorization

1
Basic access authentication

Basic access authentication is a method in which the client provides a username and password while making a request to a protected resource.

Basic authentication is one of the simplest methods of implementing authentication.

I recently encountered it while dealing with microservices, so it is old and simple but still effective.

2
OAuth2 Authorization Flow (Authorization Code Grant)

This lecture shows you how you can test the OAuth 2.0 Authorization Code Grant using Postman.

3
Form-based / Session-based authentication

Learn how to login to legacy systems which are using a form-bases / session-based / cookie-base authentication. Additionally, I will show you how do deal with more complex scenarios which involve CSRF tokens.

4
JSON Web Tokens (JWT)

Advanced topics and user questions

1
Postman help - Schedule your free Postman consultation
2
You ask, I answer
3
Reusing tests in multiple requests

This lecture explains how you can adhere to the DRY principle and re-use existing tests.

4
How to deal with CSV responses?

In this video, I will show you how to deal with responses in CSV format in Postman.

5
Writing files to the file system

This lecture will tackle the delicate topic of writing files to the disk while using Postman. This will be possible by actually running Newman as a Node module.

6
Passing variables dynamically to the request at runtime (Newman)
7
Sending requests from scripts
8
How can I connect to my database using Postman?
9
JSON Schema validation in Postman

New features in Postman

1
Designing APIs with Postman (OpenAPI 3.0.0 / Swagger)
2
Sending GraphQL Queries in Postman

JavaScript fundamentals

1
Section overview
2
A short history of JavaScript
3
Data Types in JavaScript
4
Data Types in JavaScript
5
Variables
6
Variables
7
Conditionals
8
Conditionals
9
Functions
10
Generate a random email address
11
Data structures: arrays
12
Data structures: objects
13
Loops
14
Modern JavaScript
15
Sorting things out
16
Applying what you have learned to Postman
17
Conclusion

Postman News & Updates

1
February 2018

This months I will quickly introduce you to the Postman Quick Reference Guide, to another website where you can find collections and to the newest feature in Postman: Workspaces!

2
March 2018

Postman March 2018 News and Updates.

3
April 2018

Postman April 2018 News and Updates.

4
May 2018

Postman May 2018 News and Updates.

5
July 2018

July 2018 Postman News & Updates

6
August 2018

August 2018 Postman News and Updates: Postman 6.2, sessions (session variables), team workspaces, Newman v4.

7
March 2019

March 2019 Postman News and Updates: Postman 7.0, New Team Workspace permissions, Forking + Merging, Open API 3.0 support.

8
June 2019
9
October 2019

Bonus section

1
What are you learning next?
2
Bonus
Vous pouvez afficher et revoir les supports de cours indu00e9finiment, comme une chau00eene u00e0 la demande.
Absolumentu00a0! Si vous disposez d'une connexion Internet, les cours sur WeCours sont disponibles u00e0 tout moment sur n'importe quel appareil. Si vous n'avez pas de connexion Internet, certains instructeurs permettent u00e9galement u00e0 leurs u00e9tudiants de tu00e9lu00e9charger les cours. instructeur cependant, alors assurez-vous d'u00eatre de leur bon cu00f4tu00e9u00a0!
4.5
4.5 sur 5
Notes7015

Détails des Notes

Étoiles 5
3427
Étoiles 4
2253
Étoiles 3
649
Étoiles 2
127
Étoiles 1
54
Suivre un cours
Garantie de remboursement de 30 jours

Inclut

14 heures de vidéo à la demande
Accès complet à vie
Accès sur le mobile et la télévision
Certificat d'achèvement

Archive

Working hours

Monday 9:30 am - 6.00 pm
Tuesday 9:30 am - 6.00 pm
Wednesday 9:30 am - 6.00 pm
Thursday 9:30 am - 6.00 pm
Friday 9:30 am - 5.00 pm
Saturday Closed
Sunday Closed