TestNG NG, Next Generation of a runner for TestNG

I’ve been working with TestNG for 2 years now. The team that I work on made a decision to switch to TestNG thanks to one very important feature, @BeforeSuite and @BeforeClass. We are using Gradle as our build tool. Gradle supports TestNG tests execution.

With all the great features that TestNG comes with it also comes with features that could obfuscate test code readability. We also observed that there is no guarantee that the tests in the same class file will be executed together as a set.

With 25 minutes time of my train ride to/from work and determination to build something sweet and simple, I decided to create a Gradle plugin that will run TestNG tests in deterministic order, supporting only a small set of TestNG features.

I’ve made the code available here: https://bitbucket.org/gigu/testngng. The code is still work in progress, however there is already a functional Gradle plugin that can produce same style of XML reports as TestNG itself. There is also option of a Html report with simple and pretty style. I’ve written it in Groovy as I like Groovy. It’s Open and available to anyone.

Features supported by TestNGNG

  1. TestNGNG will recursively scan class folder passed in as parameter, in search of possible tests files. It treats this top-level folder a Suite.
  2. TestNGNG ENSURES all the tests in a class file are executed as a set of tests.
  3. TestNGNG will build a tree of tests and dependencies at the beginning of a run, before it executes a single test. The test tree is build in a form of a: One Test Suite -> Many Test Classes -> Many Tests.
  4. TestNGNG supports original TestNG annotations, it doesn’t have it’s own annotations as it is only a runner.
  5. TestNGNG support @Test annotation of a method or a class.
  6. It supports dependencies between test methods with:
    @Test(dependsOnMethods=”foo”)
  7.  It supports @BeforeSuite/Class/Test/Method and @AfterSuite/Class/Test/Method. However, @BeforeTest, @AfterTest and @BeforeMethod, @AfterMethod are treated in the same way and executed before/after each test. Just to avoid (or add to) confusion.
  8. It supports disabling of a test by enabled attribute of an annotation:
    @Test(enabled=false)

    I’m not proud of this feature though and am tempted to remove it.

  9. It supports exception expectation by expectedException attribute:
    @Test(expectedException=WhatevaException.class)
  10. TestNGNG supports data providers, however they have to be declared within the same Test Class file. Data providers could be named, or anonymous. For example:
    @Test(dataProvider = "makeMeSomeData")
      public void testWithProvider(String v1, String v2){
      System.out.println(String.format("%s - %s ", v1, v2));
    }
    @DataProvider
    public Object[][] makeMeSomeData() {
      return new Object[][]{
        {"some1", "Some2"},
        {"some3", "some4"}
       };
    }
    
  11. TestNGNG supports setup methods inherited from base classes. For example:
    public abstract class BaseForTestWithTestSetupMethods {
        public String baseValue = "";
        @BeforeMethod
        public void executeBeforeSuite() {
            baseValue = "BeforeMethod";
        }
    }
    
    public class TestClassExtendingFromBaseClass extends BaseForTestWithTestSetupMethods {
        @Test
        public void shouldPass() {
            assertThat(baseValue, is("BeforeMethod"));
        }
    }
    

Gradle plugin

Gradle plugin is very simple to use. It only requires plugin jar on a class path and TestNG as a testCompile time dependency. The plugin adds testngng task to the project. Sample use of a plugin:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath fileTree(dir: '../gradle-plugin/build/libs/', include: '*.jar')
        classpath fileTree(dir: '../testngng/build/libs/', include: '*.jar')
        classpath group: 'org.codehaus.groovy', name: 'groovy-all', version: '1.8.0'
    }
}
apply plugin: 'java'
apply plugin: 'testngng'
repositories {
    mavenCentral()
}
dependencies {
    testCompile('org.testng:testng:6.5.1')
}

Most of the other TestNG features are not covered as they are useless and very often stand in a way of tests readability and simplicity.

Don’t ask what you test framework can do for you, ask what can you do for your test framework.

How to build the plugin and use it

You would need to checkout the project from a BitBucket and build it with Gradle by typing from command line:

gradle jar

The build jar will be used by test runner Gradle plugin inside inside the testngng_gradle_sample project. You can ran gradle command from the sample project folder:

gradle testngng

I would love to see someone having a go and providing me with some feedback. There is still a whole lot of stuff on my list that needs development in the near future, like a build tests running feedback, more plugin configurations and multiple suites per project/module.

Cheers, Greg

Post-Redirect-Get pattern with Grails

In this post I would like to share with you a very common pattern used in web application development and how I implemented the pattern in my Grails application. Let’s start with a simple explanation of the pattern and what is it useful for.

Post-Redirect-Get

Post-Redirect-Get refers to the flow or process that web applications follow. When user submits the form in the browser the information is typically send with HTTP POST method to a web server. Application processes the information and sends back the response. Response is sent in a form of redirect to another view. Browser loads new state from web server using GET method.

Post-Redirect-Get pattern

Some of the benefits of using this patterns are:

  • Pressing refresh button in the browser will not cause duplicate form submission. The most annoying dialog box asking you if you want to resubmit your form will be gone.
  • Bookmarking result page would be possible.
  • Pages with forms submissions will be gone from your browser history.
  • Nice and clean separation of the HTTP methods that change state of an object (POST, UPDATE, DELETE) from non-destructive, read-only methods (GET).
  • Easier to test response, as all you need to check is the redirection. Typically when form is submitted successfully it will redirect to different page then failed submission. To test the behavior it is enough to test the redirection.

With the pattern in mind and the benefits let us try to look at the concrete FooBar example.

Grails example

I assume you know what Grails is. I’ve created a project and created domain object called Foo. The only property it has is a String, Bar that cannot be blank.

package post.redirect.pattern
class Foo {
  String bar
  static constraints = {
    bar blank: false
  }
}

Foo controller with two methods responsible for creation of new object.

class FooController {
…
def create() {
  def instance = new Foo(params)
  if (flash.model){
    instance = flash.model
  }
  [fooInstance: instance]
}
def save() {
  def fooInstance = new Foo(params)
  if (!fooInstance.save(flush: true)) {
    flash.model = fooInstance
    redirect(action: "create")
    return
  }
  flash.message = "Hooray, you did it!"
  redirect(action: "show", id: fooInstance.id)
}
…
}

When user submits the form and the object is invalid, the browser is redirected back to the form instead of rendering the form with error messages.

There is an extra check to see if user arrived on this page after unsuccessful form submission.

I used flash to store invalid object between pages, so the user could get feedback on what is wrong with provided values.

If you want to try on another example, the easiest way is to create a domain class and generate the scaffolding for it. You can try the browser behavior on generated code.Try refreshing the page after form submission (valid and invalid), try to navigate between pages using Back and Forwards buttons of your browser, try to bookmark the submitted page.

Later, go and modify the code, replace renders with redirects and see browser behavior after that.

Summary

This is all there is to it. It’s rather simple and easy to follow pattern with number of benefits. Grails makes it a doodle to implements,. Have fun redirecting.

Greg

Don’t focus on business when starting new company

Over the weekend I watched few presentation about workplace, creativity and motivation. I did some research into mentioned topics before, resulting in number of blog posts. Few hours ago idea started to form in my head. What if the new startup or new business or new company is started with something else in mind, not the product, not the service not the next best Apple-like company that will change the world?

What if the main aim of starting a company would be to gather some smart people and create the best possible workplace environment for them?

Let me explain where I’m coming from.

Creativity, innovation

Creativity and innovation goes along the same path. Creativity is a process of bringing something into existence. Innovation is an improvement of something, creation of a better thing, thus involving creativity.

There are three ingredients into creative soup: expertise, creative thinking skills and motivation. Expertise comes from years of knowledge gathering. It exists in our heads. Creative thinking skills are things like approach, flexibility and imagination when solving a problem. It defines how we attack the problem and arrive at the solution. Behind the wheel of creativity seats the motivation. It is the motivation that makes us work countless hours and carry on until we blast with loud “Eureka”.

A person defines both of the things, knowledge and creative thinking skills. However, motivation is something that is mostly influenced by workplace.

Motivation

There are two types of motivation, intrinsic and extrinsic. Extrinsic motivation is simply award (money) or a threat (kick out). Unless your company hires employees for physical work, intrinsic motivation is the one you should optimize for. 

Intrinsically motivated person will wonder around the maze of solutions, having a lot of fun along the way, learning from mistakes and successes only to arrive on more novel and interesting idea.

To be intrinsically motivated, one needs to:

  • Feel challenged
  • See the goal
  • Feel enough freedom and trust
  • Get enough resources
  • Diversity of colleagues
  • Be encouraged
  • And supported by organisation

I will not go into more details about it as you can read more in one of my previous articles on motivation.

If I would…

If I’ll be starting a company today, I would like to have very smart people working for me. I would like them to be creative and innovative. To empower Creativity and Innovation I would need to provide appropriate motivation. It doesn’t matter what I will focus on, what industry, service or a product. If I want to become a hit I need to be creative and innovative. For my new business to be successful I need to focus on the ways I motivate people. I need to build a workplace environment that will foster creativity and will keep my employees with me.

Why not focus on those things when starting new company? The best workplace for creativity junkies. Make business objectives a secondary target. I know that sounds crazy, who in a right mind would start a company for the sake of a great workplace, not thinking too much of a business up front?

The truth is, that as a side effect of successful creation of the best workplace on earth, I’ll get creative people motivated to do their work in the best possible way. I’ll get an army of productive and innovative employees.

For sure it would be good to know at least where the business is heading as a goal is important part of a motivation. Have an idea of what industry it will be focusing on. It will attract the right kind of talented and skilled people.

The best place to work

How to create the best workplace on earth? How to foster creativity and motivate people? I got ideas in my head. I leave it to your imagination dear reader. Good starting point is the knowledge on what helps both of them.

There are companies out there that started small, hired a lot of creative people, and provided very motivated workplace. Then, they got successful and got bigger. Changed the culture in the company. As a result there is no more motivation in them and creativity turned into competition. That doesn’t mean that only small companies could harvest the creativity fields. It means that someone lost the plot along the way.

 Perhaps what I’m writing about is a good idea or perhaps I’m just writing rubbish. If I get a chance to start a company in the future, I know what I’ll be focusing on.

I’ll build a company that I want to work for.

Greg

Links to articles on creativity, innovation and motivation:

Unit testing Grails controllers with duplicate form submission check functionality

I’ve been doing some Grail 2.0.1 development recently. I like the maturity of framework and the ease of doing things.

One of the things Grails comes with is a simple way of avoiding duplicate form submission. Have a look at the code bellow:

def myControllerMethod(){
  withForm{
    render “theGoodStuff”
  } .invalidToken {
    render “theBadStuff”
  }
}

That’s the controller bit. In your view you need to enable use of that feature by passing useToken parameter to form tag:

<g:form action=”myControllerMethod” useToken=”true”></g:form>

It looks very simple and elegant. However when we would like to test the controller we need to make sure we match the token when calling the method.

Documentation on testing Grails application and this particular functionality contains the way of doing so, however I found it not working with Grails 2.0.1.  Not much was blogged about it so I looked through the mailing lists. I found one trail and a bug report for this issue.

Anyway, to make it work, the piece of documentation from Grails, version 1.4.x explains how to do it, and it works.

In controller test method we need to place this code:

…
def token = SynchronizerTokensHolder.store(session)
params[SynchronizerTokensHolder.TOKEN_URI] = '/myController/myControllerMethod’
params[SynchronizerTokensHolder.TOKEN_KEY] = token.generateToken(params[SynchronizerTokensHolder.TOKEN_URI])

controller.myControllerMethod()
…

Happy testing. Greg

Useful links:

http://grails.1312388.n4.nabble.com/grails-2-0-testing-controller-with-withForm-invalid-notation-td4316150.html
http://jira.grails.org/browse/GRAILS-8504
http://grails.org/doc/1.4.x/guide/9.%20Testing.html
http://grails.org

Automated software release in complex environments

Automating software release might seem like an impossible task in a complex environment. I would like to give you, my dear reader handy tips and tricks for achieving it.

breaking chain

Software journey

Either you know it or not, the piece of software that enables you to read this article went a long journey. It was invented, thought through, designed, developed, tested, fixed and then delivered to you. Software continues to evolve. New functionality is invented, designed, developed, tested, fixed and delivered to you again. This cycle happens over and over again. If it doesn’t the software is dead, and I wouldn’t use it if I were you J

Note the last cycle in the software journey: delivery. I like to call this process Software Release or Unleashing the Software. Release depends on many factors. One of them is software purpose. It is enough to make desktop application available (via web site download for example) so the user can get it and install it on a desktop. Web applications are delivered to a web server.

Release process

Software Release process could be simple or could be very complicated. Lets examine three examples:

  1. Desktop application release could involve copying (perhaps extracting) number of files into known location and perhaps making some changes to saved files (for example user files with configuration and settings in user directory).
  2. Web application release could involve pushing new version of the application to web servers, restarting them, migrating the data stored in database.
  3. Multi tiered enterprise applications could involve stopping a number of services, waiting for suitable services state (for example empty EMS service), migrating the data schemas (for example database migration), re-starting multiple applications, restoring application state, etc.

As you can see complexity of the process could be great. Some steps in the process could depend on another. Other steps could take great amount of time. Sometimes it is impossible to stop part of the application or a service for required release.

Whatever the problematic, time consuming and fragile steps of the release process are, you can be sure that sooner or later, someone will make a mistake during the release, causing downtime or even damage to a system.

That is why it is important to have automated release.

Automated release

My favorite form of automated release is One-Click-Deploy. A tool (script most likely) that will perform all the hard work, with a single user interaction.

Some of the benefits of release automation like this are:

  • Reduced mistakes when performing manual steps
  • No time wasted by a poor soul who have to go through manual process
  • Reusability and simplicity of using the same tool to release into different environments
  • A tool that verifies the release process itself (if something went wrong, it probably means that process needs updating)

Complex environments

Automating in complex environment is even more important then anywhere else. This is due to the fact that it is much simpler to make a mistake while releasing and cause problems. It also reduced the great amount of time consumed by manual steps.

It might be hard to automate release in complex systems. Consider the system I work on my current project.

Large distributed cache makes it difficult to stop the application, as data will be lost. EMS topics are read by database persistence application and fail-safe environment, so we need to wait for the topics to be read entirely. Once everything is stopped we need to roll the new code base to 20 – 40 physical hosts and apply all necessary configurations changes. Persistence layer needs to be migrated to represent Domain correctly. When we restart applications we need to reload it to the previous, valid state (load 300 GB worth of data into distributed cache). That is only a tip of the Iceberg that represents how difficult it could be to automate the release.

There are things that you can do or adopt on a project that would make it much easier for the automation to happen.

Tips and tricks

Tools and deployment environments

Use tools and deployment environments that have accessible API for management.

The environment or the containers that you deploy to should have open API for the management. If you are deploying into web server, you would like to be able to programmatically stop the server deploy new code, perform configuration changes, start it again and validate.

Most of the cloud services contain this kind of API. Typical Java Web containers are manageable via a public API.

If there is no public API but there is a web console for management it is possible to automate via typical Web Testing tool (eg: Selenium, Geb).

If you are starting the project and still have a chance to select appropriate environment, then you are lucky. You can make your life easier by selecting environment with public management API. If you are deep into the project and it is too late, there are always a ways to hack the system. Give it a try.

Use a tool that will be flexible and won’t enforce specific way of working.

Number of times I was on a project where the tool used for a release was enforcing a specific way of working. Instead of being productive in automating release process I was forced to fight it and hack it.

There are better things to automate your release with than XML.

If the tool doesn’t entirely do what you need, wrap it, enhance it or dump it in favor of other.

Many tools that are typically used for deployment are quite flexible and have build in mechanism for extending it. I found that writing a plugin or simply wrapping the tool in another process that controls it’s startup, makes it simpler to use and produces repeatable pattern.

