Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Go-Gno testing framework #1720

Open
leohhhn opened this issue Mar 1, 2024 · 1 comment
Open

[RFC] Go-Gno testing framework #1720

leohhhn opened this issue Mar 1, 2024 · 1 comment
Labels

Comments

@leohhhn
Copy link
Contributor

leohhhn commented Mar 1, 2024

Description

This issue is designed to discuss an all-in-one Go testing framework for Gno. The idea came to me while I was writing a refactor of the gnoblog-cli, a Go tool that parses README files and uploads them to a Gno chain.

The issue I came across was the following: how can I write a fully local integration test, which will allow me to talk to a real Gno node, deploy Gno code on it as part of setting up the testing environment, run functions on the packages & realms deployed, and assert expected results?

This framework would need to expose a certain API that would allow the developer to:

  • Run an in memory node
  • Programmatically deploy local code to the node
  • Programmatically modify the execution context of GnoVM in the node, ie block height, the OrigSend value, caller address, etc
  • Possibly expose more helpers, such as impersonating keypairs during tests, etc. Specifically, the realm that I was trying to test has a hardcoded address in which the aforementioned helper would be useful.
  • Possibly load the examples folder remotely somehow.

One of the Ethereum development frameworks, Hardhat, does basically this, but for the EVM & JS/TS.

After talking with @deelawn I believe that currently what I am trying to do is not possible with txtar, as txtar cannot run arbitrary CLI commands (ie the binary of gnoblog-cli), and some workarounds have been suggested but are still just workarounds.

This can be a critically useful effort for improving the UX of testing Gno code - and I believe this functionality can be packaged into a single library that would expose all of the needed things. Possibly we can use the in memory node + gnoclient to achieve this.

I'm looking for comments on whether or not people think this is useful, possible, and achievable in the near future.

Copy link

This issue is stale because it has been open 6 months with no activity. Remove stale label or comment or this will be closed in 3 months.

@github-actions github-actions bot added the Stale label Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

1 participant