All posts

Delivering better products to our clients with test driven development

Leighton logo
October 6, 2015
5 min read
Leighton developers immersed in their work within the office environment.

At Leighton, our JavaScript developers have had to learn new skills with the introduction of a more mature approach to JavaScript development.

One of these skills is TestDriven Development (TDD), a process that requires a deep understanding of both the overall structure of an application and the software used.

How do we use TDD?

TDD relies on developers understanding the scope of the feature they are developing and how that feature impacts the application as a whole. Development cycles should be very short with continuous integration testing taking place on the full application to spot bugs as part of the development process.

There are three key types of testing we apply during development:

  • A design aid - tests are written prior to development to aid in the design and development process.
  • Feature documentation - tests should document all the features of an application, giving full test coverage.
  • Quality assurance and continuous delivery - failing tests should halt the delivery of a product so no bugs are introduced into the application.

How does TDD work?

Initially, a developer will write a failing test for the feature they are adding, they then develop the solution that fixes that test. No other pre-existing tests should be caused to fail as part of the development process.

The code then needs to be refactored to the point where it is modular and easy to understand. This process is very important as it allows the developer to create quality, easy to understand solutions, delivered with confidence that no bugs have been added.

The language used in writing a test should be clear and descriptive about what the test is for. This then allows the test to be used as an efficient bug documentation tool. Developers can then more effectively address the bug and make the required changes to fix the problem.

Why do we use TDD?

The TDD process is one that fits in with the Agile working methods  our development team use. We also find it brings a number of benefits to the development team and the applications they are creating, including:

  • Encouraging developers to think about their code.
  • Inspiring confidence in the product.
  • Reducing the density of bugs.
  • Encouraging the design of modular code that is improved with each design cycle.
  • Reducing the complexity of code.

How do you write a good test?

With JavaScript applications we useKarma (to run the tests) and Jasmine (to script the tests). The Karma test platform runs as a continuous integration server, detecting changes to the codebase and rerunning the existing series of tests against it, so any breaking changes are flagged as part of the development process.

The Jasmine scripting language is an open-source test framework that allows us to write feature based tests quickly and easily.

A good test should include the following things:

What are you testing and what should it do? A good description of the feature.

What is the expected result? The planned outcome, the value we actually test against. Our expected result should have no animosity.

Benefits of TDD to our clients

All this TDD is great for our development team, but our customers also benefit from the process as we believe it allows us to deliver confidently, efficiently and in an agile manner, with very few bugs being introduced as part of the development process.This also limits redevelopment requirements later down the line and the resulting delays to project timelines.

Share this post
Leighton logo
October 6, 2015
5 min read
All posts
Leighton developers immersed in their work within the office environment.

Delivering better products to our clients with test driven development

At Leighton, our JavaScript developers have had to learn new skills with the introduction of a more mature approach to JavaScript development.

One of these skills is TestDriven Development (TDD), a process that requires a deep understanding of both the overall structure of an application and the software used.

How do we use TDD?

TDD relies on developers understanding the scope of the feature they are developing and how that feature impacts the application as a whole. Development cycles should be very short with continuous integration testing taking place on the full application to spot bugs as part of the development process.

There are three key types of testing we apply during development:

  • A design aid - tests are written prior to development to aid in the design and development process.
  • Feature documentation - tests should document all the features of an application, giving full test coverage.
  • Quality assurance and continuous delivery - failing tests should halt the delivery of a product so no bugs are introduced into the application.

How does TDD work?

Initially, a developer will write a failing test for the feature they are adding, they then develop the solution that fixes that test. No other pre-existing tests should be caused to fail as part of the development process.

The code then needs to be refactored to the point where it is modular and easy to understand. This process is very important as it allows the developer to create quality, easy to understand solutions, delivered with confidence that no bugs have been added.

The language used in writing a test should be clear and descriptive about what the test is for. This then allows the test to be used as an efficient bug documentation tool. Developers can then more effectively address the bug and make the required changes to fix the problem.

Why do we use TDD?

