Skip to content

TestCoders/testcoders-blockchain-meetup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

testcoders-blockchain-meetup

Build status master

Getting started

Make sure you have truffle and testrpc installed

npm install -g truffle ethereumjs-testrpc

cd into the repository directory and run the following command to create build artifacts for the smart contract:

truffle deploy

after that, you can run the tests using the following command:

truffle test

Create smart contract

truffle create contract HelloWorld

Example contract

pragma solidity ^0.4.4;

contract HelloWorld {
    string message = "Hello World!!";

    function HelloWorld() {
        // constructor
    }

    function GetMessage() returns (string) {
        return message;
    }
}

Creating tests

truffle create test HelloWorld

Example test

const HelloWorld = artifacts.require('./HelloWorld.sol');

contract('HelloWorld:GetMessage', (accounts) => {
  it('Should return a correct string', async () => {
    const contract = await HelloWorld.deployed();
    const result = await contract.GetMessage.call();
    assert.isTrue(result === 'Hello World!!');
  });
});

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published