-
Notifications
You must be signed in to change notification settings - Fork 488
Test Driven Development
Iuri Matias edited this page Jun 21, 2015
·
5 revisions
You can run specs with embark spec
, it will run any files ending *_spec.js under spec/
.
Embark includes a testing lib to fastly run & test your contracts in a EVM.
# spec/contracts/simple_storage_spec.js
EmbarkSpec = require('embark-framework').Tests;
describe("SimpleStorage", function() {
beforeAll(function() {
// equivalent to initializing SimpleStorage with param 150
SimpleStorage = EmbarkSpec.request("SimpleStorage", [150]);
});
it("should set constructor value", function() {
expect(SimpleStorage.storedData()).toEqual('150');
});
it("set storage value", function() {
SimpleStorage.set(100);
expect(SimpleStorage.get()).toEqual('100');
});
})
Embark uses [Jasmine](https://jasmine.github.io/2.3/introduction.html) by default, but you can use any testing framework you want.