title_body: How can I write unit tests for Plutus contracts? 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?
upvoted_answer: 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/tree/master/plutus-use-cases/test/Spec .