Skip to content

Implement record/replay testing #299

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 4 commits into from
Jan 26, 2020
Merged

Implement record/replay testing #299

merged 4 commits into from
Jan 26, 2020

Conversation

kyleconroy
Copy link
Collaborator

Nelson Elhage wrote a fantastic blog post about Record/Replay testing in Sorbert, a type-checker for Ruby programs. The post details their testing setup which involves testing the compile as a black box. Run it against a set of inputs and compare the output to a known set of expected outputs.

We already do this to make sure that the examples directory is up to date. I've updated the end-to-end package to make these types of tests easy to write. I also ported gen_test over to the new framework.

The biggest improvement is that the tests and command-line tool now call into the same function, cmd.Generate. This ensures that we're testing exactly what is being called by the sqlc binary.

The existing tests in `gen_test` were unit tests that tested internal
APIs. Port these tests to integration tests, encompassing an entire run
of sqlc itself.
@kyleconroy kyleconroy merged commit f2ad76c into master Jan 26, 2020
@kyleconroy kyleconroy deleted the record-replay branch January 26, 2020 01:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant