Book Image

JavaScript Mobile Application Development

Book Image

JavaScript Mobile Application Development

Overview of this book

If you are a native mobile developer, with some familiarity with the common web technologies of JavaScript, CSS, and HTML, or if you are a web developer, then this learning guide will add great value and impact to your work. Learning how to develop mobile applications using Apache Cordova is of particular importance if you are looking to develop applications on a variety of different platforms efficiently.
Table of Contents (10 chapters)
9
Index

Automating tests using Karma


Running Jasmine tests manually by running SpecRunner.html on every browser can be a time-consuming process; this is why automating Jasmine tests is important. In order to automate Jasmine tests, we can use Karma (http://karma-runner.github.io).

Karma is one of the best modern JavaScript test runners that can be used to automate JavaScript tests. Karma is based on Node.js and is distributed as a node package. Karma provides an easy-to-use command-line interface that we will illustrate in detail in the following sections.

Karma includes a web server that can capture one or more browser(s), execute JavaScript tests on the captured browsers, and finally, report the test results of every browser in the command-line interface. In order to capture a browser in Karma, you can execute one of the following two methods:

  • Make the browser(s) that you want to capture visiting Karma server URL (usually, it is http://${karma_server_ip}:9876/).

  • In the configuration file, you can...