app like that
Chukti
Chukti

Chukti is a tool for testing smart contracts using plain English sentences with Gherkin syntax. It offers human-readable tests, supports platforms like Hardhat, Truffle, and Foundry, and allows quick setup with automated commands.

Features

Human-Readable and Reusable

Write tests in plain English with Gherkin syntax, making them accessible to all team members. It includes predefined steps for common operations.

Flexible and Extensible

Supports Hardhat, Viem, Forge, and Anvil setups with customizable step definitions to fit project needs.

Quick and Automated Setup

Initialize new projects with a single command, streamlining workflow and saving setup time.

Initialize a new project

Allows you to initialize a smart contract testing project using Chukti. You can initialize by running commands either globally or locally using npm or yarn.

Project setup options

Provides options for project setup with either 'Hardhat + Viem' or 'Forge + Anvil'. Depending on your preference or use case, select the module that suits your development and testing needs.

Guidance for newcomers

Offers insights for those new to smart contract testing to help choose between Hardhat + Viem and Forge + Anvil based on ecosystem richness, performance, complexity, and community support.

Unified Setup

Chukti supports Hardhat, Truffle, and Forge setups. You can initialize a new project with a single command, reducing the need for complex configurations.

Human-Readable Tests

Tests are written in plain English using Cucumber's Gherkin syntax, making them easy to understand for all team members.

Predefined Steps

Chukti offers a set of predefined steps for common operations like deploying contracts and reading or writing to contracts, speeding up the testing process.

Extensible and Customizable

Chukti allows you to add your own steps and hooks for specific project needs, offering a lot of customization.

Writing a Solidity Contract

Guides you through creating a simple Solidity contract named 'Counter.sol.' This contract handles basic operations like getting, setting, incrementing, and decrementing a number.

Creating a Feature Test File

Instructs you to write a test file 'counter.feature' to test the 'Counter' contract. It includes deploying the contract and interacting with it.

Running the Test

Explains steps to run the feature test using commands to verify contract deployment and its functions, such as incrementing a number.

Explanation Section

Breaks down how the feature test works, including steps like checking contract existence, deploying the contract, reading values, and validating outputs.

contracts/

This directory contains your Solidity contracts. The 'Counter.sol' file is a sample contract to get you started, and you can add more contracts as needed.

features/

This directory contains your Cucumber feature files. The 'Counter.feature' file defines test scenarios for the 'Counter' contract using Gherkin syntax. You can create additional feature files to test other contracts or scenarios.

support/

The 'steps.ts' file maps the steps in the 'Counter.feature' file to the actual code that performs the actions. You can add more step definition files as needed.

test-reports/

This directory will contain the test reports generated after running your tests. The 'test-report.html' is an example of a test report that can be configured in your project settings.

chukti.config.json

This is the configuration file for Chukati, specifying the project type and other settings. Example: { "projectType": "hardhat-viem" }.

hardhat.config.ts

This is the configuration file for Hardhat, specifying the Solidity version and other settings for your Hardhat project.

.gitignore

This file specifies which files and directories should be ignored by Git, such as 'node_modules', 'artifacts', and 'coverage'.

cucumber.json

This configures Cucumber for your project, specifying paths to your feature files and step definitions, as well as the format and location of the test reports.

contracts/

This directory contains your Solidity contracts. The 'Counter.sol' file is a sample contract provided to get you started, and you can add more contracts as needed.

features/

This directory contains your Cucumber feature files. The 'counter.feature' file defines test scenarios for the 'Counter' contract using Gherkin syntax, and you can create additional feature files.

support/

The 'steps.ts' file maps the steps in the 'counter.feature' file to actual code that performs the actions. Additional step definition files can be added as needed.

test-reports/

Contains test reports generated after running your tests. The 'test-report.html' file is an example, and you can configure the format and location of the reports.

.gitignore

Specifies which files and directories should be ignored by Git, including 'node_modules', 'cache', and 'out' directories.

chukti.config.json

Configuration file for Chukti, specifying project type and settings, e.g., {"projectType": "forge-anvil"}.

cucumber.json

Configures Cucumber for the project, specifying paths to feature files and step definitions, as well as the format and location of test reports.

Initialize a contract

This step allows you to load a smart contract from a specified file path. It uses the syntax: 'Given I have a smart contract located at "path/to/contract.sol"'. Required values include the file path to the smart contract relative to the project root.

Deploy a contract

This step lets you deploy a smart contract with specified constructor arguments and an amount of Ether. The syntax is: 'When I deploy the smart contract with constructor arguments "args" and send "amount" Ether'. You need to specify the arguments and the amount of Ether.

Validate deployment status

This step validates the deployment status of a smart contract. It uses the syntax: 'Then I validate the deployment status is "expectedStatus"'. The expected status can be either success or reverted.

Read from a contract

This step allows you to call a read-only function on the contract with specified arguments. The format is: 'When I call the read function "functionName" from the contract with arguments "args"'. Required values are the function name and the arguments.

Write to a contract

This step helps you call a state-changing function on the contract with specified arguments and Ether. The syntax is: 'When I call the write function "functionName" from the contract with arguments "args" and send "amount" Ether'. Required values include the function name, arguments, and the amount of Ether.

Transaction Status Validation

Validates the status of the last transaction against an expected status which can be 'success' or 'reverted'. Useful for confirming transaction outcomes in tests.

Switch Wallet Address

Multiple functions for managing wallet addresses including setting the active test wallet address to a specific wallet address or to a particular index from a list of wallet addresses.

Data Validation

Allows you to validate the value stored in a variable against an expected value using a specified comparison operator. It requires the variable name, comparison operator (like equal to, not equal to, greater than, less than), and expected value for comparison.

Store Result

Enables storing the result of the last operation in a specified variable. You simply need to specify the variable name where the result will be stored.

Smart contract testing framework

ChukIt allows users to write smart contract tests using plain English sentences with Gherkin syntax. It supports both Hardhat + Vitest and Forge + Anvil setups.

Global installation

Users can install ChukIt globally using npm with the command 'npm install -g chukit'.

Project initialization

Users can initialize a new ChukIt project by running the command 'npx chukit init'.

Test execution

To run tests, users navigate to their project directory and execute 'npx chukit test'.

Step definitions

ChukIt provides predefined step definitions for common operations, and users can also write custom step definitions in their 'support' directory.

Project setup support

ChukIt supports TypeScript projects with either Hardhat + Vitest or Forge + Anvil setups.

Error troubleshooting

ChukIt provides explanations and solutions for common errors such as 'Unsupported project type' and 'No ChukIt project found' errors.