canton-daml-testing
Installation
SKILL.md
Canton Daml Testing
Overview
Daml Script is the main tool for testing Daml contracts: you submit commands and queries as multiple parties against a fresh, initially-empty, in-process ledger. It's fast and deterministic — ideal for unit-testing authorization rules, choice behavior, and multi-party workflows.
Writing a script
test_transfer : Script ()
test_transfer = do
alice <- allocateParty "Alice"
bob <- allocateParty "Bob"
-- create + exercise as a party (note the *Cmd variants on the client side)
cid <- submit alice (createCmd Token with owner = alice)
newCid <- submit alice (exerciseCmd cid Transfer with newOwner = bob)
-- assert an unauthorized action fails
submitMustFail bob (exerciseCmd newCid Transfer with newOwner = alice)