Add infra for SGF/GIB snapshot tests#131
Conversation
|
Looks nice. I like the idea of utility tool to generate a snapshot of sgf file in a less troublesome and more readable format like json, and then comparing the parsed moves from sgf to it, but... if we regenerate those snapshots and they both (snapshot generator and tests) use the same GameRecord.fromSgf then it won't detect issues with move integrity, i.e. if GameRecord.fromSgf has an issue for missing first move then the json snapshot won't contain the first move either. So snapshots have to be manually checked (once) anyway. I'm assuming this util doesn't run and regenerate snapshots on a build/test/run commands? only on "run test/game_record_snapshot_tests/generate_snapshots.dart"? I'm still pretty new to dart/flutter 🙂 |
Right, the expectation is that
IMO snapshot tests are useful as a gut check to ensure something doesn't change unexpectedly. They aren't as good figuring out your impl meets functional requirements in the first place (traditional unit tests and manual testing are a better tool)
Correct. |
There's some relevant discussion on #112 and #101, but I think there would be some benefit to snapshot tests for the file parsers. These scripts make it simple to add a file from one of the servers and commit its
GameRecordrepresentation.This PR adds:
generate_snapshots.dart: used when adding new snapshots or updating the behavior of the parsersgame_record_snapshot_test.dart: snapshot tests that parse the files and compare to existing snapshotsThe README has more detail on what's here and how to re-generate snapshot tests.