/pytests

API and Operations tests for Echo blockchain

Primary LanguagePythonMIT LicenseMIT

Automated Tests for Echo

The project is intended for testing Echo project. Includes testing:

Instalation:

Software Requirements: Python 3.7 or later

Windows
$ git clone https://github.com/echoprotocol/pytests.git
$ cd pytests
$ python3 -m pip install --user virtualenv
$ virtualenv <ENVIRONMENT_NAME>
$ .\<ENVIRONMENT_NAME>\Scripts\activate
$ pip3 install -r requirements.txt
$ export GENESIS_FILE=genesis.json
Linux
$ git clone https://github.com/echoprotocol/pytests.git
$ cd pytests
$ virtualenv <ENVIRONMENT_NAME> -p python3.7
$ source <ENVIRONMENT_NAME>/bin/activate
$ pip3 install -r requirements.txt
$ export GENESIS_FILE=genesis.json
Mac OS

please see Linux installation

Usage

Note:

Before running the tests, you should specify a environment variables:
  • BASE_URL - URL on which tests will be connected to the Echo node
  • ETHEREUM_URL - URL on which tests will be connected to the Ethereum node
  • NATHAN_PK - private key of "nathan" account
  • INIT0_PK - private key of "init0" initial account
  • GENESIS_FILE - Echo node genesis file
Optional:
  • ROPSTEN - flag to run tests in the ropsten network (bool type)
  • DEBUG - run tests with debug mode that log all in\out communication messages with Echo node (bool type)
for this you need, example:
  • Linux OS: export BASE_URL=<BASE_URL>
  • Windows OS: set BASE_URL=<BASE_URL>

You can use docker-compose to run tests on the Echo and Ethereum nodes locally:

$ cd pytests
$ docker-compose pull
$ docker-compose up build --no-cache
$ docker-compose up migrate
$ docker-compose up -d echo
$ docker-compose up pytests

To run tests you can use following commands in console:

Filter lcc commands
Run all tests $ lcc run
Run tests with special tag $ lcc run -a tag_name
Run tests with special property $ lcc run -m property_kind:property_name
Run tests with special link $ lcc run -l link_name
Run only passed tests $ lcc run --passed
Run only failed tests $ lcc run --failed
Run only skipped tests $ lcc run --skipped
Run only non-passed tests $ lcc run --non-passed
Run only disabled tests $ lcc run --disabled
Run only enabled tests $ lcc run --enabled
Run tests from special report $ lcc run --from-report path_to_report

note: can combine run options, for example - $ lcc run --failed --from-report reports/report-2

Using test_runner.py script to run tests, you can specify a environment variable PYTESTS_FILTERS for filtering run command.
Example: export PYTESTS_FILTERS=main:database_api
For more information about filters see test_runner.py script.

Project tree:

├── common
│   ├── base_test.py
│   ├── echo_operation.py
│   ├── ethereum_transaction.py
│   ├── object_validation.py
│   ├── receiver.py
│   ├── type_validation.py
│   └── utils.py
├── fixtures
│   └── base_fixtures.py
├── pre_run_scripts
│   └── pre_deploy.py
├── resources
│   ├── echo_contracts.json
│   ├── echo_operations.json
│   ├── ethereum_contracts.json
│   ├── ethereum_transactions.json
│   ├── private_keys.json (optional)
│   ├── urls.json
│   └── wallets.json (optional)
├── suites
│   ├── AssetApi
│   │   ├── GetAllAssetHolders.py
│   │   ├── GetAssetHoldersCount.py
│   │   ├── GetAssetHolders.py
│   ├── DatabaseApi
│   │   ├── CallContractNoChangingState.py
│   │   ├── CheckERC20Token.py
│   │   └── ...
│   ├── DID Api
│   │   └── Get_did_object.py
│   ├── HistoryApi
│   │   ├── GetAccountHistory.py
│   │   ├── GetAccountHistoryOperations.py
│   │   ├── GetContractHistory.py
│   │   └── GetRelativeAccountHistory.py
│   ├── NetworkBroadcastApi
│   │   ├── BroadcastTransaction.py
│   │   ├── BroadcastTransactionSynchronous.py
│   │   └── BroadcastTransactionWithCallback.py
│   ├── Operations
│   │   ├── AccountManagement.py
│   │   ├── AssetManagement.py
│   │   └── ...
│   ├── RegistrationApi
│   │   ├── GetRegistrar.py
│   │   ├── RequestRegistrationTask.py
│   │   └── SubmitRegistrationSolution.py
│   ├── Scenarios
│   │   ├── AssetInt.py
│   │   ├── AssetUpdate.py
│   │   └── ...
│   ├── SideChain
│   │   ├── Bitcoin.py
│   │   ├── ERC20.py
│   │   └── Ethereum.py
│   ├── AssetApi.py
│   ├── DatabaseApi.py
│   ├── HistoryApi.py
│   ├── LoginApi.py
│   ├── NetworkBroadcastApi.py
│   ├── Operations.py
│   ├── RegistrationApi.py
│   ├── Scenarios.py
│   └── SideChain.py
├── .env
├── .flake8
├── .gitignore
├── .gitlab-ci.yml
├── .travis.yml
├── docker-compose.yml
├── Dockerfile
├── genesis.json
├── genesis_update_global_parameters.json
├── project.py
├── README.md
├── requirements.txt
└── test_runner.py

To Do Lists

Objects:

Subscriptions:

Blocks and transactions:

Globals:

Keys:

Accounts:

Contracts:

Contracts:

  • [did_create]
  • [did_delete]
  • [did_update]

Balances:

Assets:

Committee members:

Authority / validation:

Proposed transactions:

Sidechain:

Sidechain Ethereum:

Sidechain ERC20:

Sidechain Bitcoin:

Contract Feepool: