github.com/platonnetwork/platon-go@v0.7.6/cases/docs/README.md (about)

     1  # PlatON-Tests
     2  
     3  ### Test execution
     4  
     5  1. Dependent installation 
     6  
     7  ```js
     8  pip install -r requirements.txt
     9  ```
    10  
    11  2. Execute the test
    12  
    13  Follow the pytest command to execute, add a new parameter reference[conftest.py](../conftest.py)。
    14  
    15  example: 
    16  
    17  ```js
    18  py.test 'tests/chain/test_chain_deploy.py' --nodeFile "deploy/node/test_chaininfo.yml" --accountFile "deploy/accounts.yml"
    19  ```
    20  
    21  More please check[readme](../README.md)
    22  
    23  Remarks:
    24  There are many combinations of project management and execution test commands. 
    25  You need to input a large number of commands and consider introducing a Makefile.
    26  
    27  ### Project structure description
    28  
    29  1. Root directory:
    30  
    31  + pytest.ini pytestTest the configuration file. For details, please refer to the official file.
    32  [pytest.ini](https://docs.pytest.org/en/latest/reference.html#configuration-options)。
    33  
    34  + conftest.py-pytestPlug-ins, mainly including the introduction of command line parameters, 
    35  test environment generation, test failure use case log download and other functions.
    36  
    37  2.common:
    38  
    39  + Project public methods, including logging, configuration file reading, connecting to linux server, 
    40  establishing web3 connection, binary package download, etc.
    41  
    42  3.conf:
    43  
    44  + Local file path configuration when deploying the environment, please see the file notes for details.
    45  
    46  4.deploy:
    47  
    48  + Deployment file storage path, used with conf
    49  
    50  5.environment:
    51  
    52  + Deployment environment script, consisting of five classes: TestConfig, TestEnvironment, Account, Server, Node。
    53  + TestConfig: Deployment environment configuration, test environment global configuration。
    54  + Account: Test account management class for testing, account generation, transfer, etc.。
    55  + Server: Server management class for deployment, management server dependencies, and compressed file management.
    56  + TestEnvironment: Test environment class, used to manage the test environment, start the node, close the node, restart the node, get the node, get the account, and so on.
    57  + Node: Node class, used to manage nodes, with basic node information, node connections, node running status, node start and stop, and so on.
    58  
    59  6.tests:
    60  
    61  + Use case storage directory
    62  
    63  7.tests/lib:
    64  
    65  + Utils: use case public method
    66  + Configuration: StakingConfig, pledge basic configuration; PipConfig, pip basic configuration; DefaultEconomicConfig economic model basic configuration
    67  + genesi:Genesis Genesis.json file convertible object
    68  + The rest of the classes are secondary packages for sdk
    69  
    70  
    71  ### Example
    72  
    73  [staking example](../tests/example/test_staking.py)
    74  
    75  [Custom node deployment](../tests/example/test_customize_deploy.py)
    76  
    77  ### Feature description
    78  
    79  + Abandon the deployment form in the old framework, introduce test environment objects and node objects, used to manage the test environment and nodes, including a large number of node attributes in the node, eliminating the need to retrieve a large number of node information
    80  
    81  + The w3 connection establishment introduces a timeout mechanism to avoid the problem that the node just starts to connect and causes an error.
    82  
    83  + Remove the setup, introduce the fixture, design the use case, the common steps need to be designed as a step method, remove the duplicate step code
    84  
    85  + Deployment optimization, sacrificing environment preparation time, and greatly improving the speed of secondary deployment