The TDD process is one that fits in with the Agile working methods  our development team use. We also find it brings a number of benefits to the development team and the applications they are creating, including:

  • Encouraging developers to think about their code.
  • Inspiring confidence in the product.
  • Reducing the density of bugs.
  • Encouraging the design of modular code that is improved with each design cycle.
  • Reducing the complexity of code.

How do you write a good test?

With JavaScript applications we useKarma (to run the tests) and Jasmine (to script the tests). The Karma test platform runs as a continuous integration server, detecting changes to the codebase and rerunning the existing series of tests against it, so any breaking changes are flagged as part of the development process.

The Jasmine scripting language is an open-source test framework that allows us to write feature based tests quickly and easily.

A good test should include the following things:

What are you testing and what should it do? A good description of the feature.

What is the expected result? The planned outcome, the value we actually test against. Our expected result should have no animosity.

Benefits of TDD to our clients

All this TDD is great for our development team, but our customers also benefit from the process as we believe it allows us to deliver confidently, efficiently and in an agile manner, with very few bugs being introduced as part of the development process.This also limits redevelopment requirements later down the line and the resulting delays to project timelines.

Watch now!

To watch the on-demand video, please enter your details below:
By completing this form, you provide your consent to our processing of your information in accordance with Leighton's privacy policy.

Thank you!

Use the button below to watch the video. By doing so, a separate browser window will open.
Watch now
Oops! Something went wrong while submitting the form.
All posts
Leighton developers immersed in their work within the office environment.

Delivering better products to our clients with test driven development

At Leighton, our JavaScript developers have had to learn new skills with the introduction of a more mature approach to JavaScript development.

One of these skills is TestDriven Development (TDD), a process that requires a deep understanding of both the overall structure of an application and the software used.

How do we use TDD?

TDD relies on developers understanding the scope of the feature they are developing and how that feature impacts the application as a whole. Development cycles should be very short with continuous integration testing taking place on the full application to spot bugs as part of the development process.

There are three key types of testing we apply during development:

  • A design aid - tests are written prior to development to aid in the design and development process.
  • Feature documentation - tests should document all the features of an application, giving full test coverage.
  • Quality assurance and continuous delivery - failing tests should halt the delivery of a product so no bugs are introduced into the application.

How does TDD work?

Initially, a developer will write a failing test for the feature they are adding, they then develop the solution that fixes that test. No other pre-existing tests should be caused to fail as part of the development process.

The code then needs to be refactored to the point where it is modular and easy to understand. This process is very important as it allows the developer to create quality, easy to understand solutions, delivered with confidence that no bugs have been added.

The language used in writing a test should be clear and descriptive about what the test is for. This then allows the test to be used as an efficient bug documentation tool. Developers can then more effectively address the bug and make the required changes to fix the problem.

Why do we use TDD?

The TDD process is one that fits in with the Agile working methods  our development team use. We also find it brings a number of benefits to the development team and the applications they are creating, including:

  • Encouraging developers to think about their code.
  • Inspiring confidence in the product.
  • Reducing the density of bugs.
  • Encouraging the design of modular code that is improved with each design cycle.
  • Reducing the complexity of code.

How do you write a good test?

With JavaScript applications we useKarma (to run the tests) and Jasmine (to script the tests). The Karma test platform runs as a continuous integration server, detecting changes to the codebase and rerunning the existing series of tests against it, so any breaking changes are flagged as part of the development process.

The Jasmine scripting language is an open-source test framework that allows us to write feature based tests quickly and easily.

A good test should include the following things:

What are you testing and what should it do? A good description of the feature.

What is the expected result? The planned outcome, the value we actually test against. Our expected result should have no animosity.

Benefits of TDD to our clients

All this TDD is great for our development team, but our customers also benefit from the process as we believe it allows us to deliver confidently, efficiently and in an agile manner, with very few bugs being introduced as part of the development process.This also limits redevelopment requirements later down the line and the resulting delays to project timelines.

Download
To download the assets, please enter your details below:
By completing this form, you provide your consent to our processing of your information in accordance with Leighton's privacy policy.

Thank you!

Use the button below to download the file. By doing so, the file will open in a separate browser window.
Download now
Oops! Something went wrong while submitting the form.
By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. View our Privacy Policy for more information.