You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: using/solving-exercises/tdd.md
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,23 +34,25 @@ Should you choose to work with a mentor (and we encourage you to do that once yo
34
34
When you're working in the code editor on Exercism's website, you can read the tests but you are not able to edit them.
35
35
All tests will be executed each time you run them, regardless of any "skip" mechanisms noted in the test file.
36
36
37
-
Test results will default to expanding the first failed test message (although what is displayed varies by track).
37
+
When there are multiple tests that fail, three website initially only displays the results of the first failure.
38
+
You can click on other failures to expand them, too!
39
+
Sometimes the first result may not be the most informative.
38
40
39
41
Don't be discouraged by a large number of failing tests.
40
42
Focus on making them pass one-by-one.
41
43
42
44
## Working locally
43
45
44
46
Many tracks use "skipped" tests in their test files.
45
-
Initially, only the first test is "active" and the remaining are deactivated (how this happens varies by track).
47
+
Initially, only the first test is "active" and the remaining are inactive (how this happens varies by track).
46
48
When you run the test suite in your environment, only the first test runs.
47
49
We do this to encourage you to follow this workflow:
48
50
49
51
1. Before adding any new code, run the test suite: you should see a failing test.
50
52
1. Add _just enough_ code to pass the test.
51
53
1. Run the test suite.
52
54
1. If the test still fails, repeat step 2.
53
-
1. Once the test passes, refactor your code as desired, ensuring all the activated tests still pass.
55
+
1. Once the test passes, refactor your code as desired, ensuring all active tests still pass.
54
56
Refactoring might include:
55
57
- removing any duplicated code,
56
58
- spliting long functions into smaller ones
@@ -63,13 +65,13 @@ Once all the tests are passing, congratulations, you have solved the exercise!
63
65
Exactly how tests are "unskipped" (or activated) depends on the track.
64
66
For some tracks, it might be commenting or removing an annotation.
65
67
For some tracks, it might be changing an attribute from true to false.
66
-
Take the time to read [the documentation for your track][track-docs]: it will explain these details.
68
+
Take the time to read [the documentation for your track][track-docs]; it will explain these details.
67
69
68
70
For tracks that don't skip the tests, applying this workflow may be as straightforward as commenting out the tests and uncommenting them one-by-one.
69
71
70
72
## Rationale for Test-Driven Development
71
73
72
-
While it may seem like "putting the cart before the horse", there are several good reasons why you might want to write unit tests before writing the implementation code:
74
+
While it may seem like "putting the cart before the horse", there are several good reasons why you might want to write unit tests before writing the implementation code.
73
75
74
76
1. Design.
75
77
It forces you to think first about the design of the **interface** to the code, instead of jumping straight to the implementation.
0 commit comments