Tutorial on end-to-end testing of transferFrom user flow
init
command from the main folder of your Foundry or Hardhat project to create the state-space.toml
config file.workbench.new
property to automatically create a Workbench project upon submission. Your settings should like this:My Contract
Workbench project we just uploaded.Expand the folder tree to view your code as visual interactive components.Each component represents an externally visible function, with the following identifiers:Blue = CALL
- function callVIEW
- view functionCREATE
- constructorDEPLOY
- deployment scripttransferFrom(...)
flow using the following sequence of transactions:Deployment
→ constructor(...)
→ approve(...)
→ transferFrom(...)
Empty Deployment
component to the canvas and rename it to “ERC20 Deployment”.
Claire
(keeping Alice
and Bob
). You can add more EOA accounts by selecting the +
icon from inside the node.
constructor
, approve
, and transferFrom
function calls onto the canvas and connect them in sequence, mimicing the end-to-end user flow.transferFrom workflow
Alice
deploys the contractAlice
approves Bob
as the _spender
Bob
calls transferFrom(...)
transferFrom workflow with symbolic and concrete parameters
source
tab.Feel free to experiement with different parameter settings and sequences to analyze behavior and maximize coverage.Bob
approves Aice
to spend an allowance of uint MAX
tokens, ANDAlice
successfully transfers 1 token from Bob's
account.Successful transaction
umax
spending allowance:Reverted transaction
Test case state analysis
History
tab.Export Test Case to Foundry or Hardhat