Jasmine - Behaviour-driven Development
-
Upload
mireia-sangalo -
Category
Software
-
view
93 -
download
0
Transcript of Jasmine - Behaviour-driven Development
Jasmine
by Mireia Sangalo
@MyPitit
1. What is Jasmine
2. How to set up Jasmine?
3. How it works?
4. Matchers
Agenda
1. What is Jasmine
2. How to set up Jasmine?
3. How it works?
4. Matchers
Agenda
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
1. What is Jasmine
2. How to set up Jasmine?
3. How it works?
4. Matchers
Agenda
2. How to set up Jasmine?
• Go to: https://github.com/jasmine/jasmine/releases
• Download jasmine-standalone-2.4.1.zip
The zip file includes:
• SpecRunner.html file
• spec folder
• src folder
• lib
SpecRunner.html
SpecRunner.html
Hands on!
https://github.com/FAC-QMUL/TDD/tree/master/TDD/Jasmine
1. What is Jasmine
2. How to set up Jasmine?
3. How it works?
4. Matchers
Agenda
3. How it worksJasmine 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.
Example of a suite:
describe("the function we're going to test", function() {
// more code goes here
})
1. What is Jasmine
2. How to set up Jasmine?
3. How it works?
4. Matchers
Agenda
3. Matchers- The different Matchers:
• toEqual
• toBe
- Example:
it("and has a positive case", function() {
expect(true).toBe(true);
});
Hands On!
Questions?