Example Jasmine Test Suite
describe('This is my test suite', function () {
var testObject;
beforeEach(function(){
testObject = new TestObject();
});
it('This is my test', function(){
expect(testObject.doSomething()).toEqual('Some Value');
});
});
Jasmine | JUnit | Spock |
describe | TestCase | Specification |
Describes a feature of an application and can be nested inside on another.
|
beforeEach | @Before / setUp() | setup() |
Piece of code run before each test used to initialize testing objects.
|
it | @Test | <test function>() |
Runs one test of the larger test suite. Contains a test name and a function.
|
expect & (toEqual(), toBeTruthy(), etc) | assert*() | Any conditions in an expect: block |
Conditions to check during the test.
|
afterEach | @After / tearDown() | cleanup() |
Piece of code run after every test to tear down or destroy any testing objects. |
No comments:
Post a Comment