-
Notifications
You must be signed in to change notification settings - Fork 54
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
testing intro #410
testing intro #410
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Co-authored-by: j pimmel <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lookin good! just a few nits and suggestions
|
||
# Introduction to Testing in Cadence | ||
|
||
Testing is an essential part of smart contract development to ensure the correctness and reliability of your code. In Cadence, the testing framework provides a convenient way to write tests for Cadence programs, allowing you to verify the functionality of your smart contracts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing is an essential part of smart contract development to ensure the correctness and reliability of your code. In Cadence, the testing framework provides a convenient way to write tests for Cadence programs, allowing you to verify the functionality of your smart contracts. | |
Testing is an essential part of smart contract development to ensure the correctness and reliability of your code. Cadence Testing Framework provides a convenient way to write tests for your programs, allowing you to verify the functionality and correctness of your smart contracts. |
|
||
## Install Flow CLI | ||
|
||
The [Flow CLI](../../../tools/flow-cli/index.md) is the primary tool for developing, testing, and deploying smart contracts written in Cadence to the Flow network. You can install the Flow CLI by following the [installation instructions](../../../tools/flow-cli/install.md) provided by the Flow documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The [Flow CLI](../../../tools/flow-cli/index.md) is the primary tool for developing, testing, and deploying smart contracts written in Cadence to the Flow network. You can install the Flow CLI by following the [installation instructions](../../../tools/flow-cli/install.md) provided by the Flow documentation. | |
The [Flow CLI](../../../tools/flow-cli/index.md) is the primary tool for developing, testing, and deploying smart contracts to the Flow network. | |
If you haven't installed the Flow CLI yet and have [homebrew](https://brew.sh/) installed, simply run `brew install flow-cli`. Alternatively, refer to the Flow CLI [installation instructions](../../../tools/flow-cli/install.md). |
## Create a new project | ||
|
||
In your preferred code editor, create a new directory for your project and navigate to it in the terminal. Then | ||
initialize a new Flow project by running the command `flow init`. This will create a `flow.json` file that contains the project configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notice: for starting a new project prefer using 'flow setup'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`flow setup' create an empty cadence project with cadence folder
it will require more explanation why there are multiple subfolders
## Create a new project | ||
|
||
In your preferred code editor, create a new directory for your project and navigate to it in the terminal. Then | ||
initialize a new Flow project by running the command `flow init`. This will create a `flow.json` file that contains the project configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Short explanation of what flow.json is and configures with a link to reference. 🙏🏼
Additionally we might need a page with better reference of flow.json and it's available configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added a reference to tools/flow-cli/flow.json/configuration.md
|
||
## Add the smart contract to the config | ||
|
||
Run `flow config add contract` and add the created `calculator.cdc` contract to the config with the name as `Calculator`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quick explainer: "This command adds your contract name and location under the contracts key in flow.config..."
|
||
``` | ||
|
||
This code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noice 🚀
|
||
## Advanced Testing Techniques | ||
|
||
The Cadence testing framework provides various features and techniques for writing comprehensive test cases. Some of these include: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be some updates worth mentioning here
https://forum.onflow.org/t/major-uplift-for-cadence-testing-framework/5232
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very close to coming to life, onflow/flow-cli#1227 just waiting for this 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lg2G
quickstart for testing cadence
https://docs-git-nialexsan-cadence-testing-onflow.vercel.app/build/getting-started/testing