github.com/nspcc-dev/neo-go@v0.105.2-0.20240517133400-6be757af3eba/pkg/neotest/doc.go (about)

     1  /*
     2  Package neotest contains a framework for automated contract testing.
     3  It can be used to implement unit-tests for contracts in Go using regular Go
     4  conventions.
     5  
     6  Usually it's used like this:
     7  
     8    - an instance of the blockchain is created using chain subpackage
     9    - the target contract is compiled using one of Compile* functions
    10    - and Executor is created for the blockchain
    11    - it's used to deploy a contract with DeployContract
    12    - CommitteeInvoker and/or ValidatorInvoker are then created to perform test invocations
    13    - if needed, NewAccount is used to create an appropriate number of accounts for the test
    14  
    15  Higher-order methods provided in Executor and ContractInvoker hide the details
    16  of transaction creation for the most part, but there are lower-level methods as
    17  well that can be used for specific tasks.
    18  
    19  It's recommended to have a separate folder/package for tests, because having
    20  them in the same package with the smart contract iself can lead to unxpected
    21  results if smart contract has any init() functions. If that's the case they
    22  will be compiled into the testing binary even when using package_test and their
    23  execution can affect tests. See https://github.com/nspcc-dev/neo-go/issues/3120 for details.
    24  */
    25  package neotest