-
Notifications
You must be signed in to change notification settings - Fork 157
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
Review the unit test approach #226
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For each aspect that is tested by the validator, I created a tileset JSON file that was supposed to cause that exact issue. The result is a set of serveral hundred JSON files in the
specs/data
directory, for tilesets, metadata, and subtrees.The current approach of most of the unit tests (e.g. in
TilesetValidatorSpec
) is to read each of these files, and check whether the validator generates the expected issue.For some tests, it would probably make more sense to not read the data from a file, but to perform the validation call on an object that is directly declared in the test code itself. But having the set of files (that can easily be checked individually, at the command line) turned out to be useful occasionally, even though it may be considered to be more of an "integration test" than a "unit test".
I also considered the option to summarize these test cases in their own JSON file, roughly like in
This could simplify testing in some ways, and allow documenting the test via the
description
. But it might turn out to be an unnecessary maintenance burden.If somebody has preferences, thoughts, or alternative approaches, feel free to discuss them here.
The text was updated successfully, but these errors were encountered: