xtp-test
A Rust test framework for xtp / Extism plugins.
Example
use *;
use xtp_test;
// You _must_ export a single `test` function for the runner to execute.
use *;
use xtp_test;
API Docs
Please see the docs.rs documentation page for
full details.
Usage
1. Create a Rust project using the XTP Test crate
# ensure you have `crate-type = ["cdylib"]` in your `[lib]` section of Cargo.toml
2. Write your test in Rust
use *;
use xtp_test;
// You _must_ export a single `test` function for the runner to execute.
3. Compile your test to .wasm:
Ensure you have the wasm32-unknown-unknown and/or wasm32-wasi targets
installed via rustup, and run:
4. Run the test against your plugin: Once you have your test code as a
.wasm module, you can run the test against your plugin using the xtp CLI:
Install xtp
|
Run the test suite
# ^^^^^^^^^^^^^^^ ^^^^^^^^^ ^^^^^^^^^
# your plugin(s) test to run optional mock host functions
Note: The optional mock host functions must be implemented as Extism plugins, whose exported functions match the host function signature imported by the plugins being tested.
Need Help?
Please reach out via the
#xtp channel on Discord.