by Sreenath Nannat (@sreenathn) on Tuesday, 31 December 2013

+11
Vote on this proposal
Status: Confirmed & Scheduled
View session in schedule
Section
Workshops

Technical level
Intermediate

Objective

This workshop is for giving a head start on faster, maintainable and behavioural tests for AngularJS using the Jasmine Test Framework and Karma test runner. At the end of the session, the attendees should be able to:

  • Learn about basic unit testing.
  • Use Jasmine and Karma for writing and running tests.
  • Write tests for Angular Routes, Directives, Factories and Controllers.
  • Get an overview of Grunt and Bower.

Description

Writing tests has definite benefits especially in long term. But if we don’t have the right environment and tool set, it can be less fun and frustrating too. In this workshop we will be focusing on setting up the right environment with the right tools which makes test driven development enjoyable and sustainable.

Unit testing is made really easy in AngularJS because of its dependency injection, which allows us to isolate different parts of the system and write unit tests for each of them. We will be using Jasmine as the testing framework and Karma as the test runner.

Jasmine is the most popular unit testing framework for writing behavioural tests. It resembles RSpec, the popular testing framework in the Ruby On Rails world. It comes up with set of helper methods which wraps out all the mundane things, especially the test setup, and helps us focus on testing. Also, it has a pretty clean syntax which helps learning faster.

Karma is a test runner which basically facilitates running tests in our preferred environment, a real browser or a headless browser like PhantomJS. The best part is that it will blend well with most of the major Continuous Integration servers such as Jenkins, Travis etc..

We will also cover tools such as Bower, Grunt, which helps us to run the tests frequently to give us quick and frequent feedback, which is mandatory for unit testing.

Angular JS makes it easy to write unit tests and acceptance tests, But in this workshop we will be covering only unit testing in Angular.

Requirements

  • Familiarity with Angular JS and Test Driven Development is Preferred.
  • Laptop with your preferred IDE. We will be using Sublime.
  • Git
  • Node.js
  • NG-boilerplage - We prefer this to kickstarting the AngularJS Dev setup including the tools required for TDD

Speaker bio

Leena is the Head of Engineering @ Multunus. She was bitten by the TDD bug a couple of years ago. Having done enough TDD in Ruby/Rails, Javascript and Android, she's moved onto Continuous Delivery (CD) in a big way - even spoke about CD at DroidCon India 2011 and AgileIndia 2012. She had conducted a workshop on TDD on Android as part of DroidCon India 2013.

Sreenath is a Product Developer @ Multunus. He has experience in technologies like Ruby/Rails, Rubymotion, Javascript and Android. He has been doing TDD with Backbone JS for some time and recently been smitten by AngularJS & has since then dedicated himself to it. He is busy capturing the world in his camera when he’s not coding.

Comments

  • 1
    [-] Arpan CJ (@arpancj) 3 years ago

    This is an important topic and there is interest in this workshop. But I feel like this is a little too specific for MetaRefresh, since there will be a lot of designers & developers who haven't used Angular, and so this workshop will not be relevant to them.

    I'd suggest that you submit this same proposal for JSFoo, it would be a much better fit there.

  • 1
    [-] Leena S N (@leenasn) 3 years ago

    Hi Arpan,

    I do agree that it might be a good fit for JSFoo. But the reason why we submitted this for MetaRefresh is because TDD is a very key aspect for automation and strongly believe that the awareness in the community to be improved a lot. And because of the same, in my opinion, we should consider this especially if there is enough interest from the community.

    We would be really glad to do it again for JSFoo :)

    Thanks,
    Leena

  • 1
    [-] Leena S N (@leenasn) 3 years ago (edited 3 years ago)

Login with Twitter or Google to leave a comment