Dockunit

Dockunit.io Beta Launch

Dockunit.io has officially launched in beta.

dockunit

Dockunit.io lets you run containerized continuous integration tests with the Dockunit tool. With Dockunit.io you can test your software (in any programming language) in environments (containers) you define. You can configure your software to be tested across a number of environments ensuring your software just works for people no matter how their system is configured. Each push and pull request to your Github repository will show a status of whether the tests passed or failed. With Dockunit.io you can more effectively deliver bug-free, quality assured code to your clients and the open source community.

Travis CI is the most popular continuous integration service. Why should you use Dockunit over Travis CI:

  • With Travis, you are stuck with the versions of each programming language and service that they want to support. For example, these are the supported versions of Node on Travis CI (as of today Travis isn’t supporting Node 4.1.0). With Dockunit you define your environments and therefore your programming language and service versions. No need to worry about Travis ending support for an older version you still want to test in.
  • Travis CI just started supporting Docker but the new system is cumbersome, difficult to use, and somewhat of an after thought. Dockunit.io is built for Docker.
  • Dockunit is meant to be run locally first so you don’t have to push changes to Github just to test a change in some obscure language version. This results in a more organized project and project workflow for your team. It is extremely difficult to test Travis locally.

Containerized integration testing is the future. Right now Dockunit.io is completely free. Give it a try on your project. Feedback is welcome 🙂

Standard
Command Line WordPress, Node.js, Unit Testing

Dockunit: Containerized Unit Testing Across Any Platform and Programming Language

Problem:

I want my application to work on all the environments I claim to support but I have no way of easily testing updates in each environment.

Bad Solution:

Continuously push to your remote to force Travis CI to test changes in multiple environments.

Good Solution:

Containerized unit testing with Dockunit.

Dockunit is a simple node command that lets you run your test framework of choice across a number of predefined containers. Each container can have it’s own test command and Docker image. It was born out of the need to ensure my PHP applications (WordPress specifically) were compatible with a spectrum of environments. Travis CI dropping support for PHP 5.2 was the final straw so I created this command for myself and decided to make it public.

Install/Usage Instructions for Dockunit

1. Ensure dependencies are met. See requirements on Github.

2. Install Dockunit

npm install -g dockunit

3. Setup project(s) with predefined containers.

To do this create a file called Dockunit.json in the root of any project you want to run Dockunit on. Github contains specific guidelines for how to write Dockunit.json files. Here is an example file for testing a WordPress plugin in PHP 5.2 FPM in WordPress 4.1, PHP 5.5 FPM in WordPress 4.0, and PHP 5.5 for Apache in WordPress 3.9:

{
  "containers": [
    {
      "prettyName": "PHP 5.2 FPM WordPress 4.1",
      "image": "tlovett1/php-5.2-phpunit-3.5",
      "beforeScripts": [
        "service mysql start",
        "bash bin/install-wp-tests.sh wordpress_test root '' localhost 4.1"
      ],
      "testCommand": "phpunit"
    },
    {
      "prettyName": "PHP 5.5 FPM WordPress 4.0",
      "image": "tlovett1/php-fpm-phpunit-wp",
      "beforeScripts": [
        "service mysql start",
        "bash bin/install-wp-tests.sh wordpress_test2 root '' localhost 4.0"
      ],
      "testCommand": "phpunit"
    },
    {
      "prettyName": "PHP 5.5 for Apache WordPress 3.9",
      "image": "tlovett1/php-apache-phpunit-wp",
      "beforeScripts": [
        "service mysql start",
        "bash bin/install-wp-tests.sh wordpress_test3 root '' localhost 3.9"
      ],
      "testCommand": "phpunit"
    }
  ]
}

3. Run Dockunit command.

dockunit

Note: This assumes you have changed directories to your project root. You may need to sudo.

Detailed command usage instructions can be found on Github. Contributions and bug reports are encouraged :).

Standard