Im trying to make some test using the remix test library. I create a VM with a Ubuntu Server 18.04 I update the system to latest version and I install npm and node.

I generate a folder with the following files according to the web page example

enter image description here

Inside test.js I have write this piece of code:

const RemixTests = require('remix-tests');

remixTests.runTest(simple_storage_test.sol, contractObj, testCallback, resultsCallback);

I have many doubts

  1. params like contractObj, testCallback, resultsCallback i think that I have to change. What is the expected value according to my files?

    2.Once this is executed I have some result file or just appear in the terminal screen?


remixTests.runTest will run the tests mentioned in the test file and pass some arguments to the callback as explained here. You can then use the callback to console.log or do something else based on the inputs to the callback function:

passingNum - number of passing tests

failureNum - number of failing tests

timePassed - time it took for all the tests to run (in seconds)

hope this helps.

  • The value of contractObj, testCallback, resultsCallback where can I find? – UnexpectedCharacter Jun 25 '19 at 10:02
  • 1
    It is mentioned in the Readme that cotractObject is the web3.js 1.0 contract instance. You can read more about contract instance here:web3js.readthedocs.io/en/1.0/web3-eth-contract.html. The testCallback and resultsCallback are functions you have to define. testCallback is a function that will be called everytime there is a test event. resultsCallback is a function that is called at the end of all the tests as described above. – Sanjay S B Jun 25 '19 at 10:16
  • Nice, thank you for the infor – UnexpectedCharacter Jun 25 '19 at 10:37
  • You know about some explained example. I mean, instead of the expected parameter explanation. Something with a real implementation. – UnexpectedCharacter Jun 25 '19 at 10:50
  • 1
    Sorry I couldn't find any example of using. I will try and come up with an example asap. I am a bit busy now. – Sanjay S B Jun 27 '19 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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