Posts tagged with mocha

  • Adding mocha unit tests

    Dec 29, 2017

    In this post, I’ll add unit tests to the example application that I’ve been fiddling around with in the recent posts.

  • Functional Testing - Hiding Async

    Aug 6, 2016

    In the previous post, we explored the Page Object pattern and rewrote our tests to use this technique. Sometimes, it can be that the tests appear to be a bit verbose due to the usage of promises. Additionally, promises and asynchronous programming in general can be somewhat confusing to developers. Let’s see some ways of making the tests shorter and easier to read.

  • Functional Testing - Dealing with failed tests

    Jul 23, 2016

    In the previous post, we wrote some functional tests and we encountered our first failing test. Let’s see how we can go about investigating these failures, both on a developer machine and during continuous integration.

  • Functional Testing - First steps towards a framework

    Jul 9, 2016

    Before we go any further, let’s take a break and add a bit of a structure to our functional tests. This will allow us to reduce the code we have to write for each test. We’ll also start thinking about how to organize the tests into folders and files.

  • Functional Testing - Reducing Code Duplication

    Jul 2, 2016

    Let’s continue our functional testing examples by adding a few more tests. This will demonstrate why we need to start thinking about the structure of our tests and why we should be developing a framework that will allow us to write less code. Let’s add one more test. We already have a test that verifies Google’s homepage title. We’ll do the same for Yahoo’s homepage. By the way, maybe it goes without saying, but normally you would be verifying your own site, during development and CI.

  • Functional Testing Hello World

    Jun 25, 2016

    Let’s have a look at a first example of writing and running a functional test. This is going to be a very basic hello world example, but still it gives an opportunity of looking at the bare minimum usage of WebDriverIO and a first taste of asynchronous programming with promises.

  • Using sinon stubs

    May 28, 2016

    In the previous post we had a look at sinon spies. With spies, we are able to determine if a specific function was called or not. Usually the dependencies between units are more interesting, they involve units co-operating, exchanging data and so on. Spies do not suffice. Let’s have a look at another technique, using stubs.

  • A closer look to a basic unit test

    Apr 23, 2016

    In the previous post we started writing a basic Calculator class and added the first unit test. Let’s have a closer look at that unit test and extend our calculator with more features.

  • Adventures with automated browser tests in JavaScript

    Feb 4, 2016

    This is a long post, be advised! It goes through the adventures we have had at work with automated browser tests in JavaScript. It has been a journey full of challenges and knowledge build up, a journey that still goes on!