|
1 | 1 | # Running the Tests |
2 | 2 |
|
3 | | -Choose your operating system: |
| 3 | +## Download an Exercise |
4 | 4 |
|
5 | | -* [Windows](#windows) |
6 | | -* [Mac OS X](#mac-os-x) |
7 | | -* [Linux](#linux) |
| 5 | +Use the [Exercism CLI][cli] to download the exercise you want to work on. |
8 | 6 |
|
9 | | -## Understanding Test Result |
10 | | - |
11 | | -The test run summary will list the number of passed, skipped and failed tests. |
12 | | -For example : |
13 | | - |
14 | | -``` |
15 | | -❯ dart test |
16 | | -00:01 +4 ~3 -1: Some tests failed. |
| 7 | +```shell |
| 8 | +exercism download --track=dart --exercise=hello-world |
17 | 9 | ``` |
18 | 10 |
|
19 | | -`+` describes the number of tests passed. In this example, 4 tests are passed. |
20 | | - |
21 | | -`~` describes the number of tests skipped. In this example, 3 tests are skipped. |
22 | | - |
23 | | -`-` describes the number of tests failed. In this case, there is only one test that failed. |
24 | | - |
25 | | -The `skip` parameter instructs the test suite to not run a test. |
26 | | -This is commonly used to avoid running tests of unimplemented functionality, so you can focus on the part you are currently working on. |
27 | | - |
28 | | -It is advised to enable tests one by one as you implement the functionality being tested or as you move towards edge cases. |
29 | | -You can do so by flipping the `skip: false` to `skip: true` flag for each test. |
30 | | -You can also submit your exercise without passing all tests to get feedback. |
31 | | - |
32 | | ----- |
33 | | - |
34 | | -# Windows |
35 | | - |
36 | | -1. Open a Command Prompt. |
37 | | - |
38 | | -1. Get the first exercise: |
39 | | - |
40 | | - ```batchfile |
41 | | - C:\Users\JaneDoe>exercism fetch dart |
42 | | -
|
43 | | - Not Submitted: 1 problem |
44 | | - dart (Hello World) C:\Users\JaneDoe\exercism\dart\hello-world |
45 | | -
|
46 | | - New: 1 problem |
47 | | - dart (Hello World) C:\Users\JaneDoe\exercism\dart\hello-world |
48 | | -
|
49 | | - unchanged: 0, updated: 0, new: 1 |
50 | | - ``` |
51 | | -
|
52 | | -1. Change directory into the exercism: |
53 | | -
|
54 | | - ```batchfile |
55 | | - C:\Users\JaneDoe>cd C:\Users\JaneDoe\exercism\dart\hello-world |
56 | | - ``` |
57 | | -
|
58 | | -1. Download the dependent packages: |
59 | | -
|
60 | | - ```batchfile |
61 | | - C:\Users\JaneDoe>dart pub get |
62 | | - ``` |
63 | | -
|
64 | | -1. Run the tests: |
65 | | -
|
66 | | - ```batchfile |
67 | | - C:\Users\JaneDoe>dart test |
68 | | - ``` |
69 | | - *(Don't worry about the tests failing, at first, this is how you begin each exercise.)* |
70 | | -
|
71 | | -1. Solve the exercise. Find and work through the `instructions.md` guide ([view on GitHub](https://github.com/exercism/dart/blob/main/exercises/practice/hello-world/.docs/instructions.md)). |
72 | | -
|
73 | | -
|
74 | | -Good luck! Have fun! |
75 | | -
|
76 | | -If you get stuck, at any point, don't forget to reach out for [help](https://exercism.org/docs/tracks/dart). |
| 11 | +Then change into the exercise directory. |
77 | 12 |
|
78 | | ----- |
79 | | -
|
80 | | -# Mac OS X |
81 | | -
|
82 | | -1. In the terminal window, get the first exercise: |
83 | | -
|
84 | | - ```shell |
85 | | - $ exercism fetch dart |
86 | | -
|
87 | | - New: 1 problem |
88 | | - Dart (Etl) /Users/janedoe/exercism/dart/hello-world |
89 | | -
|
90 | | - unchanged: 0, updated: 0, new: 1 |
91 | | - ``` |
92 | | -
|
93 | | -1. Change directory into the exercise: |
94 | | -
|
95 | | - ```shell |
96 | | - $ cd /Users/janedoe/exercism/dart/hello-world |
97 | | - ``` |
98 | | -
|
99 | | -1. Download the dependent packages: |
100 | | -
|
101 | | - ```shell |
102 | | - $ dart pub get |
103 | | - ``` |
104 | | -
|
105 | | -1. Run the tests: |
106 | | -
|
107 | | - ```shell |
108 | | - $ dart test |
109 | | - ``` |
110 | | - *(Don't worry about the tests failing, at first, this is how you begin each exercise.)* |
111 | | -
|
112 | | -1. Solve the exercise. Find and work through the `instructions.md` guide ([view on GitHub](https://github.com/exercism/dart/blob/main/exercises/practice/hello-world/.docs/instructions.md)). |
113 | | -
|
114 | | -Good luck! Have fun! |
115 | | -
|
116 | | -If you get stuck, at any point, don't forget to reach out for [help](https://exercism.org/docs/tracks/dart). |
117 | | -
|
118 | | ----- |
119 | | -
|
120 | | -# Linux |
121 | | -
|
122 | | -1. In the terminal window, get the first exercise: |
123 | | -
|
124 | | - ```shell |
125 | | - $ exercism fetch dart |
| 13 | +```shell |
| 14 | +cd /path/to/exercism/dart/hello-world |
| 15 | +``` |
126 | 16 |
|
127 | | - New: 1 problem |
128 | | - Dart (Etl) /home/janedoe/exercism/dart/hello-world |
| 17 | +## Install Dependencies |
129 | 18 |
|
130 | | - unchanged: 0, updated: 0, new: 1 |
131 | | - ``` |
| 19 | +Before running the tests, download the exercise dependencies. |
132 | 20 |
|
133 | | -1. Change directory into the exercise: |
| 21 | +```shell |
| 22 | +dart pub get |
| 23 | +``` |
134 | 24 |
|
135 | | - ```shell |
136 | | - $ cd /home/janedoe/exercism/dart/hello-world |
137 | | - ``` |
| 25 | +## Run the Tests |
138 | 26 |
|
139 | | -1. Download the dependent packages: |
| 27 | +Now, run the tests and see the test results. |
| 28 | +```shell |
| 29 | +dart test |
| 30 | +``` |
140 | 31 |
|
141 | | - ```shell |
142 | | - $ dart pub get |
143 | | - ``` |
| 32 | +## Understanding Test Results |
144 | 33 |
|
145 | | -1. Run the tests: |
| 34 | +The test run summary lists the number of tests passed, skipped, and failed. |
| 35 | +For example: |
146 | 36 |
|
147 | | - ```shell |
148 | | - $ dart test |
149 | | - ``` |
150 | | - *(Don't worry about the tests failing, at first, this is how you begin each exercise.)* |
| 37 | +``` |
| 38 | +❯ dart test |
| 39 | +00:01 +0 ~2 -1: Some tests failed. |
| 40 | +``` |
151 | 41 |
|
152 | | -1. Solve the exercise. Find and work through the `instructions.md` guide ([view on GitHub](https://github.com/exercism/dart/blob/main/exercises/practice/hello-world/.docs/instructions.md)). |
| 42 | +- `+0` — 0 tests passed |
| 43 | +- `~2` — 2 tests skipped |
| 44 | +- `-1` — 1 test failed |
| 45 | + |
| 46 | +Most exercises will have multiple tests where all but the first are skipped by default. |
| 47 | +Here's what a typical test file looks like: |
| 48 | + |
| 49 | +```dart |
| 50 | +group('TwoFer', () { |
| 51 | + test('no name given', () { |
| 52 | + final result = twoFer(); |
| 53 | + expect(result, equals('One for you, one for me.')); |
| 54 | + }, skip: false); |
| 55 | +
|
| 56 | + test('a name given', () { |
| 57 | + final result = twoFer('Alice'); |
| 58 | + expect(result, equals('One for Alice, one for me.')); |
| 59 | + }, skip: true); |
| 60 | +
|
| 61 | + test('another name given', () { |
| 62 | + final result = twoFer('Bob'); |
| 63 | + expect(result, equals('One for Bob, one for me.')); |
| 64 | + }, skip: true); |
| 65 | +}); |
| 66 | +``` |
153 | 67 |
|
154 | | -Good luck! Have fun! |
| 68 | +As tests pass, enable the next test by changing `skip: true` to `skip: false` (or removing the `skip` parameter entirely). |
| 69 | +Once all tests pass locally, submit your solution. |
| 70 | +Note: all tests will be run by the online test runner on every submission. |
155 | 71 |
|
156 | | -If you get stuck, at any point, don't forget to reach out for [help](https://exercism.org/docs/tracks/dart). |
| 72 | +[cli]: https://exercism.org/docs/using/solving-exercises/working-locally |
0 commit comments