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

testing intro #410

Merged
merged 4 commits into from
Oct 25, 2023
Merged

testing intro #410

merged 4 commits into from
Oct 25, 2023

Conversation

nialexsan
Copy link
Collaborator

@nialexsan nialexsan commented Oct 17, 2023

@vercel
Copy link

vercel bot commented Oct 17, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 24, 2023 7:48pm

Copy link
Member

@gregsantos gregsantos left a 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Copy link
Member

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'

Copy link
Collaborator Author

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.
Copy link
Member

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

Copy link
Collaborator Author

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`:
Copy link
Member

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
Copy link
Member

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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

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 🙏

docs/build/getting-started/quickstarts/testing.md Outdated Show resolved Hide resolved
Copy link
Contributor

@m-Peter m-Peter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀

Copy link
Member

@gregsantos gregsantos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lg2G

@nialexsan nialexsan merged commit 1338d75 into main Oct 25, 2023
3 checks passed
@nialexsan nialexsan deleted the nialexsan/cadence-testing branch October 25, 2023 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants