Support files, eBooks, discount offers, and more
You might want to visit www.PacktPub.com for support files and downloads related to your book.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at > for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
http://PacktLib.PacktPub.com
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books.
Why Subscribe?
- Fully searchable across every book published by Packt
- Copy and paste, print, and bookmark content
- On demand and accessible via web browsers
Free Access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.
Preface
JavaScript was first released about 20 years ago. It had not been taken seriously by a wide audience for many years. Today, it is a mature (and the most popular) programming language. Whatever is done for the Web, one way or another, relies on JavaScript. Furthermore, with the advent of HTML5-related technologies, the development focus is shifting even more towards rich internet application architecture. That means further expansion of sophisticated scalable solutions based on JavaScript. The server-side JavaScript is rapidly gaining its momentum, thereby giving automated testing of JavaScript.
QUnit is a freakishly easy-to-use JavaScript testing framework at the same time, it is quite powerful and flexible to be a good choice for unit and functional testing of any scale projects.
This book provides a step-by-step guide to mastering QUnit. It shows how to set up and use QUnit, how to automate cross-browser testing with QUnit, and how to benefit from QUnit in cooperation with continous integration tools.
The goal of this book is to help the reader make the most of QUnit in a short amount of time.
What this book covers
Setting up QUnit (Simple) explains setting up a testing environment and getting acquainted with the QUnit framework.
Testing assertions (Simple) describes a tutorial on QUnit assertion methods and popular QUnit assertion plugins.
Writing a custom assertion plugin (Advanced) explains leveraging QUnit callbacks for a custom assertion plugin.
Testing exceptions (Medium) describes custom exceptions in JavaScript and asserting exceptional behavior.
Testing asynchronous calls (Medium) describes asserting asynchronous callbacks and mocking XHR for in-unit testing.
Organizing test cases (Simple) examines QUnit facilities to keep tests logically organized.
Using shared setup (Medium) describes a way to share tasks among the tests of a group and keeping the testing environment clean between test executions.
Testing user actions (Medium) explains exercising functional testing on a simple calculator application by simulating end-user actions and asserting intended behavior.
Running QUnit in the console (Advanced) explains running QUnit tests in the command line by the PhantomJS headless browser. It also explains assigning QUnit testing tasks to Grunt and automating testing with Travis CI.
Cross-browser-distributed testing (Advanced) explains automating client-side cross-browser testing using the command-line tool Bunyip.