Introduction Test code needs to be both run by computers and read by humans. It therefore needs to be well-factored and use the domain language. At the end of this tutorial, you will have seen how you can use use RSpec‘s custom matchers to write better tests that are DRY, quick to write and easy […]
Category Software Engineering
How to Set Up a Clojure Environment with Ansible
Introduction In this tutorial, we will walk through the process of setting up a local environment for Clojure development using the Ansible configuration management tool. Ansible and Clojure are a perfect fit, as both place an emphasis on simplicity and building with small, focused components. While we will not cover the Clojure development process specifically, […]
How to Use Capistrano to Deploy a Rails Application to a Puma Server
Introduction Deploying a Ruby on Rails application involves a number of steps, such as copying source code files, running database migrations, pre or post-compiling assets and restarting the web server. Our goal as developer should be to automate this procedure down to a single command we can run at any time. There are tools that […]
Applying BDD to Ruby on Rails Web Applications
Introduction Behavior-driven development (BDD) is a software development practice of working in a short feedback loop, where we consistently apply test-driven development to every new feature we are exploring and working on. For a detailed introduction to the practice of BDD, you should read our article Behavior-driven Development. This article focuses on applying these principles […]
Automatic Security Testing of Rails Applications Using Brakeman
Introduction Brakeman is a tool that scans a Ruby on Rails application for common vulnerabilities. It’s a static code analyzer that can help you find security problems before you release the application. Since you can introduce a vulnerability at any stage of you development process, it’s obvious that Brakeman should scan your application as often […]
Unit Tests for Chef Cookbooks With ChefSpec
The Agile movement brought many fresh ideas which enriched the world of software development and changed way how we look to it. This philosophy left marks on how we look our infrastructure too. By treating the infrastructure equally important as other parts of the project, there was a need for making sure that infrastructure is […]
Testing Clojure With Expectations
Introduction Clojure is shipped with clojure.test โ a library with basic features for writing tests. However, there are a few alternatives that aim to make writing tests more pleasant or more suitable for BDD. Expectations by Jay Fields is one of them, described as “a minimalist’s unit testing framework” with the slogan “adding signal, removing […]
Testing Clojure Web Applications with Selenium
Selenium is a commonly used set of tools for automating browsers. It allows you to drive a browser interaction with a web page by writing code. It’s most often used to write browser-based tests for web applications. Tests can be executed in a development environment or even on a real application as part of a […]
Testing Clojure web applications with Kerodon
Clojure standard library includes a general unit testing library clojure.test. There are several other libraries created for a specific purpose in mind. One of them is Kerodon, inspired by Ruby’s Capybara. Kerodon helps you test Ring-based web applications by simulating how a user would interact with your app. The goal of Kerodon is to provide […]
Setting Up the BDD Stack on a New Rails 4 Application
Introduction This tutorial guides you through generating a new Rails 4 application with RSpec and Cucumber as testing tools. If you’d like to learn how to set up a BDD stack on a Rails 5 application, this tutorial is the best next read for you. RSpec is a testing tool often used for writing unit […]
RSpec Subject, Helpers, Hooks and Exception Handling
We are continuing an introduction to RSpec, a testing tool for Ruby. After covering the very basics in the first part of this series, we will now explore other important and frequently used features of RSpec: use of subject, let helper method, before hooks and exception handling. Along the way we will encounter some more […]
NPM โ Node.js package manager
NPM is a Node.js package manager that comes bundled with the installation of Node.js. It keeps track of all dependencies for your Node.js projects and gives you full control over managing them. NPM makes is easy to reuse thousands of existing open source packages that solve a multitude of common problems, as well as share […]
Mocking with RSpec: Doubles and Expectations
Mocking is a technique in test-driven development (TDD) that involves using fake dependent objects or methods in order to write a test. There are a couple of reasons why you may decide to use mock objects: As a replacement for objects that don’t exist yet. When you are working with objects which return non-deterministic values […]
Integration testing PHP applications with Behat
Software testing is slowly becomming second nature for many developers. Knowing that your changes aren’t breaking any existing feature gives a huge confidence boost when deploying. The PHP community isn’t the first to adopt the methologies of TDD (Test-Driven Development) but it’s catching up quickly with the rest. The testing community is growing rapidly and […]
Integration Testing for Chef-Driven Infrastructure with Test Kitchen
Introduction A big obstacle to the mission to treat infrastructure as code is the way we test it. In the past, the practice of writing automated tests for infrastructure did not exist. Instead, the process was manual, repetitive and error-prone: we would log into a remote machine and run various commands to verify the system. […]