If you are having more trouble with the tool itself or simply can’t get result required, don’t be afraid and dump it. There are always other tools. In a worse scenario you can write something simple and tailored for your specific needs.

Application design

Build your application in a way that will support state persistence and restoration.

It is not only the process and tools that you are creating or going to use that should support the automation; it should be the Application itself.

In the example of a complex environment I provided, I mentioned the distributed cache. If the cache is full of data, releasing new version of application could potentially cause the data to be lost. You need to think of a way to get it back to the previous state. The release process should accommodate for restoring the state from some king of storage (eg. Disk, database, replicated cluster, etc.).

Process

Keep your configuration with your source code.

Having environment configurations collocated with the source code in the source version control system has number of benefits:

  • It could be unit tested.
  • Provides a history of configuration changes. It is always possible to revert to a previous configuration that was working.
  • Configuration lives close to developers, who usually know the most on subject of required configuration changes.
  • Configuration ships with the deployable.
  • It contains a name of a person that modified it, so whenever configuration changes are not clear you can always ask the person who made a change.

Automate every step.

Don’t leave a chance of error creeping into your process by allowing manual steps. It might take some extra effort to automate those simple, little steps but the award is saved time and reliably released software.

Make sure to have everything that application needs to live contained within the release.

Don’t leave anything out: extra libraries, additional software installed, new versions, etc. Ship it all as a part of the release. It doesn’t have to be collocated with a source code (however it is quite beneficial sometimes). Make sure it is accessible from every point you are deploying your software into.

Keep logs, summary and history of releases.

Having release log helps to track the progress of release, identify issues and even test the release itself.  It is also handy when release takes long time and nursing it needs to be handed over to another person.

Summary page helps quickly identify the version of the software released into environment.

Famous last words

I know that sometimes automation might seem impossible but I also believe that impossible doesn’t exist. There is only easy and less easy to do. Automate your release and make your and your comrades life more enjoyable.

Many happy automated releases.

Greg

Summary of 2011

Past

Time for a little retrospective on what I learned during 2011.

Technologies I learned and improved skills in:

  • Gradle – build and release tool.
  • Groovy – dynamic programming language that runs on JVM
  • Coherence – distributed cache
  • Grails – web framework that runs on JVM. Groovy and Spring paired nicely together
  • Gaelyk – another web framework
  • GAE (Google App Engine) – cloud platform from Google
  • Objective-C and iOS development
  • Scala and Clojure, programming languages that runs on JVM

I did some research into Creativity and Motivation that resulted in few posts.

Future

This year I will focus more on functional languages and functional style of programming.

Main target this year for me is the work on GigReflex, Service that I work on with my friend Mike. Service will be deployed on one of the available PaaS cloud services running Grails web application framework.

Bye, bye 2011.

2012, here I come.

Greg

When done is DONE (or not)

Not too long ago I had a conversation with one of the senior member of the management team of project I’m working on. I had some ideas on how can we do things faster by improving our testing (not developer testing but end-to-end, QA and regression testing). After few minutes of conversation I was asked a very basic question: “What is the definition of DONE on our project?” I was just going to open my mouth and jump out with an answer like: “Well, it takes us usually 3 days to develop piece of functionality”, but I stopped. I actually wasn’t sure. We spend few more minutes discussing some other issues but when I left I felt that this question is still on the back of my mind, trying to desperately find the answer.

After number of attempts I decided to rephrase the question. What is the Goal of the project? Couldn’t find a simple answer. So I asked even more general question. What is the goal of the company? I recalled books by Eliyahu M. Goldratt, “The Goal” and “The Race”. “The goal of the company is to make money in the present as well as in the future”. The goal is to win the race for customers.

My team works on creating and maintaining the software that produces the data for other systems within the company. Those systems are used to deal with clients, to provide them with reports, to sell them information, to protect client interests. This means that our project indirectly contributes towards company’s goal.

All the other teams and projects that are receiving data from us are our customers. We should make all the effort to deliver the necessary features to the consumers in a timely manner as they will be use to generate the revenue.

