You are previewing Web App Testing Using Knockout.JS.
O'Reilly logo
Web App Testing Using Knockout.JS

Book Description

Design, implement, and maintain a fully tested JavaScript web application using Knockout.JS

In Detail

As modern web applications grow in complexity and features, developers need tools and frameworks to deliver and maintain solutions with high quality standards. Knockout.JS is an emerging JavaScript presentation framework that promotes a solid solution design in combination with Jasmine, a well-known unit testing library. They both ensure rapid development and maintainability over time, and modification of requirements, reducing errors and addressing expected functionalities.

This book is a great starting point to meet all the most important concepts and frameworks involved in modern web application production. Every chapter sequentially introduces a library or a tool as a specific building block of the entire environment, proposing concrete examples and development considerations. By the end of this book, you will have a solid direction to follow when developing a web application, and you will also collect new hints and ideas to improve the delivery process of web applications.

What You Will Learn

  • Introduce and use Knockout.JS in a JavaScript web application as a presentation framework
  • Design a JavaScript web application using the well-known Model-View-ViewModel presentation pattern
  • Set up a simple testing environment with Jasmine
  • Unit test a JavaScript web application using the Behavior Driven Development approach
  • Adopt the correct development strategies to obtain the best results in terms of unit testing
  • Install and set up an automated testing environment using Node.JS and Karma
  • Execute unit testing and code coverage on development and minified production code
  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

    Table of Contents

    1. Web App Testing Using Knockout.JS
      1. Web App Testing Using Knockout.JS
      2. Credits
      3. About the Author
      4. About the Reviewers
      5. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      6. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      7. 1. Web Application Testing in the Modern Web
        1. Software testing
        2. The modern Web
        3. Escaping from the jQuery-style development
        4. Presentation design patterns
        5. Summary
      8. 2. The Knockout.JS UI Framework Explained
        1. Hello Knockout.JS
        2. Automatic synchronization between View and ViewModel
        3. The ViewModel in detail
          1. Observables
          2. Computed observables
          3. Observable arrays
        4. Data-binding in detail
          1. The data-binding syntax
          2. Text and appearance bindings
          3. Conditional and loop bindings
            1. HTML templating
            2. The binding context
            3. Virtual bindings
          4. Form controls bindings
          5. Custom bindings
        5. Summary
      9. 3. The Jasmine Unit Testing Framework Explained
        1. Unit testing style
        2. Hello Jasmine
        3. Suites and specifications
          1. Suites
          2. Specifications
        4. Setup and teardown
        5. Expectations and matchers
        6. Spies
          1. Spy initialization options
          2. Spy tracking properties
          3. An alternative spy initialization API
        7. Testing asynchronous code
        8. Summary
      10. 4. Unit Testing Strategies
        1. My Todo sample application
        2. The solution structure
        3. Idiomatic JavaScript patterns
          1. Constructor functions
          2. The module pattern
        4. MVVM and unit testing
          1. Effective separation between the View and ViewModel
        5. The My Todo web application
          1. The new to-do item form
          2. The event bus
          3. Managing services and third-party libraries
          4. The to-do item list
          5. The main page View
        6. Unit testing
          1. Integration testing
          2. Use case testing
        7. Summary
      11. 5. Setting Up an Effective Testing Environment
        1. The NodeJS ecosystem
        2. Task automation with GulpJS
          1. JSLint and unit testing
          2. The build system installation
          3. The build system configuration
        3. Unit testing automation with Karma (in GulpJS)
          1. The testing environment installation
          2. The testing environment configuration
          3. Code coverage
        4. User interface testing with PhantomJS
        5. Summary