मुख्य सामग्री पर जाएँ
Skillpedia
टेस्टिंग7.0k · #13629

integration-tests

यह क्या करती है

यह स्किल दिखाती है कि GenLayer कॉन्ट्रैक्ट के टेस्ट मेमोरी की बजाय असली वातावरण में कैसे चलाएँ। इसमें नेटवर्क चुनना और ऐसे टेस्ट लिखना शामिल है जो स्टेट जाँचने से पहले पुष्टि करें कि हर लेन-देन सफल हुआ।

कब इस्तेमाल करें

  • ✓जब आप GenLayer कॉन्ट्रैक्ट को मेमोरी की बजाय असली नेटवर्क पर टेस्ट करना चाहते हों।
  • ✓जब आपको लॉन्च से पहले पक्का करना हो कि कॉन्ट्रैक्ट testnet पर काम करता है।
  • ✓जब लेन-देन सफल दिखे लेकिन कॉन्ट्रैक्ट की स्टेट गलत हो।

Skill का लिंक

https://github.com/internet-court/internet-court-skill/blob/main/vendored/genlayer/integration-tests/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/internet-court/internet-court-skill/blob/main/vendored/genlayer/integration-tests/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“मैं अपने GenLayer कॉन्ट्रैक्ट के इंटीग्रेशन टेस्ट studio नेटवर्क पर चलाना और उसका आउटपुट देखना चाहता हूँ।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

एजेंट आपके चुने नेटवर्क के खिलाफ gltest टूल चलाता है, और ऐसे टेस्ट लिखता है जो कॉन्ट्रैक्ट डिप्लॉय करें, लेन-देन भेजें और स्टेट पढ़ें। कॉन्ट्रैक्ट पढ़ने से पहले वह हर लेन-देन का execution नतीजा जाँचता है।

तकनीकी सामग्री (मूल 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 केवल लेन-देन के जीवनचक्र को बताते हैं। लेन-देन execution error के साथ भी खत्म हो सकता है, इसलिए execution नतीजा जाँचना ज़रूरी है।

किन नेटवर्क पर टेस्ट कर सकते हैं?

स्किल localnet, studionet और testnet Bradbury सूचीबद्ध करती है, और डिफ़ॉल्ट प्रोजेक्ट कॉन्फ़िग फ़ाइल से आता है।

verbose फ़्लैग क्यों इस्तेमाल करें?

विकास के दौरान स्किल इन्हें सुझाती है, ताकि आप आउटपुट देख सकें।

जानकारी

लेखक का मूल विवरण

Write and run integration tests against a GenLayer environment.

repo: internet-court/internet-court-skill

लोकप्रियता

GitHub स्टार
7.0k
रैंकिंग में स्थान
#13629
लाइसेंस
—
अपडेट की गई
26/10/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

internet-court

7.0k

यह आपके एजेंट को AI एजेंट या पेड सेवा से सुरक्षित तरीके से भुगतान और लेन-देन की शुरुआती दिशा देती है, और सही विशेष गाइड बताती है।

AI और एजेंटएजेंट

genlayer-erc7710-connector

7.0k

यह आपके एजेंट को AI समीक्षा के नतीजे को अनुमति प्रणाली से जोड़ने देती है, ताकि खराब समीक्षा एजेंट की अनुमतियाँ सीमित कर सके।

AI और एजेंटएजेंट

genlayer-intelligent-contracts

7.0k

यह आपके एजेंट को AI जज के नियम, सबूत और नतीजे तय करने में मदद करती है, जो जाँचता है कि दूसरा एजेंट अपने अधिकार के दायरे में रहा या नहीं।

AI और एजेंटएजेंट

x402-erc7710

7.0k

यह आपके एजेंट को हर अनुरोध पर वेब सेवा का भुगतान करने और तय सीमा के भीतर लगातार खर्च करने की व्यवस्था में मदद करती है।

AI और एजेंटएजेंट

मिलती-जुलती skills