Skip to content

Commit 08432ba

Browse files
committed
Update testing docs
1 parent a0b1f24 commit 08432ba

2 files changed

Lines changed: 79 additions & 140 deletions

File tree

docs/TESTS.md

Lines changed: 54 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -1,156 +1,72 @@
11
# Running the Tests
22

3-
Choose your operating system:
3+
## Download an Exercise
44

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.
86

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
179
```
1810

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.
7712

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+
```
12616

127-
New: 1 problem
128-
Dart (Etl) /home/janedoe/exercism/dart/hello-world
17+
## Install Dependencies
12918

130-
unchanged: 0, updated: 0, new: 1
131-
```
19+
Before running the tests, download the exercise dependencies.
13220

133-
1. Change directory into the exercise:
21+
```shell
22+
dart pub get
23+
```
13424

135-
```shell
136-
$ cd /home/janedoe/exercism/dart/hello-world
137-
```
25+
## Run the Tests
13826

139-
1. Download the dependent packages:
27+
Now, run the tests and see the test results.
28+
```shell
29+
dart test
30+
```
14031

141-
```shell
142-
$ dart pub get
143-
```
32+
## Understanding Test Results
14433

145-
1. Run the tests:
34+
The test run summary lists the number of tests passed, skipped, and failed.
35+
For example:
14636

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+
```
15141

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+
```
15367

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.
15571

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

exercises/shared/.docs/tests.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,30 @@
11
# Tests
22

3-
To run the tests:
3+
Install dependencies.
44

55
```sh
6-
$ dart test
6+
dart pub get
77
```
8+
9+
Run the tests.
10+
11+
```sh
12+
dart test
13+
```
14+
15+
The test run summary lists the number of tests passed, skipped, and failed.
16+
For example:
17+
18+
```
19+
❯ dart test
20+
00:01 +0 ~2 -1: Some tests failed.
21+
```
22+
23+
- `+0` — 0 tests passed
24+
- `~2` — 2 tests skipped
25+
- `-1` — 1 test failed
26+
27+
Most exercises will have multiple tests where all but the first are skipped by default.
28+
As tests pass, enable the next test by changing `skip: true` to `skip: false` (or removing the `skip` parameter entirely).
29+
Once all tests pass locally, submit your solution.
30+
Note: all tests will be run by the online test runner on every submission.

0 commit comments

Comments
 (0)