What you will learn
A positive test uses allowed input. A negative test breaks one rule and keeps everything else valid. A written case is not done until you have sent it and kept the response.
Your goals
- Send one accepted customer and one rejected customer.
- Keep the two results separate.
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
- Read the customer rules: name 1–80 characters after trimming, a unique email, optional age 18–120, and no unknown fields.
- Click Create workspace. Send the login request for fictional customer A. Copy the token from the response.
- Send a customer create with a valid name, a new fictional email, and that token. Select the successful response.
- Send another create that breaks only the name rule, using an empty name and a different email. Select that response.
- Copy both statuses and choose what a negative test changes. Submit Answers. Keep the workspace until the score is saved.
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 accepted and rejected cases are both sent.
- The negative case breaks only the name.
- Each status comes from its own selected response.
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 accepted and rejected cases are both sent.
- The negative case breaks only the name.
- Each status comes from its own selected response.
Repeat with a different valid name and a new email. The same two rules should still hold.
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.