- Api Testing Tutorial
- Api Testing Cheat Sheet Excel
- Api Testing Cheat Sheet Download
- Rest Api Testing Cheat Sheet
- Api Testing Cheat Sheet Pdf
- Api Testing Cheat Sheet
C H E A T S H E E T OWASP API Security Top 10 A9: IMPROPER ASSETS MANAGEMENT Attacker finds non-production versions of the API: such as staging, testing, beta or earlier versions - that are not as well protected, and uses.
A short guide to all the exported functions in DOM Testing Library
Queries#
- Declaration & Initialization Declaration: DataType VariableName, Initialization: VariableName = Value; Data Type: a)Primitive: Also known as intrinsic – boolean.
- LoadView API can thoroughly test REST and SOAP APIs. It checks the expected results vs. The actual results of the APIs, which covers Functional, Integration, Regression, and UI testing. It shows you individual test sessions so you can see any error codes that were returned.
- An essential part of every UI test framework is the usage of a unit testing framework. One of the most popular ones in the.NET world is NUnit. However, you cannot find a single place where you can get started with its syntax. So, I decided that it would be great to create a complete cheat sheet. I hope that you will find it useful.
See Which query should I use?
| No Match | 1 Match | 1+ Match | Await? | |
|---|---|---|---|---|
| getBy | throw | return | throw | No |
| findBy | throw | return | throw | Yes |
| queryBy | null | return | throw | No |
| getAllBy | throw | array | array | No |
| findAllBy | throw | array | array | Yes |
| queryAllBy | [] | array | array | No |
- ByLabelText find by label or aria-label text content
- getByLabelText
- queryByLabelText
- getAllByLabelText
- queryAllByLabelText
- findByLabelText
- findAllByLabelText
- ByPlaceholderText find by input placeholder value
- getByPlaceholderText
- queryByPlaceholderText
- getAllByPlaceholderText
- queryAllByPlaceholderText
- findByPlaceholderText
- findAllByPlaceholderText
- ByText find by element text content
- getByText
- queryByText
- getAllByText
- queryAllByText
- findByText
- findAllByText
- ByDisplayValue find by form element current value
- getByDisplayValue
- queryByDisplayValue
- getAllByDisplayValue
- queryAllByDisplayValue
- findByDisplayValue
- findAllByDisplayValue
- ByAltText find by img alt attribute
- getByAltText
- queryByAltText
- getAllByAltText
- queryAllByAltText
- findByAltText
- findAllByAltText
- ByTitle find by title attribute or svg title tag
- getByTitle
- queryByTitle
- getAllByTitle
- queryAllByTitle
- findByTitle
- findAllByTitle
- ByRole find by aria role
- getByRole
- queryByRole
- getAllByRole
- queryAllByRole
- findByRole
- findAllByRole
- ByTestId find by)
- configure change global options:
configure({testIdAttribute: 'my-data-test-id'})
Text Match Options#
Given the following HTML:
Will find the div:
Api Testing Tutorial
Given a button that updates the page after some time:
Intro
I had just become the first API-centric QA at a startup, and I found the opportunity of establishing standard operating procedures both rewarding and thrilling. Not having rigid documentation to dictate the right or wrong way to do things became one of the most rewarding experiences I've had working in tech. I started to use Postman at that company, and I immediately fell in love with it. Postman was much easier to use and more versatile than the internally developed tools I had used in the past.
When I started to instruct my coworkers on the nuances of Postman, I realized there had to be others new to API testing or even new to software testing who would also benefit from these lessons. It became a sort of thought experiment to figure out the cheat sheet that I would have liked to inherit on my first day of the job.
I never found a single source of truth that I exclusively relied on. I have provided several links to the sites that I found to be the most informational for my purposes as well as some Postman basics to get started with.
Useful Links
This is probably the best, most comprehensive, Postman reference guide I have found. For some, it might be the only resource they need. Download library. This is a definite must-read.
Chai.js is an assertion library that comes baked into Postman. Learning the syntax to this assertion library has vastly improved the complexity of my tests. This guide demonstrates how user-friendly Chai.js can be.
These are some additional Chai.js examples. There are many snippets here that I have incorporated into my own tests.
Api Testing Cheat Sheet Excel

