16.07.2017 Views

AngularJS Essentials

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Unit Testing<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Running tests with Karma<br />

In comparison with the built-in Jasmine's HTML-based runner that we are using<br />

so far, there is another great option. Actually, one of the most reliable runners,<br />

compatible with Jasmine and many other frameworks, is Karma. It allows many<br />

kinds of configurations to define the testing framework, the files to be tested, and<br />

also the environment details such as the level of logging and the desired browser.<br />

Also, it could be integrated to our automated workflow.<br />

You would be interested and also excited to know that Karma was created by Vojta<br />

Jína, member of the <strong>AngularJS</strong> development team at Google. The tool is the result of<br />

his Master's thesis called JavaScript Test Runner, for the Czech Technical University in<br />

Prague.<br />

Installation<br />

Before installing Karma, you need to have the NodeJS already installed. It is a quite<br />

simple process, and you just need to visit their website, download the package, and<br />

proceed with installation.<br />

[ 140 ]<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!