integration-tests
What it does
This skill shows how to run tests for GenLayer contracts against a real environment instead of in memory. It covers choosing a network and writing tests that confirm each transaction succeeded before checking state.
When to use it
- βWhen you want to test a GenLayer contract on a real network instead of in memory.
- βWhen you need to confirm that a contract works on a testnet before launch.
- βWhen a transaction seems to succeed but the contract state is wrong.
Skill link
https://github.com/internet-court/internet-court-skill/blob/main/vendored/genlayer/integration-tests/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βI want to run integration tests for my GenLayer contract on the studio network and see the output.β
5 new skills a week. 1 minute to read.
How it works
The agent runs the gltest tool against the network you choose and writes tests that deploy the contract, send transactions and read state. It checks each transaction's execution result before it reads the contract.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Integration Tests
Run contracts against a real GenLayer environment (GLSim, Studio, or testnet) with full consensus validation.
Running Tests
# Against default network (from gltest.config.yaml)
gltest tests/integration/ -v -s
# Against specific network
gltest tests/integration/ -v -s --network localnet
gltest tests/integration/ -v -s --network studionet
gltest tests/integration/ -v -s --network testnet_bradbury
Always use -v -s for visible output during development.
Test Pattern
from gltest import get_contract_factory
from gltest.assertions import tx_execution_succeeded
def test_full_flow():
factory = get_contract_factory("MyContract")
contract = factory.deploy(args=[])
# Write methods return transaction receipts
tx_receipt = contract.set_data(args=["hello"]).transact()
assert tx_execution_succeeded(tx_receipt)
# Read methods return values directly
result = contract.get_data(args=[contract.address]).call()
assert result == "hello"
ACCEPTED and FINALIZED are transaction lifecycle states, not proof that
contract execution succeeded. A transaction can be accepted and finalized with
an execution error, and failed execution applies no state changes. For deploy
transactions, failed execution means no contract is created.
Always assert tx_execution_succeeded(receipt) before reading state, checking
schema/code, or treating a missing contract as an infrastructure issue.
Key Differences from Direct Mode
| Direct Mode | Integration Tests | |
|---|---|---|
| Speed | ~30ms | ~seconds to minutes |
| Server required | No | Yes (GLSim, Studio, or testnet) |
| Consensus | Leader only | Full leader + validators |
| Write methods | Return values directly | Return transaction receipts |
| Read methods | Return values directly | Use .call() |
| Mocking | mock_web() / mock_llm() |
Real web/LLM calls |
Write vs Read Calls
Write methods (state-changing):
# .transact() submits and waits for consensus
tx_receipt = contract.method_name(args=[arg1, arg2]).transact()
assert tx_execution_succeeded(tx_receipt)
Read methods (view-only):
# .call() reads without transaction
result = contract.view_method(args=[arg1]).call()
Configuration (gltest.config.yaml)
contract_path: contracts/
networks:
localnet:
# GenLayer Studio running locally
studionet:
# studio.genlayer.com β gasless, no funding needed (0 GEN balance is fine)
testnet_bradbury:
accounts:
- "${ACCOUNT_PRIVATE_KEY_1}"
- "${ACCOUNT_PRIVATE_KEY_2}"
Test Markers
import pytest
@pytest.mark.slow
def test_expensive_operation():
"""Excluded by default. Run with: gltest -m slow"""
pass
Environments
- GLSim (
pip install genlayer-test[sim],glsim --port 4000 --validators 5) β lightweight, no Docker, ~1s startup. Runs Python natively, not in GenVM. Good for fast iteration. - Studio local (
genlayer up) β full GenVM, real consensus, Docker required. Validates runtime compatibility. - studio.genlayer.com (StudioNet) β hosted Studio, no setup, rate-limited (see Common Issues). Gasless: no tokens required. Accounts with 0 GEN balance can deploy and run tests normally.
- Testnet Bradbury β real network, requires funded accounts.
When to Use Integration Tests
- Validating consensus (leader + validators agree)
- Testing real web requests and LLM calls
- Pre-deployment smoke tests
- Verifying contract works in actual GenVM (not just Python runner)
Direct mode should cover most logic testing. Use integration tests for final validation before deploying.
Common Issues
"Transaction not found" errors
Clear cache: rm -rf .gltest_cache
Slow tests
Run single tests during development:
gltest tests/integration/test_file.py::test_specific -v -s
JSON serialization
When working with mock validators, convert to dicts:
transaction_context = {"validators": [v.to_dict() for v in mock_validators]}
Studio rate limits (HTTP 429 / -32429)
studio.genlayer.com enforces per-IP limits: 60 req/min, 1000 req/hr, 10000 req/day. Limits aren't permanent β once tripped, further requests are rejected until the current window resets (next minute / hour / day cycle). Throttle batch tests, run heavy suites against localnet (GLSim or local Studio), or pace .transact() calls.
-32028 is the related pending-queue cap β **up to 32 in-flight
FAQ
Why does a transaction marked accepted still need checking?
The skill explains that accepted and finalized only describe the transaction lifecycle. A transaction can finish with an execution error, so the agent must check the execution result.
Which networks can I test against?
The skill lists localnet, studionet and testnet Bradbury, and the default comes from the project config file.
Why use the verbose flags?
The skill recommends them during development so you can see the output.
Details
Original description by the author
Write and run integration tests against a GenLayer environment.
Popularity
- GitHub stars
- 7.0k
- Ranking position
- #13629
- License
- β
- Updated
- 10/26/2026
Comments
- β¦
More skills from this repository
internet-court
7.0kHelps your agent pay, hire, or deal safely with another AI agent or paid service, and points it to the right specialized guide.
genlayer-erc7710-connector
7.0kHelps your agent connect an AI review result to a permission system, so a bad review can limit or cancel an agent's permissions.
genlayer-intelligent-contracts
7.0kHelps your agent define the rules, evidence and outputs of an AI judge that checks whether another agent followed its mandate.
x402-erc7710
7.0kHelps your agent pay for web services one request at a time, and set up ongoing spending that stays within a permission budget.
Similar skills
test-driven-development
311kTeaches your agent to write a failing test first, watch it fail, then write the smallest code that passes, before building any feature or fix.
verification-before-completion
311kTeaches your agent to run real checks and read their output before claiming that a task, fix, or build is complete or passing.
migrate-to-shoehorn
310kReplaces risky type casts in your test files with the shoehorn library, so tests can use partial data and still pass type checks.