status-go/tests-functional
Florin Barbu 81136cbb6f
test_: fix config formatting issue
2024-11-11 17:19:20 +02:00
..
schemas test_: verify schema of signals during init; fix schema verification warnings (#5947) 2024-10-29 12:10:48 +00:00
src test_: status cli to status backend 2024-11-11 16:47:53 +02:00
tests test_: status cli to status backend 2024-11-11 16:47:53 +02:00
.pre-commit-config.yaml test_: status cli to status backend 2024-11-11 16:47:53 +02:00
Dockerfile chore_: get version with go generate (#6014) 2024-11-03 00:47:15 +00:00
Dockerfile.tests-rpc chore_: rename integration tests to functional tests (#5908) 2024-10-03 14:51:51 +01:00
README.MD test_: status cli to status backend 2024-11-11 16:47:53 +02:00
config.json test_: fix config formatting issue 2024-11-11 17:19:20 +02:00
conftest.py test_: status cli to status backend 2024-11-11 16:47:53 +02:00
docker-compose.anvil.yml chore_: rename integration tests to functional tests (#5908) 2024-10-03 14:51:51 +01:00
docker-compose.status-go.local.yml test_: added status-backend support, fixed signals 2024-10-08 15:27:48 +02:00
docker-compose.test.status-go.yml test_: remove port bind 2024-10-28 11:40:33 +01:00
entrypoint.sh chore_: rename integration tests to functional tests (#5908) 2024-10-03 14:51:51 +01:00
pytest.ini test_: status cli to status backend 2024-11-11 16:47:53 +02:00
requirements.txt test_: status cli to status backend 2024-11-11 16:47:53 +02:00

README.MD

Overview

Functional tests for status-go

Table of Contents

How to Install

  1. Install Docker and Docker Compose
  2. Install Python 3.10.14
  3. Set up a virtual environment (recommended):
    • In ./tests-functional, run:
      python3 -m venv .venv
      source .venv/bin/activate
      pip install -r requirements.txt
      
    • Optional (for test development): Use Python virtual environment for better dependency management. You can follow the guide here

How to Run

Running dev RPC (anvil with contracts)

  • In ./tests-functional run docker compose -f docker-compose.anvil.yml up --remove-orphans --build, as result:
    • an anvil container with ChainID 31337 exposed on 0.0.0.0:8545 will start running
    • Status-im contracts will be deployed to the network

Run tests

  • In ./tests-functional run docker compose -f docker-compose.anvil.yml -f docker-compose.test.status-go.yml -f docker-compose.status-go.local.yml up --build --remove-orphans, as result:
    • a container with status-go as daemon will be created with APIModules exposed on 0.0.0.0:3333
    • status-go will use anvil as RPCURL with ChainID 31337
    • all Status-im contracts will be deployed to the network
  • In ./tests-functional/tests directory run pytest -m wallet

Implementation details

  • Functional tests are implemented in ./tests-functional/tests based on pytest
  • Every test has two types of verifications:
    • verify_is_valid_json_rpc_response() checks for status code 200, non-empty response, JSON-RPC structure, presence of the result field, and expected ID.
    • jsonschema.validate() is used to check that the response contains expected data, including required fields and types. Schemas are stored in /schemas/wallet_MethodName
    • New schemas can be generated using ./tests-functional/schema_builder.py by passing a response to the CustomSchemaBuilder(schema_name).create_schema(response.json()) method, should be used only on test creation phase, please search how to create schema: to see an example in a test