🚨 configlet sync --test found unsynced tests
Checking exercises...
[warn] satellite: missing 3 test cases
- A degenerate binary tree (af31ae02-7e5b-4452-a990-bccb3fca9148)
- Another degenerate binary tree (ee54463d-a719-4aae-ade4-190d30ce7320)
- Tree with many more items (87123c08-c155-4486-90a4-e2f75b0f3e8f)
[warn] some exercises are missing test cases
This is a recurring task that has to be done from time to time.
Do not reference this issue by writing resolves/fixes #XXX in your PR because that will close it.
We want to keep the track up to date with problem specifications, which means regularly checking if anything changes and needs updating.
How to do this task:
Step 1: fetch configlet
If you're on Linux or a Bash environment, run:
./bin/fetch-configlet
Alternatively, you can download for Windows or MacOS from the releases.
Step 2: Update tests for an exercise
The general goal is that all Java practice exercises follow problem specifications, except for when it doesn't make any sense in Java.
Important:
Get familiar with the problem specifications repository and the canonical-data.json format it uses for describing tests cases. Read CONTRIBUTING.md for the general rules of this repository. Please create separate a PR per exercise when changing tests.
Step 2.1 Update tests.toml
Update tests.toml by running this command for a chosen exercise:
./bin/configlet sync --exercise <exercise-slug> --tests --update
This command assumes that we want to implement all the new tests, and that is our default approach, but it still needs verifying on a test-by-test base. Beware that some new tests may replace an existing one. Typically, these will have a reimplements key.
Step 2.2 Analyze the new test cases and update the Java tests files accordingly
Find all the test cases affected by the previous step in the exercise's canonical-data.json file in the problem specifications repository. Analyze what the changes actually are.
You might need to delete a test. You might need to add a new test. You might also need to replace an existing test with a new one (you'll see in tests.toml that it "reimplements" another).
Some exercises don't even have a tests.toml file yet. In this case, carefully check which tests from the canonical-data.json are already implemented and make sure the generated tests.toml file reflects this.
If you believe a new test case shouldn't be implemented, mark it as such in tests.toml. For example:
[1e22cceb-c5e4-4562-9afe-aef07ad1eaf4]
description = "some test that will not be implemented for this track"
include = false
comment = "Not included because <reason>"
When editing the Java tests, make sure to:
Follow the coding style used in the existing test file.
Use the test description from the tests.toml file as name of the test method (unless that would invalidate the first rule).
Keep the order of the tests in the Java test file the same as they are in the tests.toml file (unless that would invalidate the first rule).
Step 2.3 Check that the example solution works with new test cases
After modifying the Java tests, run this command from the exercises directory to run them:
./gradlew practice:<exercise-slug>:test
If it fails, double-check if the new tests are correct. If they are, that means our example solution for this exercise is no longer valid for the new tests and needs to be updated!
When adding a completely new function that students need to implement, or when changing the return types of an existing one, make sure to also update the stub file.
Step 2.4 Remove deprecated files
Previously the version of each practice exercise was tracked through a .meta/version file. This is no longer being used, so please delete it after syncing an exercise with the problem-specifications.
Resources
Need help?
Configlet docs General track docs Don't hesitate to ask here in case you can't find answers to your questions!
@kahgoh and @jagdish-15 is it possible to relaunch the configlet and see if everything had been fixed here?
You can always run the command locally! Just use bin/configlet sync --tests (or .\bin\configlet sync --tests on Windows)
great, thanks. I will try.
Edit: good for me: