Scala Test-Driven Development (TDD): Unit Testing File Operations with Specs2 and Mockito

In this article we’ll go through the exercise of writing a method that will write string content to the specified file. There will be an option to specify whether we should overwrite an existing file. In addition, directories should be created if they do not already exist.

Programming language is Scala and testing framework that will be used is Specs2. In the spirit of unit testing, instead of interactions with the file system we’ll use mocks with Mockito (already included in Specs2). All the code will be done using Test-Driven Development (TDD).

This article is based on an existing code done for the open source application BDD Assistant located in the TechnologyConversationsBdd repository.

Let’s get started.
Continue reading

BDD Assistant: It’s alive and cries for help

tutorialStoryOperationsI’ve been working with BDD for years and felt that it needed an application that would facilitate the Behaviour-driven development work-flow. It would need to be made in a away that anyone can use it. By anyone I mean people with or without technical skills. Coders, testers, analysts, managers, business, etc. In that spirit, I started working on BDD Assistant. It is an open source application that can be used to create, manage and run BDD stories.

Now I feel that it is finally ready to go public. The application is far from being finished but there is enough done for the community to see what it’s all about. More information can be found in the BDD Assistant site. Latest release can be downloaded from our GitHub repo. Live demo (with some features disabled due to hosting limitations) can be seen from the BDD Assistant demo.
Continue reading

Feature Toggles (Feature Switches or Feature Flags) vs Feature Branches

Feature Branches

If you are using branches, you are not doing Continuous Integration/Deployment/Delivery!

You might have great Code Coverage with unit tests, you might be doing TDD, you might have functional and integrations tests written in BDD format and you might run all of them on every commit to the repository. However, if you are having branches, integration is delayed until they are merged and that means that there is no continuous integration.
Continue reading

REST API with JSON

What is REST API?

REST stands for Representational State Transfer. It relies on a stateless, client-server, cacheable communications. In most cases it is used with the HTTP protocol.

RESTful applications use HTTP requests to POST (create), PUT (create and/or update), GET (e.g., make queries), and DELETE data. REST uses HTTP for all four CRUD (Create/Read/Update/Delete) operations.
Continue reading

References and Presentations History

Reference articles

InfoQ: Behaviour-Driven Development: Value through Collaboration
Agile Record (Issue 17): Behaviour-Driven Development: Value through Collaboration

Presentations

Specification by Example at Barcelona Software Craftsmanship (4th of February 2014)
BDD Workshop at Barcelona Software Craftsmanship (4th of March 2014)
Specification by Example at Universitat Politecnica de Barcelona (UPC) (28th of April 2014)
Continuous Integration, Deployment and Delivery at Barcelona Software Craftmenship (2nd of June 2014)
Behavior-Driven Development (BDD): Value Through Collaboration at Agile 2014: Orlando (presentation BDD: Value Through Collaboration)
PHP Barcelona Monthly Talks: Testing at La Salle, Barcelona (23rd of September 2014)

Moogle Corp: Company you might be working for

Google is one of the biggest, the coolest and the most profitable companies in the world. Probably the main reason for being at the top is their ability to innovate continually. According to Gopi Kallayil there are 9 core rules that drive Google’s innovative culture:

  1. Innovation comes from anywhere
  2. Focus on the user
  3. Aim to be ten times better
  4. Bet on technical insights
  5. Ship and iterate
  6. Give employees 20 percent time
  7. Default to open processes
  8. Fail well
  9. Have a mission that matters

Continue reading

BDD (Behavior-Driven Development): Missing Piece in the Continuous Integration Puzzle

Behavior-Driven Development (BDD) is a process or it can be a tool. In many cases, BDD is both. However, it should not be a goal in itself. The goal of software development is to deliver quality as fast and as cheap as possible. The only real measure of quality is whether it fulfills user needs in a reliable manner. The best way we can take to accomplish that goal is through continuous integration, deployment and delivery. For the sake of this article I will ignore the differences between those three and refer to all of them as continuous integration or CI.
Continue reading