This project contains the functional testcases for neo blockchain.
-
Step 1: Start a neo privatenet/localnet with 7 nodes(DBFT and RpcServer plugins required)
Build neo with
dotnet buildand then start privatenet/localnet withneo/scripts/run-localnet-nodes.sh.cdtoneosource directory and then run the following commands:dotnet build cd scripts ./run-localnet-nodes.sh # or ./run-localnet-nodes.ps1 on Windows
-
Step 2: Initialize testcase running environment
cdtoneo-testcasesdirectory and then run the following commands:python3 -m venv venv # Python3.12 and later is required source venv/bin/activate # or venv/bin/Activate.ps1 on Windows pip3 install -r requirements.txt
-
Step 3: Set tested
The default testbed is
testbed/localnet.json, if you want to use other testbed, need to create a new testbed file. -
Step 4: Run the tests
cdtoneo-testcasesdirectory and then run the following commands:./run_tests.sh # or ./run_tests.ps1 on Windows -
After tests
Stop the privatenet/localnet and clean the data.
cdtoneosource directory and then run the following commands:cd scripts ./run-localnet-nodes.sh stop # or ./run-localnet-nodes.ps1 stop on Windows rm -rf localnet_nodes
- Create a new file in the
testcases/it's groupdirectory. - Create a new class in the new file, inherit from the
Testingclass. - Implement the
run_testmethod, which contains the test steps. - Implement the
pre_testandpost_testmethods if needed, which contains the pre-test, test and post-test steps. - If group is not in the
run_tests.shorrun_tests.ps1file, add it to the file. - Run the tests and check the results.
- Format the new file with pep8(with 120 characters per line) style.
- Create a new file in the