10. Is a test running framework
Makes the browser interaction seamless
Works with various testing frameworks, not just
jasmine
KarmaKarma
formerly testacular
renamed because it resembles....
Let's see it live
11. Run in severalRun in several
browsers at oncebrowsers at once
karma-firefox-launcher
karma-chrome-launcher
karma-phantomjs-launcher
13. You might ask yourself, how the hell do IYou might ask yourself, how the hell do I
unit test this code:unit test this code:
<button onclick="addOne()">
Add one
</button>
<h1>0</h1>
function addOne() {
var count = $('h1');
var number = parseInt(count.text());
count.text(number + 1);
}
html
Javascript
14. Karma html2JS toKarma html2JS to
the rescuethe rescue
Load an html file in the current DOM
Test the javascript that interacts with it
18. How the test will look likeHow the test will look like
it('should bind h1 to count', function() {
$scope.count = 10;
$scope.$apply();
expect(h1.text()).toEqual('10');
});
it('should call add one on button click', function() {
button.click();
expect($scope.addOne).toHaveBeenCalled();
});
19. What about system testsWhat about system tests
with Selenium you ask?with Selenium you ask?
Good question!!
Follow our twitter for my
coming presentation on how to
make maintainable, readable,
and fast system tests.....
20. Our mediaOur media
Our presentations
Cool libraries & services
Interesting blog posts
Courses & workshops
@500TechIL
500Tech on facebook