{"id":28545639,"url":"https://github.com/fluencelabs/marine-rs-sdk-test","last_synced_at":"2025-07-09T16:37:58.719Z","repository":{"id":38191275,"uuid":"414220593","full_name":"fluencelabs/marine-rs-sdk-test","owner":"fluencelabs","description":"SDK for testing apps built with marine-rs-sdk","archived":false,"fork":false,"pushed_at":"2024-09-04T18:54:37.000Z","size":856,"stargazers_count":5,"open_issues_count":10,"forks_count":1,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-06-09T23:08:38.314Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fluencelabs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-10-06T13:21:14.000Z","updated_at":"2024-09-04T18:48:38.000Z","dependencies_parsed_at":"2023-12-16T00:49:29.098Z","dependency_job_id":"9106829a-2527-40be-b711-8399f6dc2d03","html_url":"https://github.com/fluencelabs/marine-rs-sdk-test","commit_stats":{"total_commits":389,"total_committers":9,"mean_commits":43.22222222222222,"dds":0.2724935732647815,"last_synced_commit":"f5ed6bfd520380a60952423134b66f1fc1560242"},"previous_names":[],"tags_count":39,"template":false,"template_full_name":null,"purl":"pkg:github/fluencelabs/marine-rs-sdk-test","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluencelabs%2Fmarine-rs-sdk-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluencelabs%2Fmarine-rs-sdk-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluencelabs%2Fmarine-rs-sdk-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluencelabs%2Fmarine-rs-sdk-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fluencelabs","download_url":"https://codeload.github.com/fluencelabs/marine-rs-sdk-test/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluencelabs%2Fmarine-rs-sdk-test/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264019133,"owners_count":23545069,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-09T23:08:16.608Z","updated_at":"2025-07-09T16:37:58.658Z","avatar_url":"https://github.com/fluencelabs.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Marine Test Rust SDK\n[![crates.io version](https://img.shields.io/crates/v/marine-rs-sdk-test?color=green)](https://crates.io/crates/marine-rs-sdk-test)\n\nThis SDK aims to help developers targeting [Marine](https://github.com/fluencelabs/marine) to test their Wasm modules and services because `cargo test` can't run such modules, but it's necessary for testing. To avoid that limitation, the SDK introduces the `#[marine_test]` macro that does much of the heavy lifting to allow developers to use `cargo test` as intended. That is, the `#[marine_test]` macro generates the necessary code to call Marine, one instance per test function, based on the Wasm module and associated configuration file so that the actual test function is run against the Wasm module, not the native code.\n\n\n## Usage\n\nThe core component of the SDK is the `#[marine_test]` macro that can wrap a test function, providing an experience similar to \"vanilla\" Rust. A wrapped function should receive a special object representing a module interface, let's see an example:\n```rust\nuse marine_rs_sdk::marine;\n\npub fn main() {}\n\n#[marine]\npub fn greeting(name: String) -\u003e String {\n    format!(\"Hi, {}\", name)\n}\n\n#[cfg(test)]\nmod tests {\n    use marine_rs_sdk_test::marine_test;\n\n    #[marine_test(config_path = \"../Config.toml\", modules_dir = \"../artifacts\")]\n    fn test(greeting: marine_test_env::greeting::ModuleInterface) {\n        let actual = greeting.greeting(\"John\".to_string());\n        assert_eq!(actual, \"Hi, John\");\n    }\n}\n```\nThis example shows a simple [module](https://fluence.dev/docs/marine-book/quick-start/develop-a-single-module-service) with one export function `greeting` and a test. The test function is wrapped with the `#[marine_test]` macro, which specifies a path to the config file (`Config.toml`) and the directory containing the Wasm module we obtained after compiling the project with the [marine CLI](https://fluence.dev/docs/marine-book/marine-tooling-reference/marine-cli) build command. This macro generates the necessary glue code to instantiate Marine instance under the hood and call the greeting module loaded into it.\n\nAfter we have our Wasm module and tests in place, we can proceed with `cargo test`.\n\nIn a setup without the Marine test suite, the `greeting` function will be compiled to native and then test natively, comparingly with the suite it will be compiled to Wasm, loaded into Marine, and only then called as a Wasm module.\n\nMore details can be found in [this chapter](https://fluence.dev/docs/marine-book/marine-rust-sdk/testing-and-debugging/) of the Marine book.\n\n\n## Documentation\n\n- [Marine Book](https://fluence.dev/docs/marine-book/introduction)\n- [Marine Examples](https://github.com/fluencelabs/examples/tree/main/marine-examples)\n- [Quickstart](https://fluence.dev/docs/marine-book/quick-start/)\n\n\n## Repository structure\n\n- **[crates](./crates)**\n    - [macro-build-rs-generator](./crates/macro-build-rs-generator) - generator of `build.rs` file intended to provide IDE support for generated glue code\n    - [marine-test-macro-impl](./crates/marine-test-macro-impl) - actual implementation of the `#[marine_test]` macro\n    - [marine-test-macro](./crates/marine-test-macro) - proc-macro crate for the `#[marine_test]` macro\n- **[src](./src)** - reexports all necessary things intended to use by end user\n\n\n## Support\n\nPlease, [file an issue](https://github.com/fluencelabs/marine-rs-sdk-test/issues) if you find a bug. You can also contact us at [Discord](https://discord.com/invite/5qSnPZKh7u) or [Telegram](https://t.me/fluence_project). We will do our best to resolve the issue ASAP.\n\n\n## Contributing\n\nAny interested person is welcome to contribute to the project. Please, make sure you read and follow some basic [rules](./CONTRIBUTING.md).\n\n\n## License\n\nAll software code is copyright (c) Fluence Labs, Inc. under the [AGPL v3](./LICENSE) license.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluencelabs%2Fmarine-rs-sdk-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffluencelabs%2Fmarine-rs-sdk-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluencelabs%2Fmarine-rs-sdk-test/lists"}