Skip to content

Commit bfa68d6

Browse files
committed
Revert testing-guide.md
1 parent 8a35211 commit bfa68d6

1 file changed

Lines changed: 11 additions & 14 deletions

File tree

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

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ Input ──▶ Function ──▶ Output
77
```
88

99
A function
10-
1110
- Takes **input** (via **arguments**)
1211
- Does some work
1312
- Produces **one output** (via a **return value**)
14-
13+
1514
Example:
1615

1716
```
@@ -20,18 +19,17 @@ sum(2, 3) → 5
2019

2120
Important idea: the same input should produce the same output.
2221

23-
## 2. Testing Means Predicting
2422

25-
Testing means:
23+
## 2. Testing Means Predicting
2624

25+
Testing means:
2726
> If I give this input, what output should I get?
2827
28+
2929
## 3. Choosing Good Test Values
3030

3131
### Step 1: Determining the space of possible inputs
32-
3332
Ask:
34-
3533
- What type of value is expected?
3634
- What values make sense?
3735
- If they are numbers:
@@ -41,7 +39,7 @@ Ask:
4139
- What are their length and patterns?
4240
- What values would not make sense?
4341

44-
### Step 2: Choosing Good Test Values
42+
### Step 2: Choosing Good Test Values
4543

4644
#### Normal Cases
4745

@@ -50,9 +48,10 @@ These confirm that the function works in normal use.
5048
- What does a typical, ordinary input look like?
5149
- 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.
5250

51+
5352
#### Boundary Cases
5453

55-
Test values exactly at, just inside, and just outside defined ranges.
54+
Test values exactly at, just inside, and just outside defined ranges.
5655
These values are where logic breaks most often.
5756

5857
#### Consider All Outcomes
@@ -65,7 +64,6 @@ Every outcome must be reached by at least one test.
6564
#### Crossing the Edges and Invalid Values
6665

6766
This tests how the function behaves when assumptions are violated.
68-
6967
- What happens when input is outside of the expected range?
7068
- What happens when input is not of the expected type?
7169
- What happens when input is not in the expected format?
@@ -75,19 +73,18 @@ This tests how the function behaves when assumptions are violated.
7573
### 1. Using `console.assert()`
7674

7775
```javascript
78-
// Report a failure only when the first argument is false
79-
console.assert(sum(4, 6) === 10, "Expected 4 + 6 to equal 10");
76+
// Report a failure only when the first argument is false
77+
console.assert( sum(4, 6) === 10, "Expected 4 + 6 to equal 10" );
8078
```
8179

8280
It is simpler than using `if-else` and requires no setup.
83-
81+
8482
### 2. Jest Testing Framework
8583

8684
```javascript
87-
describe("Description for this case used for grouping")
8885
test("Should correctly return the sum of two positive numbers", () => {
8986
expect( sum(4, 6) ).toEqual(10);
90-
... // Can test multiple samples
87+
... // Can test multiple samples
9188
});
9289

9390
```

0 commit comments

Comments
 (0)