Showing posts with label continuous delivery. Show all posts
Showing posts with label continuous delivery. Show all posts

Wednesday, 18 March 2015

Small batch sizes - how small is small?

Many agile, continuous delivery and lean practitioners advocate only pushing small batches through your delivery process at any one time. The benefits of doing so have been described in detail many times, with Eric Ries giving a great overview.

Essentially the benefits are:
  • Faster feedback 
  • Problems are instantly localised 
  • Reduce risk 
  • Reduced overhead 

How small is small?

One thing that I don’t often see articulated in too much detail is what a small batch size actually looks like or means.

Its Relative..


That’s right, its really relative to your current state. Small batch sizing is about continually optimising your manageable workload until you get to the point when the benefits described are realised.

A small batch could be any of the following:
  • Enough lines of code to enable a particular method call 
  • A feature branch 
  • A service 
  • An individual component 
  • A change or changes that take days or short amount of time to produce 
The important thing to remember is that it really is relative to what you may have been or are doing at a given point in time. If you are pushing thousands of lines to production during a release, and then you gradually reduce that to hundreds, then your batch size is relatively small, and you have probably received many of the benefits associated with small batch sizes. If any of the above are giving you some or all of the benefits mentioned then you are probably pushing relatively small batch sizes through your system.

As a rule of thumb, small batch sizes are not typically associated with:
  • Making changes to multiple parts of a system 
  • Delivering big feature sets that typically move you to a major version release 
  • Delivering multiple components 
  • Multiple changes to a database 
  • Changes that take many iterations 
Although your customer might not be ready or have a need to receive smaller incremental updates, that does not stop you from delivering in that way to a pre production platform or similar.

Tuesday, 17 March 2015

Continuous Delivery - Madrid 26 Feb 2015

Here are the slides to accompany the talk I did on continuous delivery and testing in February at AfterTest in Madrid. 


Many thanks to expoQA and Graham Moran for inviting me along to talk, and Miguel Angel Nicolao at panel.es for an excellent write up. Thanks to everyone who attended, I hope it was useful. There was certainly some interesting debate after the talk!

The next AfterTest is in Barcelona on 26/3/2015 with Javier Pello.

Thursday, 27 February 2014

Vagrant - simple environment provisioning

Vagrant is a tool that I'm using more and more these days.
Vagrant provides easy to configure, reproducible, and portable work environments built on top of industry-standard technology and controlled by a single consistent workflow to help maximize the productivity and flexibility of you and your team. 
To achieve its magic, Vagrant stands on the shoulders of giants. Machines are provisioned on top of VirtualBox, VMware, AWS, or any other provider. Then, industry-standard provisioning tools such as shell scripts, Chef, or Puppet, can be used to automatically install and configure software on the machine.
I use it with VirtualBox to quickly install and launch different virtual machines for both development and testing tasks. Some of the teams that I work with have used vagrant within their build process to facilitate test automation or to provide environment consistency in a delivery pipeline.

Its very easy to set up, and is similar for most operating systems
  1. Install VirtualBox
  2. Install Vagrant 
  3. Navigate to where you want to install a vm
  4. Goto a site like http://www.vagrantbox.es/ and choose a prebuilt box 
  5. Then do:
     $ vagrant box add {title} {url}
     $ vagrant init {title}
     $ vagrant up
This will create, initialise and launch the box of your choice in VirtualBox. At point 4, you can just as easily point to your own custom built boxes.

Once you have the box built you can use the following commands to bring up, shut down, or rebuild the box
# to start the box
 $ vagrant up
# to stop the box
 $ vagrant halt
# to rebuild the box
 $ vagrant destroy --force && vagrant up
You can then bring tools like puppet into the equation to manage installations and configurations on the box.

Wednesday, 17 October 2012

Developers in test.Yes, really!

I have mainly worked in high growth businesses, either in the form of start ups, or strategic projects in large corporations. My role typically involves promoting the use of sensible software engineering practices and software delivery patterns to help produce a product that works, and that can have frequent low risk change applied to it. In this type of environment, the team structure is very much organismic in nature. What this usually means is that there are very few people dedicated to, or specialising in, test activities. 

However, this does not mean that testing gets completely side stepped. We can still achieve the quality objectives of the organisation without dedicated specialists. Given the right means, I have found developers in this type of environment can become some of the best testers that you will come across.

How does that work?


There are a number of ways that we can use to bring effective testing to forefront of product engineering

Software Engineering Practices
I always ensure that developers are equipped with decision making power on how their work environments are structured, about the tools that they use, and about the delivery mechanism to push regular updates to a product. I ensure that teams use sensible practices such as CI, zero branching, infrastructure as code, contract testing, and the like. I push continuous delivery, and actively promote learnings made from many of the great people that I have worked with.

People
You need to hire engineers on the team that take a holistic and caring approach to software development. These are the people that have built successful products from the ground up, or have been pivotal players of very successful product teams. 

Test Activities
I find that coaching teams using principles from folk like James Bach and Michael Bolton to be incredible useful in up skilling developers quickly in the art of testing. These two guys have spent their careers honing a testing approach, and are so well drilled that you will always come away from any of their writings or teachings with more than a handful of powerful testing ideas. I personally think they are great guys that should be listened to a lot more. Their pragmatic, and often dogmatic approach, is contributing to the changing face of testing.

At some point organismic structures become mechanistic. This is when professional testers are hired. This is when test managers are hired, or may be a head of QA. At this point it is always really good to have facts and figures to assess just how successful the new order is compared to your pre-exising "testerless" state.  





Tuesday, 24 July 2012

Integration testing of stored procedures using c# and NUnit

In a recent post I described setting up a database test framework to test an MS SQL database. The purpose of creating this framework was to ensure that in stored procedure heavy applications, we could still get a high level of automated test coverage (which is incredibly important for any application that uses any kind of continuous delivery process). That framework didn’t include an easy way to iterate through a result set and was limited to testing just the number results returned. (See this post for the original framework. Let me know if you need the source and ill get it zipped up).


I have now extended the framework to include the capability of executing a stored procedure with parameters, and then iterate through a result set by mapping the output to a data model.

Model the data

First set up a model of your data

public class CustomerBasicAccountModel
{
        public string CustomerID { get; set; }
        public string CustomerSortCode { get; set; }
        public string CustomerAccountNumber { get; set; }
        public string CustomerAffiliation { get; set; }
}

To facilitate reading of the data returned from a stored procedure I extend the datareader class to consume the reader using linq. This will allow me to easily manage the data once it is returned from the database.

using System;
using System.Collections.Generic;
using System.Data.SqlClient;

namespace  Database.Integration.DAL
{
    static class Extensions
    {

        public static IEnumerable<T> Select<T>(this SqlDataReader reader,
                                       Func<SqlDataReader, T> projection)
        {
            while (reader.Read())
            {
                yield return projection(reader);
            }
        }
    }
}

Finally in the test we can do something like this

[Test]
public void TestSortCode()
 {
            using (var session = _dbFactory.Create())
            {
                var z = session.GetTransaction().Connection.CreateCommand();
                z.CommandTimeout = 0;
                z.CommandType = CommandType.StoredProcedure;

                    var query = session.CreateQuery(
                    @"[GetCustomerBasicAccount]");

                query.AddParameter("@customerid", 3, DbType.Int32);
               
                var dataReader = query.GetAllResults();
                while (dataReader.IsClosed==false | dataReader.Read())
                {
                    using (dataReader)
                    {
                     customerBasicAccount = dataReader.Select(r => new                    CustomerBasicAccountModel
                                         {
                                         customerSortCode =
                                         r["CustomerSortCode"] is DBNull
                                         ? null
                                         : r["CustomerSortCode"]
                                         }).ToList();
                    }
                    Assert.AreEqual(customerBasicAccount[0].customerSortCode, 278222);
                }
            }
        }
Although this is a somewhat crude way to run integration tests on a database, it really does the trick. My original idea was that developers would simply use existing data mapping within a project and write the integration tests using that, but it has always been difficult to get them to commit to doing this. This framework is generic and can be used in any .net project with ease.

Monday, 12 December 2011

Engineering Support Teams (DevOps)


In agile environments, product owners that aren't in touch with development or who are not familiar with engineering practices always seem to push out of the backlog those technical stories that are required for a successful project.

Sometimes we need technical stories that allocate time to set up a CI project, or create a mocking framework, or create an environment, or some automated deployment scripts in order to continue developing and releasing a project. When we don’t have these mechanisms in place, we need to hope that we have a team that can pick up the functionality as we fire it out and position it into the deployment pipeline so that it will drop out happily into production.

Without these technical stories and engineering practices in place, the cycle time (time between conception and release of a story) climbs and we either never release, or if we do release, it’s a pressurised situation of manic updates done manually on live servers by technicians that may have no idea about the code they are deploying.

If you have multiple teams or programmes, and if you have the budget, an engineering support team is essential. This is a team that engages primarily in DevOps, but will also be domain experts capable of taking a holistic view of the project and identify any unforeseen issues.

You will often see this team type in large organisations, but in those organisations which may need them the most, i.e. those start ups that need to be capable of continuous delivery to keep ahead of the competition, it is usually never seen due to the difficulty in justifying a couple of heads working on technical stories instead of functionality. It takes a really technically savvy manager to understand and sell their worth to the business.

If you don’t have this team, and you are not afforded the necessary time to do technical user stories in your sprints or iterations, then you need to think outside of the box and form a group that can focus on these software engineering practices.

A software engineering group is one of these and is usually a selection of the most ambitious or creative engineers from your teams that are willing to get together on a regular basis to throw around current engineering problems and work on providing solutions between them. By utilising slack days, or lunch times, the team can fire through some of these completely necessary technical elements of the delivery pipeline and keep the cycle time down to a minimum.