Created Test Driven Development (markdown)

Iuri Matias 2015-06-21 13:04:31 -04:00
parent 01a12116c7
commit 6f5aacde62
1 changed files with 31 additions and 0 deletions

@ -0,0 +1,31 @@
Tests
======
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.
```Javascript
# 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.
```