integration-tests
하는 일
이 스킬은 메모리 안이 아니라 실제 환경에서 GenLayer 컨트랙트 테스트를 실행하는 방법을 보여 줍니다. 네트워크를 고르고, 상태를 읽기 전에 각 트랜잭션이 성공했는지 확인하는 테스트를 작성하는 방법을 다룹니다.
사용하는 경우
- ✓메모리 대신 실제 네트워크에서 GenLayer 컨트랙트를 테스트하고 싶을 때.
- ✓출시 전에 테스트넷에서 컨트랙트가 작동하는지 확인해야 할 때.
- ✓트랜잭션은 성공한 것처럼 보이는데 컨트랙트 상태가 잘못된 경우.
스킬 링크
https://github.com/internet-court/internet-court-skill/blob/main/vendored/genlayer/integration-tests/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“스튜디오 네트워크에서 제 GenLayer 컨트랙트의 통합 테스트를 실행하고 출력을 보여 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 사용자가 고른 네트워크에 대해 gltest 도구를 실행하고, 컨트랙트를 배포하고 트랜잭션을 보내며 상태를 읽는 테스트를 작성합니다. 컨트랙트를 읽기 전에 각 트랜잭션의 실행 결과를 확인합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 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
자주 묻는 질문
accepted로 표시된 트랜잭션도 왜 확인해야 하나요?
스킬은 accepted와 finalized는 트랜잭션의 생명 주기만 설명한다고 말합니다. 트랜잭션이 실행 오류로 끝날 수 있으므로 실행 결과를 확인해야 합니다.
어떤 네트워크에서 테스트할 수 있나요?
localnet, studionet, testnet Bradbury가 나열되어 있으며, 기본값은 프로젝트 설정 파일에서 옵니다.
상세 출력 플래그는 왜 쓰나요?
개발 중에 출력을 볼 수 있도록 스킬이 권장합니다.
상세 정보
작성자의 원본 설명
Write and run integration tests against a GenLayer environment.
인기도
- GitHub 스타
- 7.0k
- 순위
- #13629
- 라이선스
- —
- 업데이트
- 2026. 10. 26.
댓글
- …
이 저장소의 다른 스킬
internet-court
7.0k에이전트가 다른 AI 에이전트나 유료 서비스와 안전하게 결제하거나 거래하도록 돕고, 적합한 전문 가이드를 알려 줍니다.
genlayer-erc7710-connector
7.0k에이전트가 GenLayer 검토 결과를 권한 시스템에 연결하도록 돕습니다. 나쁜 검토는 에이전트의 권한을 제한하거나 취소할 수 있습니다.
genlayer-intelligent-contracts
7.0k에이전트가 다른 에이전트가 위임받은 범위를 지켰는지 확인하는 AI 심판의 규칙, 증거, 결과를 정하도록 돕습니다.
x402-erc7710
7.0k에이전트가 웹 서비스 요금을 요청 한 건마다 결제하고, 권한 예산 안에서 지속적인 지출을 설정하도록 돕습니다.
비슷한 스킬
test-driven-development
311k에이전트가 기능이나 수정을 만들기 전에 실패하는 테스트를 먼저 쓰고, 그것을 통과시키는 가장 작은 코드를 작성하도록 가르칩니다.
verification-before-completion
311k에이전트가 작업, 수정, 빌드가 완료되었거나 통과했다고 말하기 전에 실제 점검을 실행하고 결과를 읽도록 가르칩니다.
migrate-to-shoehorn
310k테스트 파일의 위험한 타입 캐스팅을 shoehorn 라이브러리로 바꿔, 테스트가 일부 데이터만 써도 타입 검사를 통과하도록 돕습니다.