Skip to content
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

Testing support #33

Open
spencewenski opened this issue Mar 30, 2024 · 10 comments
Open

Testing support #33

spencewenski opened this issue Mar 30, 2024 · 10 comments
Labels
enhancement New feature or request
Milestone

Comments

@spencewenski
Copy link
Member

  • Add support for testing (without needing to run the server?)
  • Add support for E2E testing support (e.g. Bruno, Hurl, etc)
@spencewenski spencewenski added the enhancement New feature or request label Mar 31, 2024
@spencewenski
Copy link
Member Author

@spencewenski spencewenski added this to the 0.2.x milestone May 27, 2024
@spencewenski spencewenski modified the milestones: 0.2.x, 0.3.x Jun 6, 2024
@spencewenski
Copy link
Member Author

The main thing we would need to add support for probably is cleaning up the db after tests.

What’s the best way to allow tests to be parallelized while also cleaning up the db between tests? Is there a way to track which tables are modified and/or which rows are added? Also, as a best practice, ids of rows added during tests should be random, so ideally if we’re able to track which ids are created by a test we can delete just those ids.

@spencewenski
Copy link
Member Author

It looks like seaorm also allows mocking the db, which may cover our use cases. It may also allow us to run tests without needing a running Postgres instance. Though, it still might be good to have some sanity tests against an actual pg instance, and maybe we would want to run all tests against an actual pg instance still. Tbd

@spencewenski
Copy link
Member Author

@spencewenski spencewenski modified the milestones: 0.3.x, 0.3 Jun 10, 2024
@spencewenski
Copy link
Member Author

Could we create something like rspec’s let that lazy inits db models and cleans them up when they’re dropped? Or does something like that exist already?

@spencewenski
Copy link
Member Author

Not related to the previous comment, this could be interesting: https://github.com/rust-rspec/rspec

looks like it hasn’t been updated in a while though. I wonder if it’s still maintained and/or if it’s considered done/stable.

@spencewenski
Copy link
Member Author

Also interesting: https://crates.io/crates/shoulda

@spencewenski
Copy link
Member Author

spencewenski commented Jun 15, 2024

Factoybot for rust: https://crates.io/crates/factori

I’m not sure I love the ergonomics of this, but if the mixin fields have typechecking/autocomplete, then it could be interesting

@spencewenski
Copy link
Member Author

Can we allow using in-memory SQLite for tests? We’d probably want to provide a way to switch between SQLite and a real db on a per test or per group basis somehow

@spencewenski spencewenski modified the milestones: 0.3.x, 0.5.x Jul 2, 2024
@spencewenski
Copy link
Member Author

Some testing utilities (mainly related to using insta and rstest) were added in #277

@spencewenski spencewenski modified the milestones: 0.5.x, 0.6.x Aug 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant