Jasmine Testing Tips

If you are developing web application and you are working on client side, I hope you write unit tests or test automation or even both like we do. The following tips might be helpful if you write your tests using Jasmine and execute it with Karma or Protractor.

I guess you already know that if you want to disable a specific test you can add “x” before describe or it statements?

1
2
3
4
5
xdescribe('my beautiful function', function() {
 xit('having fun', function() {

 });
});

Did you also know that if you add “d” before describe or “i” before it, it will run only this specific test and skip the others?

1
2
3
4
5
ddescribe('my beautiful function', function() {
 iit('having fun', function() {

 });
});

This is especially helpful when you need to focus on debugging specific test.

Hope you liked it. If you have more tips to share, please do.