That’s it. This is my understanding of DONE.

In other words:

  • It’s NOT DONE when BA finalizes the requirements and forms them as stories that got accepted by all stakeholders
  • It’s NOT DONE when developer finishes coding the solution and fixes all the bugs
  • It’s NOT DONE when QAs, BAs finish testing and approve the deliverables
  • It’s NOT DONE when Downstream systems receive the data and confirm it’s quality
  • It’s DONE when client receives the service that he or she requested thanks to the piece of software my team delivered. That’s when it’s DONE!

I think there is an important aspect to touch on. It is the effort of the entire team before DONE could be announced. No one should silo himself into a specific role and take responsibility for the specified area only. Developers should help with delivery of tools for release and testing automation, BAs should help with testing, QAs should help to form requirements, etc.

So, next time when you think you’re DONE, think again. Perhaps you are not really there yet but you could help someone else to make it happen.

Wish you all many happy DONEs in the future. Greg

Gradle IDEA plugin, configuration and usage

We are using Gradle as a build and release tool in our project. It’s flexible and does exactly what you expect from it, with no xml configuration magic.
Gradle IDEA plugin gave us a way of generating IntelliJ project and modules files out of the freshly checkout source with a single instruction.

Gradle IDEA plugin

All we needed to do is to include the plugin in out multi project setup and run the gradle idea tasks from the command line.

allprojects {
…
  apply plugin: ‘idea’
…
}

First time when we generated the files they were valid, however the module configurations needed few simple fixes. The IDEA plugins provide hooks into project and module generation that we used to amend the generated IntelliJ files.

Setting the Java version on the project


allprojects {
…
  ideaProject {
    javaVersion = '1.6'
  }
…
}

This code snipped sets version of JDK on the whole project, which in turns makes it ready for compilation in IntelliJ.

Moving module dependencies to the top of the list

Gradle IDEA plugin creates dependencies for all the modules, however it moves the dependencies between modules to the bottom of the list. For example, if module B has dependencies on module A plus some of it’s own JAR dependencies, the JAR will appear before the module A dependency.  It was problematic for our project.  The snippet below is using module configuration hook to reorder module dependencies to the top of the list.

allprojects {
…
  ideaModule {
    whenConfigured { module ->
      def moduleDependencies = []
        module.dependencies.each {
          if (it.class.simpleName == 'ModuleDependency') {
            if (it.scope.equalsIgnoreCase("COMPILE")) {
              moduleDependencies += it
            }
          }
        }
      module.dependencies.removeAll(moduleDependencies)
      def jarDependencies = new LinkedHashSet(module.dependencies)
      module.dependencies.clear()
      module.dependencies.addAll(moduleDependencies)
      module.dependencies.addAll(jarDependencies)
    }
  }
…
}

Adding defaults to Run configurations

We have also discovered that it was useful to add some extra defaults to Run configurations and to TestNG running configurations.

We did this with Idea Workspace hook and a bit of XML injection. Code bellow is the sample snipped we used.


allprojects{
...
  ideaWorkspace {
    withXml { provider ->
      def applicationDefaults = provider.node.component.find { it.@name == 'RunManager'}.configuration.find { it.@type == 'Application'}
      if (applicationDefaults != null) {
        applicationDefaults.option.find { it.@name == 'VM_PARAMETERS'}.@value = '-Xmx1024m -XX:MaxPermSize=256m -Xss64k'
        applicationDefaults.option.find { it.@name == 'WORKING_DIRECTORY'}.@value = 'file://$MODULE_DIR$'
      }
      def testNGDefaults = provider.node.component.find { it.@name == 'RunManager'}.configuration.find { it.@type == 'TestNG'}
      if (testNGDefaults != null) {
        testNGDefaults.option.find { it.@name == 'VM_PARAMETERS'}.@value = '-XX:MaxPermSize=128M -Xmx1024M'
        testNGDefaults.option.find { it.@name == 'WORKING_DIRECTORY'}.@value = 'file://$MODULE_DIR$'
      } else {
        def clonedNode = new XmlParser().parseText( XmlUtil.serialize(applicationDefaults))
        clonedNode.@type = 'TestNG'
        clonedNode.@factoryName = 'TestNG'
        provider.node.component.find { it.@name == 'RunManager'}.append(clonedNode)
      }
    }
  }
...

}

