10

I'm a member of Plutus Pioneer Program. I already know about the Plutus Playground and like it very much. However, clicking all the blockchain action scenarios each time is very time-consuming, especially that after changes in the source code the test scenario often gets wiped out.

It would be much better to have a framework to define and run unit tests, as well as not having to edit the code in the browser.

Although I'm new to Haskell, I'm pretty sure there is some unit test environment. Is it also possible to write scenarios in a file and put assertions on blockchain state, instead of clicking them in the Playground?

2 Answers 2

6

You can use the EmulatorTrace monad introduced in Lecture #4 for unit testing. You find examples of such tests in https://github.com/input-output-hk/plutus-apps/tree/main/plutus-use-cases/test/Spec .

1
  • 1
    Thanks Lars. Do you perhaps want to update the broken link. I found this answer while searching for a related question.
    – Avatar33
    Commented Feb 13, 2022 at 9:34
1

You can also use this https://github.com/mlabs-haskell/plutus-simple-model

I'd say it's better because it's more up to date than the plutus-apps repo needed (for Contract Monad) from IOG (a lot is missing from Vasil)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.