Skip to content
Snippets Groups Projects
Commit 0075b297 authored by Fedor Telnov's avatar Fedor Telnov
Browse files

feat: reexport tarantool::test and add an explanation to readme

parent bd01225d
No related branches found
No related tags found
1 merge request!1feat: implement test utility with docs and int tests
Pipeline #20921 failed
......@@ -53,7 +53,7 @@ Now you want to use `tarantool-test` with your own crate. Following steps will u
crate-type = ["lib", "cdylib"]
```
3. Mark desired tests with `#[tarantool::test]` attribute macro. This would allow `tarantool-test` to collect and run them;
3. Mark desired tests with `#[tarantool_test::test]` attribute macro. This would allow `tarantool-test` to collect and run them;
4. Bind test suite you want to use by using `bind_test_suite` macro - add this line to `lib.rs`: `tarantool_test::bind_test_suite!()`
5. Build your crate: `cargo build -p example`. Check `./target/debug` directory to find out the actual path of shared object you've built. It would be named something like `libexample.so` for Linux or `libexample.dylib` for Macos.
6. Launch your tests by running: `tarantool-test -p ./debug/tarantool/libexample.so`. Tests would be executed, and you are done! No need to cleanup anything.
......@@ -130,7 +130,8 @@ However, there are limitations: you can't override `-p` and `-e` arguments and o
`tarantool-test` is backed by [tarantool-runner](https://git.picodata.io/picodata/picodata/tarantool-runner). It executes test setup in the provided by runner tarantool environment, so anything related to `tarantool-runner` is applicable here.
*NOTE*: you don't need to install `tarantool-runner` yourself - it is builtin.
Another important dependency is [tarantool-module](https://git.picodata.io/picodata/picodata/tarantool-module). You must mark needed tests with `tarantool::test` attribute macro in order to allow `tarantool-test` to discover them.
Currently, `tarantool-test` highly depends on the [tarantool-module](https://git.picodata.io/picodata/picodata/tarantool-module). Namely, `tarantool_test::test` macro is just a reexport of `tarantool::test`, which might change in the future.
Despite the fact that marking tests with `tarantool::test` would also work, it is **discouraged**, as `tarantool_test::test` would someday be separated to include special features.
What `tarantool-test` does: whenever you use `bind_tarantool_test!` macro, it generates tarantool procedure with needed entrypoint name. Newly created entrypoint deserializes input and launches tests with specified test suite.
......
......@@ -44,12 +44,12 @@ impl TestSuite for AlternativeTestSuite {
}
}
#[tarantool::test]
#[tarantool_test::test]
fn test_example() {
println!("test example is executed")
}
#[tarantool::test(should_panic)]
#[tarantool_test::test(should_panic)]
fn test_panic_example() {
assert_eq!(1, 0)
}
......
......@@ -5,6 +5,7 @@ use tester::{TestDescAndFn, TestFn, TestOpts};
use anyhow::bail;
pub use tarantool::proc as test_entrypoint;
pub use tarantool::test as test;
pub const DEFAULT_TEST_ENTRYPOINT_NAME: &str = "default_test_entrypoint";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment