Chapter 7. Unit Testing the Cordova App's Logic

In this chapter, you will learn how to develop JavaScript unit tests for your Cordova app logic. In this chapter, you will:

  • Learn the basics of the Jasmine JavaScript unit testing framework
  • Use Jasmine in order to test both synchronous and asynchronous JavaScript code
  • Utilize Karma as a powerful JavaScript test runner in order to automate the running of your developed Jasmine tests
  • Generate test and code coverage reports from your developed tests
  • Automate your JavaScript tests by integrating your developed tests with Continuous Integration (CI) tools

What is Jasmine

Jasmine is a powerful JavaScript unit testing framework. It provides a clean mechanism to test synchronous and asynchronous JavaScript code. It is a behavior-driven development framework that provides descriptive test cases, which focus on business value more than on technical details. As it is written in a simple, natural language, Jasmine tests can be read by nonprogrammers and provide a clear description when a single test succeeds or fails and the reason behind its failure.

Tip

Behavior-driven development (BDD) is an agile software development technique introduced by Dan North; it focuses on writing descriptive tests from a business perspective. BDD extends TDD by writing test cases that test the software behavior (requirements) in a natural language that anyone (does not necessarily have to be a programmer) can read and understand. The names of the unit tests are complete sentences that usually start with the word "should," and they are written in the order of their business value.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.172.115