Development on Va...
Follow
Find tag "Sinon"
9.6K views | +0 today
Development on Various Platforms
Your new post is loading...
Your new post is loading...
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Testable & Tested Client-side Code

Testable & Tested Client-side Code | Development on Various Platforms | Scoop.it

Testing (i.e. linting, unit tests, integration testing etc..) client-side code is not done as commonly as it should be. The reason it is so commonly not done, besides lack of know-how, is that it is presupposed that it will take time away from other more productive development tasks.

This fallacious notion is, of course, wrong. The repeatable successes in software engineering based on testable (i.e. modular, loosely coupled, small, simple units of code) and tested code has proven again and again to be a time-saver and part of creating maintainable and understandable code. At a minimum, if code is not unit tested it is only a matter of time before it is burnt down and re-written, or abandoned altogether because it becomes unmaintainable and incomprehensible.

In this article, I am going to defend and talk about testing client-side code. It is my intention that the information in this article will give those among us who do not test, the desire and some initial testing knowledge to test, along with the ability to defend its necessity from any agent that might deter testing.


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

How To Unit Test An Angular App.

How To Unit Test An Angular App. | Development on Various Platforms | Scoop.it

AngularJS has a great testing story - it’s all based on Dependency Injection, the Karma test runner was written by one of its core developers Vojta Jina and it ships with a variety of mocks like the $httpBackend for unit testing requests to remote services.

What I haven’t been able to find much of are examples showing how to take advantage of these features when testing an application that does more than just expose objects connected via a rest api.

Today we’re going to build a simple Tic-Tac-Toe game writing unit tests along the way.


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

An AngularJS Test Pyramid

An AngularJS Test Pyramid | Development on Various Platforms | Scoop.it

As a team with a strong taste for automated testing we focused from the beginning on how to test our Angular app. In this post we want to describe our different types of tests and how they form a Test Pyramid.

Level 4: Selenium Tests.
Level 3: E2E (Scenario) Tests.
Level 2: Directive Tests.
Level 1: Unit Tests.

For each kind of test, we will explain the following aspects:

* Purpose: What’s the idea behind this type of tests. When to use and what is being tested (the scope of the test). Principles how to write the test.
* Implementation: How does it look like in source code. Examples, technical issues.
* Our experience: Reflection about our specific experience. Some heuristic data.


Via Jan Hesse
more...
Ehab Roufail's curator insight, October 7, 2013 12:29 PM

Very similar approach to what we are adopting and have adopted recently.

Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Unit Testing AngularJS Controller Using QUnit and Sinon

Unit Testing AngularJS Controller Using QUnit and Sinon | Development on Various Platforms | Scoop.it

Angular JS is known for and is becoming increasingly popular due to its nature of testability. Angular’s in-the- box abstractions make any amount of code easily testable. Code written using Angular JS can be tested using any JavaScript unit testing framework out there, may it be QUnit, Jasmine, Mocha or some other library.


QUnit is a JavaScript unit testing framework developed by jQuery team. It is used in the projects like jQuery, jQuery UI, jQUery Mobile. QUnit is a very simple and generic framework that can be used to test any piece of JavaScript code. Unlike Jasmine, QUnit doesn’t have built-in support for creating spies. 

Sinon is a JavaScript library that makes the process of creating spies, mocks and stubs easier. It doesn’t depend on any other JavaScript library and easily integrates with any JavaScript unit test framework. Official site has a nice API documentation covering different features of the library. 


Via Jan Hesse
more...
No comment yet.