Skip to content
This repository has been archived by the owner on May 2, 2022. It is now read-only.

Contract on-chain testing templates #73

Open
Robbepop opened this issue Mar 16, 2021 · 0 comments
Open

Contract on-chain testing templates #73

Robbepop opened this issue Mar 16, 2021 · 0 comments
Assignees

Comments

@Robbepop
Copy link

Currently defining on-chain smart contract tests is hard and best done by programming some custom solution yourself for your own smart contract. It is currently not possible to define on-chain smart contract tests in ink! or any other Substrate based language that I am aware of. The possibility of defining off-chain unit tests in ink! unfortunately is not applicable to on-chain testing.

I began to wonder if it actually makes sense to provide capabilities for defining on-chain smart contract tests in ink! or any other language itself. Instead what probably makes more sense is to program a tool with which a user can easily describe the flow of an on-chain test by imperative or declarative means using a UI that was primarily designed for the task.

I imagine this to be part of the Canvas UI where you can define on-chain tests for your uploaded and managed smart contracts. It should also be possible to serialize those tests to some common format such as JSON. The test definition should happen in some DSL that was specifically designed to facilitate on-chain testing for Substate based smart contracts. The DSL is fed with the contract's very own metadata so that the Canvas UI can easily display actions to call certain contract messages or instantiate using specific constructors with proper arguments. Also it must be possible to interact with the chain directly, e.g. set/get balances. When calling a contract it is also important with regards to testing from which account calling happens. The big advantage of on-chain testing is that it should be possible to test a multitude of smart contracts and their interactions with each other. This is what is not possible with off-chain testing today. Also chain interaction must somehow provide a way to call chain specific extensions - maybe this might be better suited for a future add-on task.

This issue tracks progress of this feature.
@erler We also need a proper design for this.
@statictype Volunteered to spearhead this task initially.

@statictype statictype self-assigned this Apr 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants