1

This question already has an answer here:

How can I pass 2 groups to test?

Migrations:

var Group = artifacts.require('./Group');

module.exports = async function(deployer, network, accounts)
{
    await deployer.deploy(Group, "test 1");
    await deployer.deploy(Group, "test 2");
}

Test:

const Group = artifacts.require("./Group");

contract("Group Test", async accounts =>{
    it("Checking balances", async() =>{
        // how do I load two groups one by one?
        await Group.deploy();
    });
});

marked as duplicate by Ismael, GrandFleet, shane, Achala Dissanayake, Richard Horrocks Jan 10 at 7:02

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

You may deploy contract in test before all tests running:

const Group = artifacts.require("./Group");

contract("Group Test", async accounts =>{

    let group1;
    let group2;

    before(async () => {
        group1 = await Group.new("test 1");
        group2 = await Group.new("test 2");
    });


    it("Checking balances", async() =>{
        console.log(group1.address);
        console.log(await group1.callSomeMethod());
    });
});

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