This workshop is designed specially for Queen Mary University of London alumni, in order to teach them TDD.
If you want to learn more: https://github.com/MyPitit/TDD
2. 1. What is Jasmine
2. How to set up Jasmine?
3. How it works?
4. Matchers
Agenda
3. 1. What is Jasmine
2. How to set up Jasmine?
3. How it works?
4. Matchers
Agenda
4. 1. What is Jasmine
• Jasmine is a Behaviour-driven Development (BDD)
• Jasmine is a framework for testing JavaScript
• It doesn't need the DOM
• Can run anywhere JavaScript can run
5. 1. What is Jasmine
2. How to set up Jasmine?
3. How it works?
4. Matchers
Agenda
6. 2. How to set up Jasmine?
• Go to: https://github.com/jasmine/jasmine/releases
• Download jasmine-standalone-2.4.1.zip
7. The zip file includes:
• SpecRunner.html file
• spec folder
• src folder
• lib
11. 1. What is Jasmine
2. How to set up Jasmine?
3. How it works?
4. Matchers
Agenda
12. 3. How it works
Jasmine tests are split up into suites:
• suites describe a group of your tests
• suites takes a string (with a description of your
tests) and a function which defines the tests.
13. Example of a suite:
describe("the function we're going to
test", function() {
// more code goes here
})
14. 1. What is Jasmine
2. How to set up Jasmine?
3. How it works?
4. Matchers
Agenda
15. 3. Matchers
- The different Matchers:
• toEqual
• toBe
- Example:
it("and has a positive case", function() {
expect(true).toBe(true);
});