- Notifications
You must be signed in to change notification settings - Fork515
Introduce RowBuilder to support writing basic unit tests#979
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Introduce RowBuilder to support writing basic unit tests#979
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Added RowDescription trait, and let rows to share the same descriptionrather than having a copy in each row (think when there are thousand ofthem in the result).Added RowBuilder to support adding stubs of row data in unit tests.Currently, the library users have no chooice but have to use integrationtests for testing Postgres data access code. With the changes in thiscommit, the `tokio-postgres` lib users can use RowBuilder to createsutbs to verify the deserialization from database result (Rows) tocustom stucts in unit tests.It can also serves as a base for future implementation of certain kindof mocks of the db connection.Related-torust-postgres#910rust-postgres#950
f712d07
to07336e5
Comparephyllipecesar commentedMay 3, 2023
Hi@sfackler , I usually create a struct and implement Do you have any recommendation how to unit test conversions? |
deleted commentedAug 22, 2023
I, too, need something like this for unit testing. |
owlot commentedNov 8, 2023
I also need this, been watching the pr for a while, but seems like it's not going to be merged at all? |
deleted commentedNov 28, 2023
Nothing to add except that the ability to synthesize Rows / a RowStream in unit testing is still very important to me. Is this something we can expect to ever see in |
owlot commentedAug 13, 2024
@sfackler can you let us know if you're considering this PR at all or if we have to build around it some other way to be able to get our unit test coverage up. |
Added RowDescription trait, and let rows to share the same description rather than having a copy in each row (think when there are thousand of them in the result).
Added RowBuilder to support adding stubs of row data in unit tests.
Currently, the library users have no chooice but have to use integration tests for testing Postgres data access code. With the changes in this commit, the
tokio-postgres
lib users can use RowBuilder to create sutbs to verify the deserialization from database result (Rows) to custom stucts in unit tests.It can also serves as a base for future implementation of certain kind of mocks of the db connection.
Related-to#910#950