[英]Some Truffle test not executed
It seems like some of my truffle tests are not executed.似乎我的一些松露测试没有执行。 Compilation and everything is working fine.
编译,一切正常。 I also get no error messages what so ever.
我也没有收到任何错误消息。
As Im learning dapp development with a book you can download the example code right here .当我通过一本书学习 dapp 开发时,您可以在此处下载示例代码。 And here is the corresponding book.
这是相应的书。
The code that I'm referring to is in Kap12\Kap12_Security_Truffle_Project
if I run truffle test
only some of the tests are executed, same if I run only a specific test that wasn't executed with truffle test
我指的代码在
Kap12\Kap12_Security_Truffle_Project
如果我运行 truffle truffle test
只执行一些测试,如果我只运行一个没有用truffle test
执行的特定测试
So for example when I run truffle test.\test\TestReentrancy.sol
the output is:因此,例如,当我运行
truffle test.\test\TestReentrancy.sol
时,output 是:
Compiling your contracts...
===========================
> Compiling .\contracts\Delegation.sol
> Compiling .\contracts\GasSiphoningWallet.sol
> Compiling .\contracts\GasToken.sol
> Compiling .\contracts\KingOfTheEther.sol
> Compiling .\contracts\Migrations.sol
> Compiling .\contracts\Reentrancy.sol
> Compiling .\contracts\SmuggleEther.sol
> Compiling .\contracts\UnderflowToken.sol
> Compiling .\contracts\Utility.sol
> Compiling .\contracts\GasToken.sol
> Compiling .\contracts\Reentrancy.sol
> Compiling .\contracts\Utility.sol
> Compiling .\test\TestReentrancy.sol
> Artifacts written to C:\Users\KONSTA~1\AppData\Local\Temp\test--15764-W3tQRszemoJS
> Compiled successfully using:
- solc: 0.5.0+commit.1d4f565a.Emscripten.clang
0 passing (1ms)
Output: truffle version Output:松露版
Truffle v5.3.4 (core: 5.3.4)
Solidity - 0.5.0 (solc-js)
Node v14.16.1
Web3.js v1.3.5
Would be very helpful If someone else could test if the code works on his system.如果其他人可以测试代码是否在他的系统上工作,那将非常有帮助。
Most probably you trying to deploy your smart contract like this.很可能你试图像这样部署你的智能合约。 I am facing the same problem.
我面临同样的问题。
var instance = await BrownieToken.deployed();
it("Initialize contract with correct value", async ()=> {
const tokenName = await instance.name();
const tokenSymbol = await instance.symbol()
assert.equal(tokenName, "BrownieToken","Token name should be BrownieToken");
assert.equal(tokenSymbol, "BT","Token symbol should be BT");
});
Wrap your deployment part in before.之前包装你的部署部分。 It's work for me hopes its works for u as well;)
这对我有用,希望它对你也有用;)
var instance;
before(async() => {
instance = await BrownieToken.deployed();
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.