Skip to content

Commit 655ef88

Browse files
author
Ogbemi mene
committed
the real file
1 parent 2871b51 commit 655ef88

1 file changed

Lines changed: 1 addition & 22 deletions

File tree

Sprint-3/1-implement-and-rewrite-tests/testing-guide.md

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,14 @@ Testing means:
3030

3131
### Step 1: Determining the space of possible inputs
3232
Ask:
33-
- What type of value is expected?
34-
The exact data type the function requires to run cleanly (e.g., Number, String, Boolean, Array, or Object).
35-
33+
- What type of value is expected?
3634
- What values make sense?
37-
Inputs that are logically valid and physically possible based on the real-world problem you are solving.
38-
3935
- If they are numbers:
4036
- Are they integers or floating-point numbers?
41-
Integers are for whole counts (e.g., count = 5); floating-point numbers are for precise measurements or money (e.g., price = 19.99).
42-
4337
- What is their range?
44-
The minimum and maximum allowable numeric values constraints (e.g., a percentage must be between 0 and 100).
45-
4638
- If they are strings:
4739
- What are their length and patterns?
48-
The specific structure strings must follow, such as character limits (e.g., 8-20 characters) or specific formats (e.g., an email pattern like name@domain.com).
4940
- What values would not make sense?
50-
Inputs that break reality or logic, such as a negative age (-5), an impossible date, or text strings passed to a multiplication function.
5141

5242
### Step 2: Choosing Good Test Values
5343

@@ -56,10 +46,7 @@ Inputs that break reality or logic, such as a negative age (-5), an impossible d
5646
These confirm that the function works in normal use.
5747

5848
- What does a typical, ordinary input look like?
59-
A standard, error-free value safely in the middle of your expected range (e.g., using 25 for an adult age check).
60-
6149
- Are there multiple ordinary groups of inputs? e.g. for an age checking function, maybe there are "adults" and "children" as expected ordinary groups of inputs.
62-
Yes; any time your code uses an if/else or switch statement to categorize data, each distinct category forms its own ordinary group.
6350

6451

6552
#### Boundary Cases
@@ -72,22 +59,14 @@ These values are where logic breaks most often.
7259
Every outcome must be reached by at least one test.
7360

7461
- How many different results can this function produce?
75-
It produces exactly as many results as there are logical paths, code branches, or conditional statements (if, else if, else, catch).
76-
7762
- Have I tested a value that leads to each one?
78-
You have only if your test cases intentionally execute every single code path at least once (known as 100% code coverage).
7963

8064
#### Crossing the Edges and Invalid Values
8165

8266
This tests how the function behaves when assumptions are violated.
8367
- What happens when input is outside of the expected range?
84-
The function should reject it by throwing an error or returning a safe default/fallback value (like null or false) instead of breaking.
85-
8668
- What happens when input is not of the expected type?
87-
It risks triggering unexpected JavaScript behavior (like "5" + 5 = "55"). Good functions guard against this with explicit type checks (typeof).
88-
8969
- What happens when input is not in the expected format?
90-
String parsers, data formatters, or regular expressions will fail to match, which should be caught cleanly without crashing the application.
9170

9271
## 4. How to Test
9372

0 commit comments

Comments
 (0)