Skip to content
CodeKruPro

Test missing, null, empty and wrong-type values

Automation taskMediumAsked in: Amazon, Swiggy

Interviewers like to ask: "Is a missing field the same as a null field?" In this lesson you send missing, null, empty and wrong-type values and judge each status code and error body, so you can answer from what real APIs do.

Test missing, null, empty and wrong-type values

04 · Design cases and verify stored changes

Recommended first: Test boundaries without one failure masking another

Your goal: Test missing, null, empty and wrong-type values

Type each request yourself. This lesson shows the method, URL, headers and body. It does not fill the console.

  1. 1Set up data
  2. 2Send requests
  3. 3Submit answers

Start here: sign in to practise.

Jump to practice

What you will learn

A missing field is not in the JSON. null is a value. An empty string is a different value. One request cannot cover all three.

Your goals

  • Execute missing, null, empty and wrong-type name cases separately.
  • Use a valid control to show the other fields are acceptable.

Before you start

Read the previous lesson first if you have not already. This course does not require programming.

Practice setup

Click Create workspace. Then log in as the fictional customer named in the steps. Use that practice token, not your CodeKru sign-in. Reset starts this lesson’s data over and invalidates its tokens.

Follow these steps

  1. Create this lesson’s workspace and log in as A. Use a fresh email in every case and keep all fields other than name valid.
  2. Send one create with no name key and select it. Send another with "name": null and select it. They are different JSON bodies.
  3. Send another with "name": "" and another with "name": 42. Select each separately. Type the body changes yourself after preparation.
  4. Send a valid name and new email as the positive control, leaving optional age out. Select its response.
  5. Compare all five responses, classify the missing key and submit. This is a five-row input partition table, not one request testing five conditions.

Investigate before concluding

First record the actual result for each case. Compare the body, headers and later state with the stated contract. Keep an observation separate from a prediction; use the model answer only after making your own attempt.

What to keep as evidence

  • The missing-name request does not contain a name field.
  • The valid request shows the other fields would work.
  • The two statuses are copied from the selected responses.
References for this lesson

Finish this assignment

Select each named response with Use this response. Answer from those responses or the transcript on this page. Click Submit Answers. Your score is the percentage of checks that passed. Core checks are required to finish. Extra evidence checks are labelled. A saved 100/100 means every check passed. Continue opens the next lesson you can submit.

If something goes wrong
  • Change one part of the request at a time.
  • A 401 means the practice login token is missing or expired. Log in again in this workspace.
  • A 409 on create means that fictional email is already used. Choose another email.
Self-review and independent variation
  • The missing-name request does not contain a name field.
  • The valid request shows the other fields would work.
  • The two statuses are copied from the selected responses.

Send a valid name with spaces around it and compare the stored name with the text you typed.

Automatic checks verify the requests and answers configured for this lesson. The self-review is for your own reasoning. A score is not a certificate.

Open API reference

Practise and save your evidence

The lesson is public. Sign in to send requests and save progress. You will return to this lesson.

Sign in to practiseCreate an account