Closed tbicr closed 1 month ago
I wrote integration tests that run queries in database and I want to isolate this test's queries.
Case name looks good option for me to achieve isolation and visibility, now I duplicate case name in parameter:
#[rstest] #[case::standard("standard", "")] #[case::concurrent("concurrent", " CONCURRENTLY")] fn test(#[case] case: &str, #[case] suffix: &str) { // CREATE TABLE test_{case} (...) }
In general it works fine except situation when cases copy-pasted a lot and it require both places fix to avoid isolation issues.
Option when I can use case name as case parameter looks good improvement for my workflow:
#[rstest] #[case::standard("")] #[case::concurrent(" CONCURRENTLY")] fn test(#[case_name] case: &str, #[case] suffix: &str) { // CREATE TABLE test_{case} (...) }
I wonder if rstest has something similar or you can suggest how it can be implemented best way?
You can use something like in #177 . Anyway I would find some time to implement the #[context] attribute.
#[context]
This works perfectly, thanks.
I wrote integration tests that run queries in database and I want to isolate this test's queries.
Case name looks good option for me to achieve isolation and visibility, now I duplicate case name in parameter:
In general it works fine except situation when cases copy-pasted a lot and it require both places fix to avoid isolation issues.
Option when I can use case name as case parameter looks good improvement for my workflow:
I wonder if rstest has something similar or you can suggest how it can be implemented best way?