Crate soroban_test

Source
Expand description

Soroban Test - Test framework for invoking Soroban externally.

Currently soroban provides a mock test environment for writing unit tets.

However, it does not provide a way to run tests against a local sandbox or rpc endpoint.

§Overview

  • TestEnv is a test environment for running tests isolated from each other.
  • TestEnv::with_default invokes a closure, which is passed a reference to a random TestEnv.
  • TestEnv::new_assert_cmd creates an assert_cmd::Command for a given subcommand and sets the current directory to be the same as TestEnv.
  • TestEnv::cmd is a generic function which parses a command from a string. Note, however, that it uses shlex to tokenize the string. This can cause issues for commands which contain strings with "s. For example, {"hello": "world"} becomes {hello:world}. For that reason it’s recommended to use TestEnv::cmd_arr instead.
  • TestEnv::cmd_arr is a generic function which takes an array of &str which is passed directly to clap. This is the preferred way since it ensures no string parsing footguns.
  • TestEnv::invoke a convenience function for using the invoke command.

Structs§

TestEnv
A TestEnv is a contained process for a specific test, with its own ENV and its own TempDir where it will save test-specific configuration.

Enums§

Error
Wasm

Constants§

LOCAL_NETWORK_PASSPHRASE
TEST_ACCOUNT

Traits§

AssertExt
CommandExt

Functions§

temp_ledger_file