dart-lang / dart-lang/webdev

[DWDS] Restructure tests and use `package:mockito` to generate mocks

Open
#1,643 1 comment 0 reactions 0 assignees View on GitHub
P3 package:dwds triaged
Dominant language
Dart
Stars
224
Forks
94
Avg merge
7h 14m
Merged PRs (30d)
2

Description

### Background context:

Currently the majority of tests in DWDS are integration tests using `chromedriver`. We have a few unit tests as well, some of which implement their own fakes (eg, in [`metadata_test.dart`](https://github.com/dart-lang/webdev/blob/ab82887641d794d00d7d510e4f3d005c491adce3/dwds/test/metadata_test.dart#L40-L56)), others of which use the fakes from [`fakes.dart`](https://github.com/dart-lang/webdev/blob/ab82887641d794d00d7d510e4f3d005c491adce3/dwds/test/fixtures/fakes.dart).

### Suggested improvements:

- [ ] separate directories for integration and unit tests
- [ ] switch from the fakes in `fakes.dart` to mocks generated by `package:mockito`
- [ ] move fakes from other test files into `fakes.dart` so that they can easily be found
- [ ] increase number of unit tests
- [ ] add documentation / general guidelines on writing and running tests

Contributor guide

Open the contributing guide

Research direction

Start by reviewing dwds/test/metadata_test.dart and dwds/test/fixtures/fakes.dart, then inspect how the existing chromedriver integration tests and unit tests are organized. Done means separating integration and unit tests, consolidating fakes, switching to package:mockito-generated mocks, adding unit tests, and documenting how to write and run them.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
testing
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.