Wallaby.js Blog
Integrated Continuous Testing Tool for JavaScript

Heroes of JavaScript and Testing

In 1995, Earth has become a JavaScript faring Federation. While colonizing new web technologies, humans have encountered an insectoid species known as “Bugs”. The bugs appear to be little more than killing machines, though there are suggestions that they were provoked by the intrusion of humans into their habitats.

I have taken a few lines from the “Starship Troopers” plot summary, but it sometimes feels like comparing to the Federation tech, we are still like medieval knights with our JavaScript weapons. Especially when killing bugs, or doing automated testing.

Hail fellow, I bid thee welcome, and ask you to join my journey to the cellars of the JavaScript testing armory.

Clubs

Our great ancestors, who stood shoulder to shoulder against the first bugs, used alert. Legendary spiked club, it crushed many simple enemies.

It’s glorified version console.log, or a morning star, is used nowadays. It may cause some confusion in enemy rear areas, but is not good enough to be used as a systematic approach for significant size battles.

Swords

Testing frameworks, or swords, are the main weapons in our merciless fights.

QUnit, or the Gladius. Quite old and oddly looking to some modern knights, it covered itself with glory in jQuery lands. Used to be, and for many remains, a very fearsome weapon.

Jasmine, or the Great sword. Large and two-handed sword in a sense that you don’t need anything else in your hands. It comes with the expectation framework and out-of-box mocking support. What else does a good knight need to kill a dozen or two of bugs with?

Mocha, or the Arming sword. Being simpler, smaller and faster, it allows to carry something else, such as an assertion library of your choice to make your bug enemies look miserable. Not only the sword can be you best friend in the land of JavaScript, but also in the Seas of Node.js.

Shields

Various application frameworks are like shields. Many knights love sitting around the Round Table of Internet and debate days and nights which shield is better. For smaller battles, you may be fine without it or with your own one. For larger battles, some good and tested by other knights shield will better protect you from certain bugs.

Siege engines

Browser automation tools and E2E testing frameworks, like Selenium, WebDriver, Protractor, etc. are the siege engines of testing. Like catapult, ballista or trebuchet, they are bulky, slow and hard to set up. Nevertheless, when up and shooting, will do a good job in destroying the enemy’s rampart.

Armour

Code editors is our armour, that’s what we spend endless battles with bugs in. Blacksmiths from different kingdoms all over the world are doing the great job to satisfy any knight’s taste.

Some armour is heavy and large but solid, some is smaller and more lightweight but may require a few patches here and there.

We have a very sublime armour from one humble blacksmith, some solid merchandise from the JetBrains guild, a couple of nice sets from the Microsoft kingdom, elegant armour from the GitHub’s forge and even ancient Dark Elvimn one.

Magic

JavaScript is the main language we, mighty knights, speak. However, many of us have learned to record our wisdom in other languages and dialects. From far away lands of C# and Ruby, TypeScript and CoffeeScript came to help us in our war. From across the Seas of Node.js, CommonJs reinforcements have arrived. Even within our homeland, the language evolves and we more often hear minstrels singing glorious tales in ES6 or ES7.

In order to make it work against our enemies, we need some magic. Opening a scroll with a good TypeScript or ES7 spell and using it together with a potion of Babel Transpilation, sorcery of Webpack and Browserify or witchcraft of require.js, we make even our strongest bug enemies shake in fear.

Squires

Squires, or testing tools - are our humble servants. They more or less know your weaponry and armour, your spells chest content. Some ascetic knights can travel and fight without them, but normally a knight has a few.

Grunt and Gulp, brothers from one mighty but peaceful clan, with a few less known relatives. The brothers are strong and brave, and can even run your tests, but they were born to build your castle, not to slay bugs.

HTML test page. Easy and responsive chap, but a bit dumb and you need to poke him to make him work. You need to tell him what to do (add your scripts and tests) and when. Page refresh driven development in all of its beauty.

JSTestDriver. Old man from the Google kingdom. Hard-working and with Java in his heart, he had spent his best years running our countless tests. Knows when to run your tests, certain armour types friendly.

Karma. JSTestDriver’s son, who has taken the best from his father. Supports some armour types, very open fellow. As his father, Karma knows when to run your tests, but has no idea what tests to run, so just runs them all. It makes him perfect for some smaller battles, but he is a bit slow for medium and especially large ones. Also, Karma can’t swim the Seas of Node.js.

Wallaby.js. Highly skilled mercenary, specially trained to continuously kill bugs and do it fast. Not only he knows when to run your tests, he also knows how to run only those that are affected by your changes. Proficient with pretty much every weapon, shield and magic type listed in the article. Knows how to mix them well, more than just friendly to certain armour types. For a few gold coins in the nearby tavern you may get yourself a great helper for a battle of any size.

Fare thee well, mighty knights! Choose your weapons wisely and let there be no mercy for the bugs.