This snippet sets some default JVM parameters and working directory for running configurations.

The snippets made it possible for anyone to quickly get up and running on any clean machine with checked out project sources.

Cheers, Greg

Importance of proper management on creativity – science of motivation

Creativity signI’ve been writing some general ideas about creativity in the last couple of posts (Little creative fingers, Difference between innovation and creativity). This time I would like to touch more on the role of managers and different areas they can influence to foster creative work in an organisation.
First let me start with a little explanation of three important components of creativity.

  1. Expertise – a bag of knowledge. Technical skills, procedural skills and general intellectual knowledge, which exist in our head. Things that we learned and skills acquired over period of our lifetime. All of that exists in our memory ready to be used for greater creation. Nobel price laureate, Herb Simon calls it a “Network of possible wonderings”.
  2. Creative thinking skills – approach, flexibility and imagination when solving a problem. It defines how we attack the problem and arrive at the conclusion. The way could be very different for anyone as it is being shaped by previous creative endeavours, observations and ones personality. Personality plays important role. For example someone more open for environment could be easier seeded with ideas and include it in the solution he or she works on. Someone more comfortable with disagreeing will try status quo ways to achieve desired outcome.
  3. Motivation – that’s the driver of the creativity. It’s something that makes us work countless hours, drink liters of coffee and carry on regardless to the progress. When there is no motivation, people waste energy on doing everything else but not looking for creative solution to solve the problem.

Expertise and creative thinking skills are hard to influence by managers. They can organize knowledge sharing sessions, encourage training, simplify the communication between team members but this will not directly influence ones expertise and creative thinking skills. The easiest to influence component is the motivation. Thus, the following part of this article will focus on the motivation.

Intrinsic and extrinsic motivation

We can distinguish two types of motivation: intrinsic and extrinsic. Our passion and interests drive intrinsic motivation. Extrinsic motivation comes as a result of reward or a threat. Here’s an illustration of the difference between these two types of motivation and its influence on creativity.

mazeImagine maze and finding a way out of it as a problem. Two people are asked to find exit from the maze, a solution to a problem. One of them is told that at the end of the maze there will be a reward waiting (extrinsic motivation). The other person is a huge maze enthusiast and enjoys a challenge, is also told to take all the time needed to find the most interesting way out of the maze (intrinsic motivation). Two solutions delivered by both maze solvers could be very different as:

  • Extrinsically motivated person will rush as quickly as possible to get to reward and will use the most common, beaten path out of the maze. Not a particularly very creative solution.
  • Intrinsically motivated person will wonder around the maze sometimes getting into a dead end. This person will have much fun in doing so and after a number of mistakes and failures more creative and interesting solution will emerge.

By influencing the intrinsic motivation in the organization the employees will burst with novel and creative ideas.

Extrinsic motivation will create temporary results and common solutions that will not place any organization on top of the “creative chart”.

Bellow is a list of categories that I think management can influence that would affect creativity. Those categories emerged to me after a little research in the creativity area and my personal experience.

Challenge

Matching people to tasks according to their abilities. When working on a problem we are passionate about, the right type of motivation is triggered. The knowledge and interest possessed by us is being used to wonder around the solution paths that could not possibly be discovered by someone with no interest in the subject of a problem. It’s also better to stretch our abilities and skills so we will be presented with a problem that we never faced before, in the area we care about.

However stretching ones abilities is fragile. Stretching it too much will make problem look impossible to solve. Not stretching it enough will make it look dull and uninteresting.

The most common mistake that kills creativity is when managers assign people to work on whatever tasks are available at the moment. This approach is going to yield some results but they are not going to be the most creative and interesting. Quite often the results will lack on quality if they are particularly uninteresting.

I know that when I’m faced with challenge it makes me work harder and research the subject deeper. It makes work fun and interesting. However, when fixing bugs and just working on “Business As Usual” tasks, I’m not as engaged and I’m looking forward for the day to finish. A good challenge is what makes me tick and come out with new ideas.

Freedom

Autonomy in delivery process. I like to have my targets clear when I’m working. However, clear targets don’t mean that my “personal manager” will hold my hand and tell me what to do, when and how. I need freedom in my work and in the choice of how I’m going to deliver the solution. Freedom gives me the sense of ownership and responsibility. This in turn increases my intrinsic motivation.

freedom

Frequently moving targets require management to guide people all the time and reduces ones autonomy. It also makes anyone afraid to take responsibility for any targets as they are not clear and might change any time.

Quite often people are enchanted with illusion of freedom where delivery process is strictly prescribed and should be followed.

Resources

Time and money management. Legitimate reasons of time pressure will trigger intrinsic motivation. For example, if product needs to be delivered before competition, team will feel the need to rush. Motivation goes up as the bar was raised into a higher level thus making challenge more interesting.

I found that fake deadlines create a feeling of distrust in the team. Deadlines are often imposed with regards to managers personal agendas, with no legitimate reason. Tight deadlines burn people out and there is no chance of creating intrinsic motivation and creative ideas.

Managing resources means also managing money and equipment that team can use in delivery. I’ve seen projects where money was constraint and lead people to find ways of avoid money limits. This also mean that all the creative energy and time was wasted into creating ideas that were not adding any additional value to end product.

Team Diversity

Diversity in backgrounds and skills. I like working in the teams where people have different backgrounds. I’ve been making software for many different industries: media, marketing, communication, insurance, finance and I always find ideas from one industry useful to spawn ideas into another.

Whenever I work with non-technical members of a team they are providing more detached and higher-level view of a problem.  Quite often it opens perspectives that I was unable to see before.

Putting together a team of people with different skills and different background will make ideas combust and burst. Different skills and backgrounds will create different points of view.

Homogenous team will be creativity killer. Everyone comes to the table with the same mindset and leaves the table with the same.

Supervisory encouragement

Everyone likes to be noticed and rewarded for the work done. It’s our ego that needs some pleasing and keeps us motivated. It is important for managers to recognize effort of a team as well as individuals. I noticed during years that my colleagues who were recognized for their creative work and received some kind of reward for it, were even more motivated next time. It appears that commercial impact didn’t create a feeling of a bribe for creative work.

One company I worked for as a consultant had extensive layer of evaluating new ideas. This means that every new idea that someone came up with was immediately criticized by management, put into pile of other ideas to be reviewed and waited there for months just to be rejected at the end. It caused many employees of the company to stop breeding ideas and stop carrying about work at all. Eventually most of the creative people left the company.

Keeping open mind for a possible solutions and removing evaluation layer should be the management’s aim. If evaluation is too long or is to criticizing, people will fear to propose any novel ideas and stop carrying.

More layers and time between idea and its introduction in the organization can cause lost of potential market edge.

Organization support

Entire organizations can be structured in a way that supports creativity. Open communication, clear processes and systems should come along with no internal politics.

Lack of recognition and reward could spawn negative feeling within employees. People will feel used and unappreciated. Using money as motivator can also create a feeling of control and kill any creative endeavors.

Summary

The best way to get creative results in a team is to get everyone intrinsically motivated. If you are a manager or a leader and your aim is creativity of your team, I hope the things mentioned above could give you a starting point.

Greg

There is six people between you and the President of the USA, Barack Obama

Yes, according to “Six degrees of separation”, it would only take up to 6 people to let the President of the USA know about your holiday plans.

People Network

Six degrees of separation is a theory that anyone on the planet can be connected to any person by a maximum of 6 steps (6 people). Theory that I was planning to prove via Twitter. Unfortunately the Twitter API has rate limits that would make it rather hard to search through connections.

I find myself saying these days more often that the world is a small place. It didn’t shrink, communication and transport made it smaller.

Here’s a bunch of links that explain more about the theory: