Skip to content

Presentation how to test super app

Miao, ZhiCheng edited this page Aug 2, 2023 · 6 revisions

How to Test Your Super App

⚠ This file is automatically generated from this org file using this script.

The exported presentation can be accessed via this githack link.

REVISIONS:

Date Notes
2022-07-05 Reactor Workshop

Testing Mindset

Eat Your Vegetables

  • Having higher confidence of things you built is rewarding.
  • Anchoring your confidence in objective metrics is convincing.
  • LoC of your testsuite, and test coverage percentages are good metrics.

Testing Is Productivity

Testsuite is your spec

  • positive/happy cases
  • negative cases (ownable/access control, bad inputs, etc.)
  • non-functional cases (gas requirement e.g.)

Let testsuite help you

  1. Early detection regression by frequently testing your code.
  2. Don’t let untested changes pile up.
  3. Try to create a test case for new bug discovered.

No dogma: TIMTOWTDI

  1. Always have an end to end testsuite for your quick and dirty project.
  2. Use test coverage to guide you what needs to be tested more.
  3. If time allows, do these:
    • Unit tests are guided missiles.
    • Fuzzing is carpet bombings.

Security is Still About Testing

  • Consider security as non-functional requirements.
  • Different types of these requirements use different tooling for testing.

External dependencies

Complex state machines

  • Use Echidna/hot-fuzz to discover hidden sequences.

Game theoratical/economics attacks

  • Agent modeling and simulation.

Language and Virtual Machine Specifics

  • Learn idomatic solidity programming styles: https://docs.openzeppelin.com/
  • EVM expert knowledge.

How Superfluid Protocol is Tested

Tooling (Demo)

Truffle/Hardhat

  • Full coverage of functional requirements
  • Development trick: test focus it.only
  • Examine code coverage

Foundry

  • Fuzzing for better unit testing

HotFuzz

  • Protocol-level invariances and randomized sequences

How Super App Can Be Tested

Truffle/Hardhat vs Foundry

  • Foundry Pros: faster feedback loop, native fuzzing support.
  • Foundry Cons: no dapp-side code sharing, lacking mature test-tooling support.
  • Truffle/Hardhat Pros: typescript/javascript lower learning curve, similar dapp-side code
  • Truffle/Hardhat Cons: much slower, no native fuzzing support.

Try hot-fuzz

Demo

Further Readings

Clone this wiki locally