rust - Are the built-in integration tests run concurrently or sequentially? -


i writing integration tests work database. in start of each test, clear storage , create data.

i want tests run sequentially ensure working empty database. seems integration tests run concurrently because existing documents after cleaning database.

i checked database , found documents created in different tests have approximately same creation time, when i'm adding delay each test (with std::thread::sleep_ms(10000)).

can clarify how integration tests run , possible run them in order?

the built-in testing framework runs concurrently default. designed offer useful simple support testing, covers many needs, , lot of functionality can/should tested each test independent of others. (being independent means can run in parallel.)

that said, listen rust_test_threads environment variable, e.g. rust_test_threads=1 cargo test run tests on single thread. however, if want functionality tests always, may interested in not using #[test], or, @ least, not directly.

the flexible way via cargo's support tests define own framework, via following in cargo.toml:

[[test]] name = "foo" harness = false 

with that, cargo test compile , run tests/foo.rs binary. can ensure operations sequenced/reset appropriately.

alternatively, maybe framework stainless has functionality need. (i've not used i'm not sure.)


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -