scalus.testing.integration

Members list

Type members

Classlikes

class BlockfrostTestContext(val cardanoInfo: CardanoInfo, val provider: BlockchainProvider, val parties: IndexedSeq[TestParty], val envName: String) extends IntegrationTestContext

Integration test context for real Cardano networks via Blockfrost.

Integration test context for real Cardano networks via Blockfrost.

Uses system time for slot calculation and Thread.sleep for time advancement. Real networks require longer wait times for transaction propagation.

Value parameters

cardanoInfo

Cardano network information

envName

Environment name ("Preprod" or "Mainnet")

parties

Available test parties (derived from wallet mnemonic)

provider

BlockfrostProvider connected to Preprod or Mainnet

Attributes

Supertypes
class Object
trait Matchable
class Any
class EmulatorTestContext(val cardanoInfo: CardanoInfo, val emulator: Emulator, val parties: IndexedSeq[TestParty], initialSlot: SlotNo = ...) extends IntegrationTestContext

Integration test context using the in-memory Emulator.

Integration test context using the in-memory Emulator.

Provides fast, deterministic testing with instant slot advancement.

Value parameters

cardanoInfo

Cardano network information

emulator

The in-memory Emulator instance

initialSlot

Starting slot number (default: 0)

parties

Available test parties

Attributes

Supertypes
class Object
trait Matchable
class Any
trait IntegrationTest extends BeforeAndAfterAll, ScalusTest

Base trait for multi-environment integration tests.

Base trait for multi-environment integration tests.

Override createTestContext() to provide a custom environment, or use the built-in factory methods.

Environment is selected via SCALUS_TEST_ENV:

  • "emulator" (default) - Fast in-memory testing
  • "yaci" - YaciDevKit Docker container
  • "preprod" - Blockfrost Preprod testnet
  • "mainnet" - Blockfrost Mainnet
  • Custom values can be handled by overriding createTestContext()

Example usage:

class MyIntegrationTest extends AnyFunSuite with IntegrationTest {
 test("my test") {
   val ctx = createTestContext()
   val utxos = ctx.provider.findUtxos(ctx.alice.address).await().toOption.get
   // ...
 }
}

Attributes

Supertypes
trait ScalusTest
trait Assertions
trait TripleEquals
trait TripleEqualsSupport
trait BeforeAndAfterAll
trait SuiteMixin
class Object
trait Matchable
class Any
Show all
Known subtypes
trait YaciDevKit
Self type
Suite

Unified test context for integration testing across different environments.

Unified test context for integration testing across different environments.

All time-dependent methods return Future for async compatibility. Use .await() extension from scalus.utils.await for synchronous test code.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
case class TestParty(party: Party, address: ShelleyAddress, addrKeyHash: AddrKeyHash, signer: TransactionSigner)

A test party with all information needed for transaction signing and submission.

A test party with all information needed for transaction signing and submission.

Value parameters

addrKeyHash

Payment key hash for script requirements

address

Shelley address for receiving funds

party

The Party enum value

signer

Transaction signer for signing transactions

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
class YaciTestContext(val cardanoInfo: CardanoInfo, val provider: BlockchainProvider, val parties: IndexedSeq[TestParty]) extends IntegrationTestContext

Integration test context for YaciDevKit.

Integration test context for YaciDevKit.

Uses system time for slot calculation and Thread.sleep for time advancement. YaciDevKit uses 1-second slots starting from zero time.

Access test parties via alice, bob, eve. For full HD account access (stake, drep, change keys), use Party.Alice.account directly.

Value parameters

cardanoInfo

Cardano network information

parties

Available test parties

provider

BlockfrostProvider connected to YaciDevKit

Attributes

Supertypes
class Object
trait Matchable
class Any