concept for testing #33

Open
opened 2025-09-09 04:42:41 +00:00 by Ghost · 1 comment
Ghost commented 2025-09-09 04:42:41 +00:00 (Migrated from code.ole.blue)

Summary

Write some rust tests to verify application behaviour.

Scope (IMHO)

  • mostly testing against the api / backend logic is sensible.
  • Trait implementations should also be tested (i.e. formatting)
  • make test cases that should fail and test cases that should pass (watch for errors)

TODOS

  1. create subissues for each test that should be added
  2. check if no testcase was missed.
  3. prioritize testcases through priority labels
  4. add test coverage report
  5. add test coverage report to CI + README
  6. implement tests
# Summary Write some rust tests to verify application behaviour. # Scope (IMHO) - mostly testing against the api / backend logic is sensible. - Trait implementations should also be tested (i.e. formatting) - make test cases that should fail and test cases that should pass (watch for errors) # TODOS 1. create subissues for each test that should be added 1. check if no testcase was missed. 1. prioritize testcases through priority labels 1. add test coverage report 1. add test coverage report to CI + README 1. implement tests
Ghost commented 2025-11-11 22:51:59 +00:00 (Migrated from code.ole.blue)

Frontend tests

We probably want to use wasm-bindgen-test (more docs) so we can write fancy tests like these:

But we need to re-write the components, so they don't request data themselves, but instead receive it from the parent component.
Or we can make it take in an optional signal, which we use when testing, but the components still fetch the data themselves while not testing, since something like ShowUser has to request data, because it's essentially a root node.

Backend tests

Testing the backend is gonna be interesting. Since just using #[test] doesn't work with server functions / SSR. So maybe e2e it is?

# Frontend tests We probably want to use [wasm-bindgen-test](https://crates.io/crates/wasm-bindgen-test) ([more docs](https://wasm-bindgen.github.io/wasm-bindgen/wasm-bindgen-test/usage.html)) so we can write fancy tests like these: - https://github.com/leptos-rs/leptos/blob/main/examples/counter/tests/web.rs But we need to re-write the components, so they don't request data themselves, but instead receive it from the parent component. Or we can make it take in an optional signal, which we use when testing, but the components still fetch the data themselves while not testing, since something like `ShowUser` has to request data, because it's essentially a root node. # Backend tests Testing the backend is gonna be interesting. Since just using `#[test]` doesn't work with server functions / SSR. So maybe e2e it is?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Strichliste/strichliste#33
No description provided.