-
-
Notifications
You must be signed in to change notification settings - Fork 97
Update testing docs #651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Update testing docs #651
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,156 +1,72 @@ | ||
| # Running the Tests | ||
|
|
||
| Choose your operating system: | ||
| ## Download an Exercise | ||
|
|
||
| * [Windows](#windows) | ||
| * [Mac OS X](#mac-os-x) | ||
| * [Linux](#linux) | ||
| Use the [Exercism CLI][cli] to download the exercise you want to work on. | ||
|
|
||
| ## Understanding Test Result | ||
|
|
||
| The test run summary will list the number of passed, skipped and failed tests. | ||
| For example : | ||
|
|
||
| ``` | ||
| ❯ dart test | ||
| 00:01 +4 ~3 -1: Some tests failed. | ||
| ```shell | ||
| exercism download --track=dart --exercise=hello-world | ||
| ``` | ||
|
|
||
| `+` describes the number of tests passed. In this example, 4 tests are passed. | ||
|
|
||
| `~` describes the number of tests skipped. In this example, 3 tests are skipped. | ||
|
|
||
| `-` describes the number of tests failed. In this case, there is only one test that failed. | ||
|
|
||
| The `skip` parameter instructs the test suite to not run a test. | ||
| This is commonly used to avoid running tests of unimplemented functionality, so you can focus on the part you are currently working on. | ||
|
|
||
| It is advised to enable tests one by one as you implement the functionality being tested or as you move towards edge cases. | ||
| You can do so by flipping the `skip: false` to `skip: true` flag for each test. | ||
| You can also submit your exercise without passing all tests to get feedback. | ||
|
|
||
| ---- | ||
|
|
||
| # Windows | ||
|
|
||
| 1. Open a Command Prompt. | ||
|
|
||
| 1. Get the first exercise: | ||
|
|
||
| ```batchfile | ||
| C:\Users\JaneDoe>exercism fetch dart | ||
|
|
||
| Not Submitted: 1 problem | ||
| dart (Hello World) C:\Users\JaneDoe\exercism\dart\hello-world | ||
|
|
||
| New: 1 problem | ||
| dart (Hello World) C:\Users\JaneDoe\exercism\dart\hello-world | ||
|
|
||
| unchanged: 0, updated: 0, new: 1 | ||
| ``` | ||
|
|
||
| 1. Change directory into the exercism: | ||
|
|
||
| ```batchfile | ||
| C:\Users\JaneDoe>cd C:\Users\JaneDoe\exercism\dart\hello-world | ||
| ``` | ||
|
|
||
| 1. Download the dependent packages: | ||
|
|
||
| ```batchfile | ||
| C:\Users\JaneDoe>dart pub get | ||
| ``` | ||
|
|
||
| 1. Run the tests: | ||
|
|
||
| ```batchfile | ||
| C:\Users\JaneDoe>dart test | ||
| ``` | ||
| *(Don't worry about the tests failing, at first, this is how you begin each exercise.)* | ||
|
|
||
| 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)). | ||
|
|
||
|
|
||
| Good luck! Have fun! | ||
|
|
||
| If you get stuck, at any point, don't forget to reach out for [help](https://exercism.org/docs/tracks/dart). | ||
| Then change into the exercise directory. | ||
|
|
||
| ---- | ||
|
|
||
| # Mac OS X | ||
|
|
||
| 1. In the terminal window, get the first exercise: | ||
|
|
||
| ```shell | ||
| $ exercism fetch dart | ||
|
|
||
| New: 1 problem | ||
| Dart (Etl) /Users/janedoe/exercism/dart/hello-world | ||
|
|
||
| unchanged: 0, updated: 0, new: 1 | ||
| ``` | ||
|
|
||
| 1. Change directory into the exercise: | ||
|
|
||
| ```shell | ||
| $ cd /Users/janedoe/exercism/dart/hello-world | ||
| ``` | ||
|
|
||
| 1. Download the dependent packages: | ||
|
|
||
| ```shell | ||
| $ dart pub get | ||
| ``` | ||
|
|
||
| 1. Run the tests: | ||
|
|
||
| ```shell | ||
| $ dart test | ||
| ``` | ||
| *(Don't worry about the tests failing, at first, this is how you begin each exercise.)* | ||
|
|
||
| 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)). | ||
|
|
||
| Good luck! Have fun! | ||
|
|
||
| If you get stuck, at any point, don't forget to reach out for [help](https://exercism.org/docs/tracks/dart). | ||
|
|
||
| ---- | ||
|
|
||
| # Linux | ||
|
|
||
| 1. In the terminal window, get the first exercise: | ||
|
|
||
| ```shell | ||
| $ exercism fetch dart | ||
| ```shell | ||
| cd /path/to/exercism/dart/hello-world | ||
| ``` | ||
|
|
||
| New: 1 problem | ||
| Dart (Etl) /home/janedoe/exercism/dart/hello-world | ||
| ## Install Dependencies | ||
|
|
||
| unchanged: 0, updated: 0, new: 1 | ||
| ``` | ||
| Before running the tests, download the exercise dependencies. | ||
|
|
||
| 1. Change directory into the exercise: | ||
| ```shell | ||
| dart pub get | ||
| ``` | ||
|
|
||
| ```shell | ||
| $ cd /home/janedoe/exercism/dart/hello-world | ||
| ``` | ||
| ## Run the Tests | ||
|
|
||
| 1. Download the dependent packages: | ||
| Now, run the tests and see the test results. | ||
| ```shell | ||
| dart test | ||
| ``` | ||
|
|
||
| ```shell | ||
| $ dart pub get | ||
| ``` | ||
| ## Understanding Test Results | ||
|
|
||
| 1. Run the tests: | ||
| The test run summary lists the number of tests passed, skipped, and failed. | ||
| For example: | ||
|
|
||
| ```shell | ||
| $ dart test | ||
| ``` | ||
| *(Don't worry about the tests failing, at first, this is how you begin each exercise.)* | ||
| ``` | ||
| ❯ dart test | ||
| 00:01 +0 ~2 -1: Some tests failed. | ||
| ``` | ||
|
|
||
| 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)). | ||
| - `+0` — 0 tests passed | ||
| - `~2` — 2 tests skipped | ||
| - `-1` — 1 test failed | ||
|
|
||
| Most exercises will have multiple tests where all but the first are skipped by default. | ||
| Here's what a typical test file looks like: | ||
|
|
||
| ```dart | ||
| group('TwoFer', () { | ||
| test('no name given', () { | ||
| final result = twoFer(); | ||
| expect(result, equals('One for you, one for me.')); | ||
| }, skip: false); | ||
|
|
||
| test('a name given', () { | ||
| final result = twoFer('Alice'); | ||
| expect(result, equals('One for Alice, one for me.')); | ||
| }, skip: true); | ||
|
|
||
| test('another name given', () { | ||
| final result = twoFer('Bob'); | ||
| expect(result, equals('One for Bob, one for me.')); | ||
| }, skip: true); | ||
| }); | ||
| ``` | ||
|
|
||
| Good luck! Have fun! | ||
| As tests pass, enable the next test by changing `skip: true` to `skip: false` (or removing the `skip` parameter entirely). | ||
| Once all tests pass locally, submit your solution. | ||
| Note: all tests will be run by the online test runner on every submission. | ||
|
|
||
| If you get stuck, at any point, don't forget to reach out for [help](https://exercism.org/docs/tracks/dart). | ||
| [cli]: https://exercism.org/docs/using/solving-exercises/working-locally | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,30 @@ | ||
| # Tests | ||
|
|
||
| To run the tests: | ||
| Install dependencies. | ||
|
|
||
| ```sh | ||
| $ dart test | ||
| dart pub get | ||
| ``` | ||
|
|
||
| Run the tests. | ||
|
|
||
| ```sh | ||
| dart test | ||
| ``` | ||
|
|
||
| The test run summary lists the number of tests passed, skipped, and failed. | ||
| For example: | ||
|
|
||
| ``` | ||
| ❯ dart test | ||
| 00:01 +0 ~2 -1: Some tests failed. | ||
| ``` | ||
|
|
||
| - `+0` — 0 tests passed | ||
| - `~2` — 2 tests skipped | ||
| - `-1` — 1 test failed | ||
|
|
||
| Most exercises will have multiple tests where all but the first are skipped by default. | ||
| As tests pass, enable the next test by changing `skip: true` to `skip: false` (or removing the `skip` parameter entirely). | ||
| Once all tests pass locally, submit your solution. | ||
| Note: all tests will be run by the online test runner on every submission. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.