You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 2, 2022. It is now read-only.
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: