QuizzifyTech

Bug library › API testing

API testing · Products API

in_stock is sent as the string "false", so the app shows the item as in stock

P2 · MajorExperiencedProducts API

Want to find it yourself first? This page gives away the answer. Play this bug on a fake app screen and see if you can spot it in three tries.

Spot this bug

The clue

Look at the data types, not only the values.

Steps to reproduce

  1. Send GET /api/products?ids=55,56
  2. Compare the type of "in_stock" for both products

Expected result

"in_stock": false (a boolean, like product 55)

Actual result

"in_stock": "false" (a string), which apps treat as true

Why it matters

This is a major (P2) bug. The feature still works in part, but users get wrong information or a broken step, and many will notice. It should be fixed before or soon after release.

Testing tip

Check types, not just values. "false", "0" and "" behave very differently from false and 0 in most code.

How to find bugs like this

API bugs live in the JSON between the app and the server: wrong records returned, fields that leak private data, bad status codes and limits that are not enforced. When you test, try these checks:

  • Read the whole response body, not only the status code.
  • Ask for other users’ records on purpose.
  • Look for fields that should never leave the server.
  • Send values at and past every limit.

More API testing bugs

See all 158 bugs