Postman Beginner's Course – API Testing
August 25, 2024 2024-08-25 23:45Postman Beginner's Course – API Testing
Postman has over 10 million users worldwide. This course will introduce you to Postman and is suited for beginners. You will learn how to build API requests with Postman, how to inspect responses and create workflows.
The second part of the course will get into the most exciting feature of Postman: writing API tests and automating their execution. You will learn about the collection runner, Postman monitors and Newman.
You will get hands-on experience and will have plenty opportunities to practice. The best way to learn is by doing the assignments.
📚 Course Notes: https://github.com/vdespa/introduction-to-postman-course
🎥 Course created by Valentin Despa, Developer Educator
🐦 Valentin on Twitter: @vdespa
📺 Valentin on YouTube: https://www.youtube.com/channel/UCUUl_HXJjU–iYjUkIgEcTw?sub_confirmation=1
⭐️ Course Contents ⭐️
⭐️ Unit 1 – Introduction to Postman
⌨️ Lesson 1 – Welcome (0:00:00)
⌨️ Lesson 2 – What is Postman (0:01:12)
⌨️ Lesson 3 – How to install Postman (0:03:06)
⌨️ Lesson 4 – Your first request with Postman (0:04:45)
⌨️ Lesson 5 – HTTP (0:07:07)
⌨️ Lesson 6 – Postman collections and variables (0:11:10)
⌨️ Lesson 7 – Query parameters (0:15:55)
⌨️ Lesson 8 – Assignment (0:22:50)
⌨️ Lesson 9 – Path variables (0:25:21)
⌨️ Lesson 10 – POST request / API Authentication (0:30:07)
⌨️ Lesson 11 – JSON format (0:41:21)
⌨️ Lesson 12 – Assignment (0:45:11)
⌨️ Lesson 13 – Random test data (0:47:32)
⌨️ Lesson 14 – Is Postman the right tool for me? (0:50:59)
⌨️ Lesson 15 – Viewing existing orders (0:52:16)
⌨️ Lesson 16 – Assignment (0:53:59)
⌨️ Lesson 17 – PATCH request (0:55:56)
⌨️ Lesson 18 – DELETE request (0:59:03)
⭐️ Unit 2 – Test automation with Postman
⌨️ Lesson 19 – Introduction to test automation (1:01:52)
⌨️ Lesson 20 – Your first API tests (1:02:52)
⌨️ Lesson 21 – Assignment (1:14:55)
⌨️ Lesson 22 – Postman variables (1:19:20)
⌨️ Lesson 23 – Extracting data from the response (1:24:13)
⌨️ Lesson 24 – Assignment (1:36:51)
⌨️ Lesson 25 – Assignment (1:38:08)
⌨️ Lesson 26 – Collection runner (1:42:52)
⌨️ Lesson 27 – Request execution order (1:49:00)
⌨️ Lesson 28 – Postman monitors (1:53:32)
⌨️ Lesson 29 – Newman (1:57:45)
⌨️ Lesson 30 – HTML reports with Newman (2:01:58)
⌨️ Lesson 30 – CI/CD overview (2:05:28)
⌨️ Lesson 31 – Conclusion (2:08:24)
Check out free Postman programs for students and educators to help you learn more about APIs: https://www.postman.com/company/student-program/
Learn to code for free and get a developer job: https://www.freecodecamp.org
Read hundreds of articles on programming: https://www.freecodecamp.org/news
source
Comments (48)
@saanvisadventures9092
HI, when I tried this https://simple-books-api.glitch.me/status with GET request , its not working it just says "Could not send request" is this API still valid
@andyh964
so easily explainable and in depth even 3 years alter. very appreciated.
@Mohamed.U3
This was really good and it made me learn new things about postman thanks a lot ❤
@polatdundar
wow! this is gold! 💯
@thushanchathuranga6694
Thank you for this wonderful tutorial. Learned many things specially in the testing section. Even if there are small differences between your version and the latest version, this tutorial is still valid.
@notsaeed
My bookmark 34:00
@GabrielGabriel-q9p
Nothing happens when I click on Send 🙁
@Settler-it9kh
Valentine Love u man❤ thanks for this Tutorial ❤ Be Happy
@Birdkokane
so i challenged my AI helper Genius from the Suit of Monica and asked the following ( mind that i made a typo in the question on purpose
in postman. global variables can be set, using javascript. i notice that using p.test(), tests can be done and i see some people using things like
if (book) {
// do something with a book or set a global var like
pm.globals.set("bookId", book.id);
}
but for testing something like
pm.test("Book found", () => {
pm.expect(book).to.be.an.('object');
pm.expect(book.available).to.be.true;
pm.expect(book.available).to.eql(true);
});
why not use the test function to set the global variable. is that not much safer? ::
response:
Using the `pm.test` function to set global variables in Postman is indeed a good practice, as it ensures that the variable is only set when certain conditions or assertions are met. This approach can help prevent unintended side effects and ensure that your tests are more robust and reliable. Here’s a detailed explanation and example of how you can achieve this:
### Why Use `pm.test` for Setting Global Variables?
1. **Conditional Setting**: By using `pm.test`, you can conditionally set global variables based on the outcome of specific assertions. This ensures that the variable is set only when the test conditions are satisfied.
2. **Readability and Maintenance**: Placing the variable-setting logic inside the test function makes your code more readable and easier to maintain. It clearly indicates that the variable is set as a result of a successful test.
3. **Error Handling**: If the assertions within `pm.test` fail, the global variable will not be set. This helps in identifying issues early and prevents the propagation of incorrect values.
### Example Implementation
Here’s an example of how you can set a global variable within a `pm.test` function:
“`javascript
// Assuming 'book' is the response object
let book = pm.response.json();
// Test to check if the book object is valid and available
pm.test("Book found and available", () => {
// Check if 'book' is an object
pm.expect(book).to.be.an('object');
// Check if 'book.available' is true
pm.expect(book.available).to.be.true;
// Check if 'book.available' strictly equals true
pm.expect(book.available).to.eql(true);
// If all tests pass, set the global variable 'bookId'
pm.globals.set("bookId", book.id);
});
“`
### Explanation
1. **Check `book` Object**: The first assertion checks if `book` is an object.
2. **Check Availability**: The second and third assertions check if the `book.available` property is `true`.
3. **Set Global Variable**: If all the assertions pass, the global variable `bookId` is set using `pm.globals.set("bookId", book.id)`.
### Benefits
– **Ensures Valid Data**: The global variable `bookId` is set only if `book` is a valid object and the `available` property is `true`.
– **Avoids Errors**: Prevents the global variable from being set with incorrect or invalid data.
– **Improved Test Reliability**: Helps in maintaining the integrity of your tests and the data they rely on.
By following this approach, you ensure that your Postman tests are not only verifying the correctness of the response but also managing the global state in a controlled and predictable manner.
but what do you (internet / OP) think of placing the creation of a global inside the test?
@AustinGEE-q3m
Will you be kind enough to run a demo session on how to use APIdog tool ?
@KaterynaOzer
thank you, it is great course!
@alienhippie12
amazing demonstration! is the test API taken offline? I was trying to use it in postman to practice, however its status 404
@Qiziloy
Great job! Your course helped me a lot to dive into API Testing!
@sumitparya
Valentin, appreciate all your hard work in creating this course. It's really helpful. Thanks a ton!
@fatemaali6247
I've set the book id as a global variable and can see it with variables, but if I wanted to use it in /get single book/ request or create order request it's giving an error("no book with id NaN"), what could be the problem? plz
@mriservice1671
This is not working.
"error": "Invalid bearer token."
@sayanid9
Hi, I need some help from you. Can you give me some online tutorial, means you can teach me how to write te the.. Actually my organization is using postman. But I am failing to write it.. If you can teach me it will be better to clear my queries
@ampoule10
For people from May 2024 and after.
In 1:49:50
Instead of postman.setNextRequest()
you can use pm.execution.setNextRequest()
@soumyatarafder7656
Excellent!
@anomolisagag2270
15min+ i watch this one,
i feel like i jump on some fundamentals to understand this video? anyone care to enlighten me?
@wantedlepota9960
Much appreciated
@wantedlepota9960
This is the best. thank you
@user-rp6vo7ns5j
Excellent tutorial, thank you! Just one suggestion – display a '*' text right around the 20 minute mark to recommend googling or chatGPT'ing any error messages received to help with the troubleshooting.
@elzbietabielinska3167
I have a question. What application uses Simple Books API?
@Ryeback101
Great video. Just had a look through it learned lot. Thanks for putting this up there
@zekethep1umber
how can he keepo running the same tests with the same orderId even though he deletes the order at the end?
@zekethep1umber
for anyone trying to use newman but are getting errors in your tests, you have to export your global variables from the web interface in postman by clicking "environments" -> "globals" -> "export" and when you run the test via newman in the cli, you have to add the comand line option '-g <source>' at the end
@oneloveafrica8860
why it's free?
@nikolozi1986
can i get python scripting in tests i mean not java
@vandematram8205
Nicely design course. Thank you
@MargaritaBudryte
amazing clear lesson. Thank you
@timstark6744
very good video. I've seen you get orders a few times now and you touched on the limit but "get all orders" is unobtanium in the real world as it would be a potential denial vector for your site. Can you show how to get all orders using pagination with the limit and offset without doing it manually?
@MrZhekaU
Thank you so much for all your work!🥰
@VineethDasi-lt3sj
Just perfect
@shashwatshrey9248
1:10:00
@oksanamelnyk7588
Thank you so much for the video. It really helped my to get a good understading of Postman just in 2 hours
@user-km9gn9yh4g
Do we need to get Simple book account to get exact same responses?
@ahmadh02
Can i install DESKTOP AGENT on ipad air?
@beh_kh6056
very useful thank you!
@gemmaashfield6983
Thanks for this excellent training resource. Really well communicated and understandable. Thank you.
@mihailovasic4088
Why cant I send PATCH request for "Update an order" using env variable, for DELETE also… does some1 have same problem? For other requests I don't have this problem.
@merican05
thank you from the bottom of my heart
@yakupaydin1213
Thank you so much!
@shwetankgupta
Thanks a lot. It is really helpful
@audrycoulson3366
Thanks!
@user-pv6pz2zv7q
Thank you for the amazing tutorial, anyway I am stuck on GET /orders/:orderId i am getting "an error": "No order with id :orderId." I can not understand where my mistake is, as I am doing the exact steps from the tutorial?
Any suggestions?
@krembryle
Note to myself: stopped watching this at 1:42:55
@VinayKumar-xp2ez
Really Awesome and great way of teaching for beginners