Makes testing of REAPER extension plugins easy.
This integration test suite was originally written by Benjamin Klum benjamin.klum@helgoboss.org for reaper-rs
. But it was dependent on the reaper-high
crate, which was not and would not be soon published. And, also, it was deeply integrated into the library.
This version incapsulates as much as possible, leaving simple interface to making tests.
For testing reaper extension, which itself is of type cdylib
,
you need transform the project folder to workspace. So, basically,
project tree would look similar to this:
bash
workspace_directory
├── Cargo.toml
├── README.md
├—— my_lib
├ ├—— src
│ └── lib.rs
└── test
├── Cargo.toml
├── src
│ └── lib.rs
└── tests
└── integration_test.rs
test
crate will not be delivered to the end-user, but will be used for
testing your library. Since there is a need for patching of reaper-low and reaper-medium, contents of test/Cargo.toml
:
```toml [package] edition = "2021" name = "reaper-test-extension-plugin" publish = false version = "0.1.0"
[dependencies] reaper-low = "0.1.0" reaper-macros = "0.1.0" reaper-medium = "0.1.0" reaper-test = "0.1.0" mylib = {path = "../mylib"}
[patch.crates-io] reaper-low = {git = "https://github.com/Levitanus/reaper-rs", branch = "stableforrea-rs"} reaper-macros = {git = "https://github.com/Levitanus/reaper-rs", branch = "stableforrea-rs"} reaper-medium = {git = "https://github.com/Levitanus/reaper-rs", branch = "stableforrea-rs"} reaper-test = {git = "https://github.com/Levitanus/reaper-test"}
[lib] crate-type = ["cdylib"] name = "reapertestextension_plugin"
```
contents of test/tests/integration_test.rs
:
```rust use reapertest::{runintegration_test, ReaperVersion};
fn main() { runintegrationtest(ReaperVersion::latest()); } ```
test/src/lib.rs
is the file your integration tests are placed in.
```rust use reapermacros::reaperextensionplugin; use reapertest::*; use std::error::Error; fn helloworld(reaper: &ReaperTest) -> TestStepResult { reaper.medium().showconsole_msg("Hello world!"); Ok(()) }
fn testextension(context: PluginContext) -> Result<(), Box
to run integration tests, go to the test folder and type:
cargo build --workspace; cargo test
Use crates log
and env_logger
for ptinting to stdio. integration test turns env logger on by itself.