Posts

AngularJS E2E Testing with Protractor

In continuation to  AngularJS series , today we'll discuss e2e or end-to-end testing of AngularJS applications. If you've been following the blog for a while, you must have noticed my numerous stressing the importance of unit testing using Jasmine and Karma and automating JavaScript testing with Grunt.js . The only thing left behind was e2e testing, of which we would talk today using Protractor for AngularJS applications. What is E2E Testing? End-to-end testing is a methodology used to test, whether the flow of an application is performing as designed from start to finish. The purpose of carrying out end-to-end tests is to identify system dependencies and to ensure that the right information is passed between various system components and systems. In contrast to unit testing, which verifies the correct behaviour of various components separately, end-to-end testing verifies the entire flow of the application. From front end development perspective, it will be check...

Publish-Subscribe Pattern with Postal.js

Image
Last week we talked about testing JavaScript Testing with Jasmine  and today I'd like to continue our conversation about testing rather from different angle - separation of concerns . Once the code slips developers' fingers, it is hard to find time and strength to rewrite, it making it more testable. What works, may never be rewritten, sounds a bit like Iron island refrain  What is dead, may never die :) Hmm - sorry for that! Nearly all today's applications have some calls to somewhere to retrieve the data. Front side retrieves from the server. Server side retrieves from services or database. Some manipulate it, others just format it and present as it is. Take a look at the following examples: function someLogic() { $.get("ajax/test.html", function (data) { $(".result").html(data); }); } function someLogic() { dataManager.getClients(function (err, data) { if (!err) { doSomething(data); } }); } How can you test it? First of all th...

D3 Data Visualization Library

Data visualization is the study of the visual representation of data, meaning "information that has been abstracted in some schematic form, including attributes or variables for the units of information". In the end everything we do, needs to be somehow presented to the users. Fortunately, we humans are intensely visual creatures. Few of us can detect patterns among rows of numbers, but even young children can interpret bar charts, extracting meaning from those numbers’ visual representations. For that reason, data visualization is a powerful exercise and is the fastest way to communicate it to others. What is D3? D3 is a JavaScript library, which helps in manipulating documents based on data. It uses HTML, SVG and CSS to create visualizations. With D3.js, the complete capabilities of new-age browsers can be used without being constrained to a framework. Fundamentally, D3 is an elegant piece of software that facilitates generation and manipulation of web documents ...

JavaScript Testing with Jasmine

For years, JavaScript developers checked their code by amm uhmm - exactly, they didn't. The QA, if there was one, tested the overall UI end to end. However no one really checked the code as it was accustomed with server side languages. Later testing frameworks started to emerge. QUnit  pioneered the domain, which was followed by Jasmine  and in the end Mocha appeared. All these framework matured with time and became standard in the industry. Nowadays, there is absolutely no excuse for JavaScript developer to write a code without writing the tests. Which one? As I've mentioned, currently there are three frameworks, which are mature enough to be considered by us. I personally prefer Jasmine over others, since it's already packaged with test double function  (spy) and assertion framework and offers fairly headless running. For those who prefer configuring different aspects and implementations of your testing framework should look at Mocha. Moreover have a look ...

Bower and Require.js Integration

In the past we've talked about Bower package manager and God knows, I have been obsessively repeating myself about using Require.js  and it's integration with object oriented programming . So how do they integrate with each other? In this article we'll cover the integration of both and see how they get along together. Bower Initiation Let's start by defining, which packages we want to use in our project by filling the bower.json . You can create one yourself or run bower init command for interactive creation. { "name": "RequireJS Starter", "version": "1.0.0", "dependencies": { "jquery": "1.9", "underscore": null, "requirejs": null } } So we'll be needing jQuery, Underscore and of course Require.js. Putting null as a version number will download the latest version. Now run bower install to download all the packages into bo...

CSS and JavaScript Live Editing

Image
As planned we're continuing our tradition to present JavaScript Developer Toolkit. Last time we've talked about Emmet and today's article I'd like to devote to HTML/CSS/JavaScript editing. How often do you change your CSS rules and JavaScript within your browser? How often do copy/paste the changes made into appropriate resource files? It's time to do this Zen style. IDE integration This is my preferable way to develop and live-editing the changes. Let me show you why. Wouldn't it be cool if you could develop using your beloved IDE with all the neat plugins it offers and see the changes reflected live in the browser? Well - you can, with both Sublime Text and Webstorm we've talked about during our previous JavaScript toolkit article . You do this by installing JetBrains IDE Chrome  extension for Webstorm: or Emmet LiveStyle for Sumblime Text: Look into their sites and see how properly things should to be configured. Both tools only of...

Python for Data Scientists - SciPy

Image
Introduction This article continues the Python for Data Scientists series by talking about SciPy . It is built on top of NumPy, of which we've already talked in the previous article . SciPy provides many user-friendly and efficient numerical routines addressing a number of different standard problem domains in scientific computing such as integration, differential and sparse linear system solvers, optimizers and root finding algorithms, Fourier Transforms, various standard continuous and discrete probability distributions and many more. Together NumPy and SciPy form a reasonably complete computational replacement for much of MATLAB along with some of its add-on toolboxes. Installation Installation of SciPy is trivial. In many cases, it will be already supplied to you with python distribution, or as usual may be installed manually using python package manager pip install scipy Depending on the running OS, you might be needing to install gfortran ...