Acceptance Testing for Web App

I'd like share an approach we use at Qubell to ensure quality of our product. A set of practices that allows us to use Acceptance Testing in simple and efficient manner.

Note: this article is my personal opinion and can't be associated with Qubell's official view on the matter in any way.

Test Case

Let's try to express the test case with plain english first. A little about the product itself

  • the Qubell Platform simplifies deployment. You write requirements for your Application, hit the launch button - and your Application get delivered into production.

On the screenshot below you can see list of sample applications.


Making Crawler Fast and Reliable

So, as I told in the previous article - the basic version of the Crawler worked well and proved to be usable. The problem - it was slow and unstable.

To make it fast we need to run it on multiple machines (about 5 - 20). And to make it stable we need to figure out how to make reliable system from unreliable components.

The unreliable component - Crawler uses Browser Emulator (Selenium) with enabled JavaScript to properly render content of sites. And it consumes lots of resources and frequently crash and hangs (it is not very stable by itself and what's worse - there maybe invalid HTML or JS on different sites that can crush or hang it).

Going distributed

Multiple machines instead of just one make things a bit complex because couple issues arise:

  • Provisioning and deployment couple of tens of machines. I don't want to do it by hands.
  • Handle crashes of machines and heal after it. Crawler should be robust and continue to work if one of its nodes crashes, and pick it up again when this node get fixed or new node get added.
  • Detect if one of its nodes hanged and need to be rebooted.


Crawling JavaScript Sites

Recently finished project - Web Crawler for JavaScript sites. It crawl eCommerce sites and collects information about the products. You can see parsed products for one of such eCommerce sites below.

Usually crawlers browse site pages, collect HTML from it, parse and extract some data.

But, in our case we can't use such approach - because sites we are interested in aren't usual sites. There are no any useful data in HTML sent by server, because they rendered using JavaScript in the Browser. And to parse such sites you need full Browser with working JavaScript Engine.

Browser Emulator


Ruby on Rails vs Node.js

I wanted to see benchmark that more or less close to real life, not just measuring how fast it can stream data via http.

So I created application that query some text from remote HTTP service (service delays each request for 200ms) and render HTML page using that text.

It simulates how Web Framework performs when it needs to wait for response from DB or other services, how fast its templating engine is and also how fast it is itself.

And hit it with wrk -t2 -c100 -d10s http://localhost:3000 you can see results on the picture.

Benchmark Ruby on Rails vs. Node.js

3782 vs. 2914 hits, average response time is also very close.


Cart Widget

Created simple Cart Widget that can be included into any HTML page and turn it into Shop.

There's also tutorial and screencast explaining development step by step

Cart Widget


Prototyping Mobile Web Application

We decided to spend one evening prototyping very simple and small but unusual thing for our product.

I choose to build very basic mobile prototype. Actually our app is already responsive and can work on mobile devices, but it doesn't looks very good. I wanted it looks like a native application.

It took me about 4 hours to build this prototype (Backbone, Ratchet and CoffeeScript), you can see it live here code on GitHub.

Prototyping Mobile Web Application


Client-Side QA

Video (russian language) and slides.

Presentation was short and I didn't have a time to cover many interesting things like testing strategy, named scopes and matchers.

I'll try to add additional materials and code samples in next months, slides are below.


Node.js not suitable for general web development

Had a quick look at Node.js usage in production.

In most cases Node.js isn't used as a web framework for the core web product. It's used for additional specialized API or real-time extensions.

From my subjective experience with Node.js web frameworks - it's about the level of Ruby Sinatra. None of node.js web frameworks even closely compared to Ruby on Rails. Nor in terms of functionality nor in development productivity.

So, it seems for me that Node.js isn't suitable for general web development. It's a good fit for API, but not for web site or web applications (online project management and so on.).

And that's sad news, because I believe it has all features needed to build rich and high productive web framework like Ruby on Rails (Fibers can be used to mitigate callbacks).

Still, even if productivity with Node.js is less than with Ruby on Rails it's better than with Java web frameworks.

UPDATE 2014/2/4

As I said before:

I believe Node.js has all features needed to build rich and high productive web framework like Ruby on Rails

So, here it is -


Functional Mixins in JavaScript

Functional Mixins is a flexible way to share functionality between objects.

From my experience it's more powerful than Class or Prototype based Inheritance, Mixins and even complex machinery like Ruby Object Model. But I believe the biggest advantage of it isn't the power but the simplicity, it's so simple that I wonder why it's so rarely used.

In this example we create Game Unit and add some basic functionality to it (source).

Creating simple Model

Defining Model that have only two methods - set to set attributes, and initialize - a constructor supporting setting attributes.