Book Image

WEB APP TESTING USING KNOCKOUT.JS

By : Roberto Messora
Book Image

WEB APP TESTING USING KNOCKOUT.JS

By: Roberto Messora

Overview of this book

Table of Contents (11 chapters)

MVVM and unit testing


When we decide to use a presentation pattern as the most important pillar of a software solution, we are also establishing a specific direction to follow in developing the application.

We need to understand that if we decide to adopt Knockout.JS, it is because it grants us some important concrete advantages, not because we have to simply choose one of the many JavaScript frameworks out there.

In Chapter 2, The Knockout.JS UI Framework Explained, we talked about one of the advantages: a clear separation between the user interface and presentation logic. Why is this a real benefit? There are several possible answers, but if we want to remain in the unit testing context, we can apply proper unit testing specifications to the presentation logic, independent from the user interface.

In MVVM, the ViewModel is a pure-code representation of the View. The View itself is (must remain) a thin and simple layer, whose job is to present the data and receive the user interaction. This...