This extensive list of publically available APIs is for those of you who don't have an API to call their own. I've personally used Game of Thrones API and Cat Facts for my own API education.
Newman allows you to run your Postman collections directly through the command line. This link has been useful in my efforts to integrate and automate my tests through Jenkins CI pipelines. Postman is not only a manual API testing tool. With the integration of Newman, you will be able to have your Postman collections kicked off automatically through backend automation.
Are you using a RESTful API? These HTTP methods are useful to know for any dev or software QA role. For example, know when to GET, POST, PATCH, or DELETE.
Knowing HTTP status response codes is incredibly useful. Know which errors you would expect if you're logged out, if data was created, deleted, etc. If you get a 500, there's a chance you just found a bug.
Importing a Collection or Individual Request
- Open Postman and click on the gray 'Import' button in the top left corner.
- There are multiple ways in which Postman collections are shared. Select the desired option and complete the import.
- Import File: A JSON file that can be selected from your computer’s file path.
- Import Folder: Import multiple JSON files saved in the same directory.
- Import From Link: Import a single request or Collection using a Postman-URL.
- Paste Raw Text: This is how individual requests are usually imported. You'll generally use a cURL in this case.
Postman URLS will look like this:
cURLs will look like this:
Sharing a Request
- In Postman, select the individual request you would like to share from the Collection tab on the far left.
- Click on the “Code” button from within the request. Shown below.
3. Choose the code option from the dropdown and then click “Copy to Clipboard”. I usually use cURL. You can now share this individual request. If you're a QA or dev needing to share an endpoint for whatever reason, this is the way to do it. You can even just run it in the terminal if you wanted.
Note: You can share entire Collections by clicking on the Collection, itself. Then click the three-dots and 'Share Collection' will be an available option.
Running a Request
- There are many tabs in the request window that you may need to utilize when testing endpoints. I'll go over them very briefly as each organization will have APIs that utilize these differently.
- Params: You may need to use these parameters to filter the results you desire.
- Authorization: Self-explanatory. Authorization/login related.
- Headers: Headers are the value pairs that you'll need to make the request functional.
- Body: Certain methods will require you to enter parameters, most likely written in Javascript. Make sure the body is written using proper syntax. Otherwise, an error may occur and the collection will not compile properly.
- Pre-request Script: These are the scripts you want to happen before you send the request. A couple of examples are clearing the environment or perhaps you want to set a response as a variable to be used for other requests.
- Tests: Tests are where you can write your own Javascript tests using standard Javascript or utilizing the Chai assertion library which is baked into Postman by default.
2. With all necessary params, authorizations and headers specified, click the large blue “Send” button. This will execute the request.
3. The response will then appear in the panel below. This shows whether or not the request executed properly. A status code will be displayed along with the JSON/XML response.
Interpreting the Response
- Select the individual API request you want to run, from the Collections tab on the far left.
- Click the large blue “Send” button, which will then execute the request.
- The response will then appear in the panel below. This shows you whether or not the request executed properly. A status code will be displayed along with the JSON/XML response.
- Response cookies show any cookies returned by the request.
- Response headers will display response headers including versioning if your API has that incorporated. You might see dates character counts, etc.
- Passed tests will show any Javascript/ Chai Assertion tests that were written in “Tests” portion of the request.
- The response body portion of the lower window will display the JSON/XML response of the submitted request.
Forking or Duplicating a Collection
- There will be times when you do not necessarily want to work off a shared collection. You may be worried about someone else saving over your work, or you may not want to save over theirs. Click on the collection you want to branch off and click on the 3-dot icon to open up the popup menu.
- Click on the “Create a Fork” option.
- Add a label for the fork.
- Now you can use this forked version of the API Collection instead of working off the original. This will ensure that everyone adding to this collection won’t override each other’s changes. Use this option for version control.
Test Code Snippets
Api Testing Cheat Sheet Download
So you want to write some Chai tests but don't know where to start? Some of the links I posted earlier have some examples, but here are a few more. Postman also has an intuitive snippets functionality.
Rest Api Testing Cheat Sheet
Status Code Checks
Timer Checks
Response Header Checks
Api Testing Cheat Sheet Pdf
Response Text Check
JSON Check
Api Testing Cheat Sheet
Clear Environment Data
Online Courses
And finally, I leave you with two useful online courses I have utilized. There may be no shortage of them out there, but these are the ones that helped me. They may help you too.
Thanks
Thank you for making it to the end. Feel free to like and share. Constructive feedback is appreciated.
#postman #apitesting #api #chai
