To run the tests in the ExploitPoCTest contract, you'll need to use the Foundry testing framework, which includes tools like forge. Here’s a step-by-step guide on how to execute these tests:
-
Install Foundry
- If Foundry is not installed, you can install it using the following shell command:
curl -L https://foundry.paradigm.xyz | bash foundryup
- If Foundry is not installed, you can install it using the following shell command:
-
Navigate to Your Project Directory
- Change to the directory where your Solidity project and the
ExploitPoCTest
contract are located.
- Change to the directory where your Solidity project and the
-
Compile the Contracts
- Compile your Solidity contracts to ensure all artifacts are up to date:
forge build
- Compile your Solidity contracts to ensure all artifacts are up to date:
-
Run the Tests
- Execute the tests using the
forge test
command. You can run all tests or specify a particular test. - To run all tests:
forge test
- To run a specific test, use the
--match-test
flag followed by the name of the test function:forge test --match-test testNormalBorrowLiquidate
- Execute the tests using the
-
Review the Output
- Foundry will execute the tests and provide a report on the console. This report includes information on which tests passed or failed and any errors or logs generated during the test execution.
-
Debugging (if necessary)
- If any tests fail or behave unexpectedly, you can use
forge
debug tools or add logging statements (console.log
) in your Solidity code to help diagnose issues.
- If any tests fail or behave unexpectedly, you can use