Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [testing]

questions regarding the testing during development of contracts and DApps

1
vote
1answer
19 views

Can anyone please help me how can I start with blockchain testing,Deploy application and testing app [closed]

I am completely new to blockchain testing.Can someone please help me with how can I start with blockchain testing and procedure from where I should start and material for the same if possible.
0
votes
1answer
21 views

Unable to test the value from contract using truffle test

block builders! I have trouble testing the return value from my contract, because the return uint value is always a "transaction" object (I actually don't really know what that mean) Here is the ...
0
votes
0answers
11 views

Maian: Concrete validator

I am reading an article related to Maian which is a tool for testing ethereum smart contracts. It says that: Maian, the first tool for specifying and reasoning about trace properties, which ...
0
votes
0answers
14 views

Difference between fuzzing tool and instrumentation tool

I am reading an article related to a smart contract testing tool. I got following: The ContractFuzzer tool contains an offline EVM instrumentation tool and an online fuzzing tool. The offline ...
0
votes
1answer
13 views

SC Truffle Testing: Domain Object Returned?

Working through some tests in Truffle to become more acquainted with the environment but am running into an issue. What I am trying to do Test a smart contract with, among others, the following ...
1
vote
0answers
36 views

Truffle test of two transactions during the same block

I'm trying to test a solidity function that only allows it to be called once per block. E.g. (my desired functionality): Tx1 calls Fn during block #100, and when successful sets a boolean flag for ...
0
votes
1answer
43 views

Solidity test file reaches gas limit due to imports

I have a sol contract X.sol and a sol test file TestX.sol. X.sol is large: ~4m Gas after optimisation TextX.sol compiles, migrates and executes tests fine when just executing a single test - testY, ...
2
votes
1answer
34 views

Ethereum performance using whiteblock

I have recently heard about whiteblock testing platform, however, there is no details on how to build your own test. Do you have any idea about how to use it and how powerful the platform is?
3
votes
1answer
63 views

Evaluate the performance of a smart contract [closed]

What is the best way and tools to evaluate the performance of a smart contract. More specifically, I want to test my contract for large scale deployment by making a script that emulate real world ...
0
votes
0answers
21 views

How to setup basic ethereum network

I have 2-3 PC, of which my "internet" or, "world" consists. How can I recreate ethereum network on those? Eg, I want to mine coin on one and send it to another. Is there a simple guide for creating ...
1
vote
1answer
25 views

Where goes eth cost in private chain

I have a private test blockchain with ganache. I deploy one contract and make a couple transactions. Looking at the ganache UI I realized that the first account haves a ether consume to make the ...
1
vote
1answer
37 views

Simple Debug during tests

I'm new in solidity and I'd like to have a little bit of debug. this is my simple example (I'm using web3 1.0) I have a simple function in my contract function bar(address _address_usr) public { ...
1
vote
1answer
23 views

How to test time-dependent contracts on the mainnet?

In Ganache, I use evm_mine to simulate the passage of time. Assuming block times are accurate enough, what are the best practices to test some contracts on the mainnet or a testnet which depend on ...
1
vote
2answers
90 views

Truffle Tests Events via JavaScript

I am testing my contract via the chai and truffle-assertions libraries from a JavaScript file and am testing if events return the correct values. I have an event called Message. In my function, the ...
1
vote
2answers
74 views

Choosing between Javascript and Solidity for testing smart contracts

Truffle offers two ways to test smart contracts: either using test files written as Solidity contracts, or Javascript/Mocha. https://truffleframework.com/docs/truffle/testing/writing-tests-in-...
1
vote
0answers
37 views

is not contract address during truffle test

I have a stupid smart contract like this: pragma solidity ^0.4.24; contract ProdottoFactory { function foo() view returns(string nome){ return "foo"; } } And I want to test it ...
1
vote
1answer
55 views

Truffle test, logs do not include an emitted event

I am calling a contract function which emits an event in a transaction. This transaction should include the event and is typically visible via: const receipt = await contractInstance.someFunction() ...
0
votes
1answer
54 views

Mocking msg.sender during unit test [duplicate]

I am currently trying to push my unit testing far in order to achieve a complete coverage over my code. I am using Open Zepplin's Ownable.sol contract and I cannot find in the documentation something ...
0
votes
2answers
31 views

promise chaining in test.js file

it("should throw an exception if you try to buy an article that does not exist", function() { return ChainList.deployed().then(function(instance) { chainListInstance = instance; ...
1
vote
1answer
57 views

Unit test in truffle fails

pragma solidity ^0.4.23; contract adding{ uint256 public total; function add(uint256 val1,uint256 val2) public returns(uint256){ total = val1+val2; return total; } } The above code ...
0
votes
2answers
144 views

Running solidity-coverage with truffle gives error: can not find 'coverageEnv/migrations'

Running solidity-coverage gives the following error: $npm run coverage ... Writing artifacts to ./build/contracts Launched testrpc on port 8555 Running: node --max-old-space-size=4096 ../...
1
vote
1answer
42 views

fromAccount and web3.js

This is my function in solidity function transferForm(address _from, address _to, uint256 _value) public returns (bool success) { } Now i am calling the same function in test file for testing my ...
0
votes
1answer
57 views

Accessing Contract Variables from JS Unit Tests

I am having trouble unit testing my contracts: I am using Mocha, Chai and calling truffle test I am testing LoanRecord.sol contract LoanRecord { public bool on; ... constructor(...){ ... ...
0
votes
1answer
42 views

Truffle beta Contract.at is supposed to be a promise

I'm trying to test a contract with Truffle beta (because of the new web3 1.0.0 support). When i try to create the contract object by using Contract = artifacts.require("Contract"); contract = ...
-1
votes
0answers
18 views

Please correct or verify a migration structure

I've been working on the frontend of a dapp. After upgrading outdated truffle/react-box by starting from scratch (apparently right in time with updates to the box), some of my solidity tests were ...
0
votes
1answer
70 views

Vyper: Truffle test read mapping value inside struct

I have the following struct inside my vyper file: races: public({ start: timestamp, end: timestamp, racersBetHash: bytes32[address], racersBetAmount: wei_value[address] }[int128]) Then I ...
-1
votes
0answers
76 views

What causes Error: Returned error: Attempting to run transaction which calls a contract function

I'm trying to test my contract and I get 'Error: Returned error: Attempting to run transaction which calls a contract function' every time I'm running tests. I've seen question What caused this error: ...
-1
votes
0answers
13 views

Unstable transaction cost in truffle test

I've written few tests for my smart contracts based Web service. Everything seems to be fine, but there is one unstable place - transaction cost calculation. Sometimes test runs successfully (average ...
1
vote
0answers
27 views

How to run a test file (.go) from ethereum source?

I have download the ethereum source from github and store the source in directory "~/EthereumSource/go-ethereum". I have install all required software to build the source and successfully build the ...
0
votes
2answers
60 views

Contract state won't change during Truffle tests

I am trying to test my contracts using the Truffle suite, along with Ganache. Up until now, I have been testing contract functions which are restricted to view only. Now, when I attempt to make ...
1
vote
2answers
24 views

block.number during development

I am developing a code that verify if a period of time has passed. I do not need precision. Just to check if aproximately 1hour has passed. I am using block.number. But, I noticed that it is not ...
0
votes
0answers
33 views

Unable to run test cases truffle

I am using truffle tests for my smart contract.I guess there is no problem with contracts because I can compile and deploy them in Remix. I can also run truffle migrate --reset successfully, and it ...
0
votes
1answer
74 views

How do I access the owner's funds in the Truffle test environment?

I'm trying to test my simple coin-based contract in the Truffle test environment by sending funds to the first user's address. My understanding is that the contract is created (thereby calling the ...
1
vote
1answer
115 views

Unable to test Solidity Remix

I am writing my own smart contract in Solidity and trying to test in Remix. The main Remix site appears to be down (https://remix.ethereum.org/). I found another site: https://ethereum.github.io/...
1
vote
1answer
26 views

How could I check value and gas at Geth

My source below pragma solidity ^0.4.17; contract EtherBox { uint balance; constructor () public payable {} function SetBalance() public payable { balance = balance + 10; }...
1
vote
1answer
67 views

Contract call with ether and gas fails with revert

Testing with Truffle and solidity on localhost ganache network: Works: function dosomething(string a) { //do nothing } testing with: TokenFactory tf = TokenFactory(TokenFactoryAddress); ...
1
vote
1answer
52 views

Smart Contract execution time through Truffle

I would like to know if there is a way to obtain the smart contract execution time when you send it to the network through Truffle. Is it possible using the test tool? through an application? I know ...
0
votes
0answers
100 views

External js file not getting load in Truffle test

I'm writing up test cases for my smart contract. Here is the folder structure: - bin - build - contracts - mytestfile.sol - modules - mymodule.js - test - mytestfile.js truffle.js I want ...
1
vote
1answer
58 views

Getting storage array data from contract

I have a solidity contract which stores an array of Proposal information: contract Submissions { Proposal[] public proposals; struct Proposal { // .... } } In a test (using ...
1
vote
1answer
42 views

How can I use performance data on Rinkeby to project performance data on the Ethereum Mainnet?

I'm testing a DApp on the Rinkeby testnet, and want to know how well it would perform on the mainnet if I deployed it there, specifically how much gas was consumed by the DApp. Is there any way for ...
1
vote
1answer
444 views

What address deploys a contract in truffle test

I have a contract called AccessControl, in which the owner of the contract is set when it is deployed. I want to test that the method on it setCEO updates correctly, but in order to do this the ...
0
votes
0answers
87 views

Calling ERC223 both transfer functions fail

Given the contracts below (unnecessary code omitted), my tests fail when trying to call the ERC20 transfer() or ERC223 transfer() functions. Why is this happening? Both give Error: VM Exception while ...
1
vote
2answers
81 views

Solidity: fund a test contract

I'm trying to write a test suite in Solidity for a few contracts contained in a single script. I can't alter the code in the contracts - they're not written by me, and I don't have the rights. I would ...
1
vote
2answers
206 views

Obtaining addresses for tests in solidity

My contract has a function that allows only the contract owner to add another address to a mapping. How do I obtain the address of the contract owner that deployed the smart contract, and another ...
2
votes
3answers
122 views

Ethereum Deployment Problems

I deployed a private version of Ethereum on my laptop. I am using this code to deploy: geth –-identity "blockdb" –-rpc -–rpcport "9040" --rpccorsdomain "*" –-rpcapi "db,eth,net,web3" –-datadir "c:\\...
0
votes
0answers
29 views

Get performance measures from my private blockchain

I would like to get the performance of my private blockchain and I am not sure how to get the measures (as latency or the time of execution of a contract). Is it possible through Truffle or Geth?
-1
votes
1answer
44 views

Contract returns a hex value when a string is expected

I'm working with an ERC20 token and when I instantiate a new instance of it and try to receive its symbol in my tests, I receive a hex representation of the string. const contract = await ERC20.new("...
3
votes
0answers
77 views

Parity create testing transactions and blocks

For test purposes, I would like to make test blocks including test transactions against main net. For example I would like to make a transaction that sends one ether from 0x1234567... to 0x99999999......
0
votes
1answer
219 views

how to test the TPS in private blockchain

I have set up a private blockchain and I design a new block structure, I want to test the relationship between TPS and block size, are there already some test tools for this use?
0
votes
0answers
38 views

enormous costs for simple assignment with a signed transaction

I need help to sign a function call with my private key. When I try to send the signed transaction I'll end up with an error with enormous upfront costs: Returned error: sender doesn't have enough ...