Mocking Vuex in Storybook and Vue Test Utils

tl;dr: Scroll down to Conclusion immediately

  • In Storybook, each story is a new Vue app
    register Vuex plugin on Vue prototype
  • In Vue Test Utils, each test reuses the existing Vue constructor
    register Vuex plugin on local Vue instance

This blog post demonstrates how to set up a simple unit test and story for a component that is connected to a Vuex store. These components usually are smart/container components.

In my current project assignment I have the honor to help 4 teams starting to improve code quality and to release more often. Unfortunately there are not a lot of dumb components, which are easier to test and to write stories for.

There is no safety net (tests + stories) created yet, so refactoring is kind of risky. The perfect Chicken and Egg problem! How can I still test these components? How do I mock the Vuex store?

Read more →

FarmBot (Part 2): ‘Temporary’ raised bed

A couple of weeks ago we decided to continue building all FarmBot parts. After constructing these in large segments, we would assemble them together on top of the supportive construction, which was still missing.

To get more speed, I asked Sjuck – our house carpenter – to create a temporary solution made of wood. Since our motto still is Quality without Compromise, we were really happy when we saw the piece of art.

Read more →

Super fast unit test execution with WallabyJS

Our current AngularJS project has been under development for about 2.5 years, so the number of unit tests has increased enormously. We tend to have a coverage percentage near 100%, which led to 4000+ unit tests. These include service specs and view specs. You may know that AngularJS – when abused a bit – is not suited for super large applications, but since we tamed the beast and have an application with more than 16,000 lines of high performing AngularJS code, we want to keep in charge about the total development process without any performance losses.

Read more →

5 Reasons why you should test your code

It is just like in mathematics class when I had to make a proof for Thales’ theorem I wrote “Can’t you see that B has a right angle?! Q.E.D.”, but he still gave me an F grade.

You want to make things work, right? So you start programming until your feature is implemented. When it is implemented, it works, so you do not need any tests. You want to proceed and make more cool features.

Suddenly feature 1 breaks, because you did something weird in some service that is reused all over your application. Ok, let’s fix it, keep refreshing the page until everything is stable again. This is the point in time where you regret that you (or even better, your teammate) did not write tests.

In this article I give you 5 reasons why you should write them.

Read more →