1

I'm trying to write some unit tests with the remix but when I try to import remix_accounts.sol remix tells me Unable to import File Not Found

pragma solidity >=0.4.22 <0.7.0;
import "remix_tests.sol"; // this import is automatically injected by Remix.
import "remix_accounts.sol";

import "../TeamAtCompany.sol";

// File name has to end with '_test.sol', this file can contain more than one testSuite contracts
contract testSuite {
    TeamAtCompany teamContract;
    /// 'beforeAll' runs before all other tests
    /// More special functions are: 'beforeEach', 'beforeAll', 'afterEach' & 'afterAll'
    function beforeAll() public {
        // teamContract = new TeamAtQredo();
        // Here should instantiate tested contract
        Assert.equal(uint(1), uint(1), "1 should be equal to 1");
    }

    /// #sender: account-9
    function checkSender() public {
        Assert.equal(msg.sender, TestAccounts.getAccount(9),"This is not valid msg.sender");
    }

}
2

1 Answer 1

1

Per what goodvibration said in the comments:

Within Remix you will get the error

Unable to import 'remix_accounts.sol' File Not Found"
when you try to compile in the "Solidity Compiler" tab. (This tab is usually the second or third tab down on the left of the remix screen).

But if you switch to the "Solidity Unit Testing" tab (the tab with the icon depicting two checkmarks) and click the "Run" button within that tab, it should import "remix_accounts.sol" without error and run your unit tests.

If you don't see the "Solidity Unit Testing" tab. Then open the "Plugin Manager" tab (the tab with the plug icon), then search "Solidity Unit Testing" and click the "Activate" button to activate that module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.