# Integration Tests

Write and run integration tests against a GenLayer environment.

- Repository: https://github.com/internet-court/internet-court-skill (7050 stars)
- Category: Testing
- License: see repository
- Last updated: 2026-10-26
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add internet-court/internet-court-skill --skill integration-tests -g -a claude-code -y`
Codex: `npx skills add internet-court/internet-court-skill --skill integration-tests -g -a codex -y`
Cursor: `npx skills add internet-court/internet-court-skill --skill integration-tests -g -a cursor -y`
Gemini CLI: `npx skills add internet-court/internet-court-skill --skill integration-tests -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add internet-court/internet-court-skill`

## Description

Write and run integration tests against a GenLayer environment.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Integration Tests

Run contracts against a real GenLayer environment (GLSim, Studio, or testnet) with full consensus validation.

## Running Tests

```bash
# 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

```python
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

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