# Foundry Testing

**Video Tutorial**

For the visually inclined, view our video explainer [**HERE**](https://youtu.be/C_PGd8CPdfg?t=485).

**Example Code**

{% embed url="<https://github.com/superfluid-finance/super-examples/blob/main/projects/money-streaming-intro/money-streaming-intro-foundry/test/MoneyRouter.t.sol>" %}
Foundry test suite from our Money Router example
{% endembed %}

## Foundry Example

Within a foundry test file, you can call the SuperfluidFrameworkDeployer contract directly in your `setUp()` function.

```solidity
import "forge-std/Test.sol";
import "../../contracts/MoneyRouter.sol";
import {ISuperfluid} from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol";

import {
    SuperfluidFrameworkDeployer,
    TestGovernance,
    Superfluid,
    ConstantFlowAgreementV1,
    CFAv1Library,
    SuperTokenFactory
} from "@superfluid-finance/ethereum-contracts/contracts/utils/SuperfluidFrameworkDeployer.sol";

contract StreamRebounderRandomTest is Test {

    StreamRebounder public streamRebounder;
    
    struct Framework {
        TestGovernance governance;
        Superfluid host;
        ConstantFlowAgreementV1 cfa;
        CFAv1Library.InitData cfaLib;
        InstantDistributionAgreementV1 ida;
        IDAv1Library.InitData idaLib;
        SuperTokenFactory superTokenFactory;
    }

    SuperfluidFrameworkDeployer.Framework sf;
    
    function setUp() public {
				
	address public owner;
	//DEPLOYING THE FRAMEWORK
        SuperfluidFrameworkDeployer sfDeployer = new SuperfluidFrameworkDeployer();
        sf = sfDeployer.getFramework();
				
	// DEPLOYING DAI and DAI wrapper super token

	vm.prank(owner);
	ISuperToken daix = sfDeployer.deployWrapperToken(
	    "Fake DAI", "DAI", 18, 10000000000000
	);
	
        MoneyRouter = new StreamRebounder(
            sf.host,
            owner
        );
    }

    //add other functions and test contracts...

}
```

When using foundry, you'll need to install `superfluid-finance/ethereum-contracts`. If you have issues when running `forge install`, try using the `--no-commit` flag.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://superfluid.gitbook.io/superfluid/developers/testing-guide/foundry-testing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
