4

Hi I am developing a runtime using Substrate-FRAME and I would like to know how can I write a system test for my runtime?

The main purpose of writing a system test is to ensure that the final build is fulfilling all of the required specifications and also to ensure nothing is compromised on a runtime upgrade. The idea for me is something similar to point no. 2 mentioned in this thread.

Any documentation regarding this type of tests would be greatly helpful.

Update:

I ended up using py-substrate-interface to make test scenarios. Now I can automatically deploy nodes to form a network (thanks to Python) and run my custom system test scenarios. Very useful tool for developing runtimes in Substrate.

Jdawg287
  • 117
  • 5

1 Answers1

2

There is an overview here on the DevHub

And there are examples throughout substrate that include tests.rs and mock.rs files to use as reference.

If you have not already, checkout the create a pallet tutorial and the recipes all have some tasty examples to look at for these as well.

Nuke
  • 1,032
  • 7
  • 13
  • 1
    Thank you for your response @NukeManDan. But it seems that the tests you are referring to (`mock.rs` and `tests.rs`) look like unit/integration tests. I was referring to something more like system test suite which checks the expected behavior of a runtime. – Jdawg287 Apr 02 '21 at 08:03
  • 1
    There are a few tools in https://github.com/substrate-developer-hub/awesome-substrate that might be of interest, but I am not aware of any specific full testing suite available for generic substrate chains. The allowed customizations on your runtime are _near infinite_ , so I wouldn't expect such a tool without needing heavy customizations needed anyhow. – Nuke Apr 02 '21 at 17:29
  • 2
    `node/executor/tests` is probably the closest to what you want, from the included [node in substrate](https://github.com/paritytech/substrate/tree/master/bin/node/executor/tests) – Nuke Apr 02 '21 at 18:41
  • OK I see why it is difficult to have a full testing suite for substrate based chains. I'll look into `node/executor/tests` and try to come up with something. Thanks a lot I'll mark this as answered. – Jdawg287 Apr 05 '21 at 02:17