我试图用remix编写一些单元测试,但是当我尝试导入时,remix_accounts.sol重组合告诉我无法导入文件,没有找到
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");
}
}发布于 2020-10-02 04:03:10
根据‘.’
在Remix中,您将得到错误。
无法导入“remix_accounts.sol”文件未找到“
当您尝试在“”选项卡中编译时。(此选项卡通常是在混合屏幕左侧的第二个或第三个选项卡)。
但是,如果您切换到"Solidity“选项卡(显示两个复选标记的图标的选项卡)并单击该选项卡内的" run”按钮,它应该导入"remix_accounts.sol“而没有错误,并运行单元测试。
如果您没有看到“稳固单元测试”选项卡。然后打开"Plugin“选项卡(带有插件图标的选项卡),然后搜索”“,然后单击" activate”按钮来激活该模块。
https://ethereum.stackexchange.com/questions/87729
复制相似问题