Use Test Driven Development to hone your testing skills and cut down on project delivery dates

Any good developer knows how critical testing is for an application to run flawlessly. The traditional approach to software development looks like this: Requirements> Analysis> Design>Code>Test>Deploy. However, this can create a number of problems especially during the testing phase.

  • Developers often “feel” their way through the coding process and write code without understanding what it’s supposed to do, resulting in a bloated or clunky code base.
  • Because the code base is tightly coupled, subsequent testing and refactoring one part of the code base can break other parts, resulting in longer development times and higher costs.
  • Traditional testing methods might let certain use cases slip through the cracks resulting in an unpolished and unstable final product.

Introducing TDD- a new approach to development

An alternative approach that is better suited for Agile development is test first, code later. This approach is called Test Driven Development (TDD). 

How TDD works:

  • You write a test case first that defines a new function or feature. You run it. It fails because there is no code to test it on. This is Red.
  • You write just enough code and run the test again until the test passes. This is Green.
  • You then clean-up the code, remove any duplicates and complexity so that the code meets standards. This is Refactor.
  • Rinse and repeat the Red-Green-Refactor cycle with other features, building on the clean and working code that is already in the repository.

So why should you care about TDD?

  • Makes customers happy. You start with the top priority features and work on them instead of wasting time on superfluous code.
  • Eliminates that scary scenario in the middle of a testing cycle when code breaks for no apparent reason and you have to spend days with the debugger trying to find out where the issue is.
  • Ensures that all features will be thoroughly tested before deployment, unlike with ‘code first test later’ approach, where testing might not keep up with the addition of new features.
  • Cuts down on maintenance costs as the test cases give developers a thorough understanding of the system.

Essentially, if you want code that is testable, modular, simple and easy to read you will want to go with Test Driven Development.

In other words, TDD = High quality code

Will TDD work for you?

There are many scenarios where using TDD isn't suitable. You should stay away from TDD if:

  • You are charged with maintaining legacy code that's heavily coupled.
  • You are not familiar with Agile development methodologies.
  • You don't have support from management and fellow developers, who are not exposed to TDD principles.
  • The requirements are not clear at the start of the project.
  • You are working with complex test cases where it is much harder to predict the final behaviour.
  • There are no experienced developers who are proficient with at least the basics of TDD and related techniques like using a mocking framework and pair programming.

Introducing TDD Immersion day at Inviqa for PHP developers 

If you feel that TDD can enhance the value of you as a developer, we’ve got some great news.

We offer a one-day intensive workshop where you will understand how to use TDD in your PHP projects. This workshop will be a mix of theory and practice with real-cases and is the first step to making you a TDD expert.

What are the eligibility requirements?

You need to have an exposure to object oriented PHP with some experience in testing.

Who will lead the training?

Marcello Duarte, the lead trainer at Inviqa, will be in charge. He is a Zend Certified Engineer and a Certified Scrum Professional. He is also the author of the award winning Quinoa framework, lead developer at the open source PHPSpec framework and a certified PMP. Marcello is an experienced coach and has trained teams in many organisations in Agile processes and development practices. 

Do we need to bring anything?

Only laptops. We will provide the course materials.

TDD Immersion day course agenda

Your day will start at 9AM and end at 5PM. This is what it will look like.

9.00 AM to 10.45 AM

phpspec Tutorial: phpspec is a PHP development tool that aids you in understanding how code should be designed. This tool lets you generate or edit specs, run specs, generate code and edit code.
You will take a deep dive into various features of phpspec like Matchers and Formatters and learn techniques like decoupling code using phpspec. This session will be helpful for both beginner and experienced testers.

11.00 AM to 12.30 PM

Coding Kata: For 90 minutes we will pair you up with another participant and let you get your hands dirty. You will practice TDD techniques using simple examples and will be taught how Pair Programming works, including how to pair correctly and what each role entails.
Pair Programming is a valuable technique in the context of TDD because talking and working with another developer gives you the clarity needed to write out the tests and follow through with multiple test-code-refactor cycles.

12.30 PM to 1.30 PM

Lunch

1.30 PM to 2.20 PM

Driving composition with Mock Objects: In TDD mock objects are special test doubles that are used as stand-in for real objects during testing. A mock object helps developers check whether the output of an object is along expected lines.
This session will teach you how to create mock objects using language frameworks. It will also teach you how to handle other test double patterns
like dummy, fake and stubs which are used during TDD. 

2.30 PM to 5.00 PM

TDD guided exercises: The trainers will lead you through multiple exercises that are aimed at bringing everything together and applying what you have learnt so far in a real world context.
These exercises will help clear any doubts you have about TDD and give you enough confidence so that you can start using this approach in your workplace.
 

What developers have to say about the TDD Training

TDD Immersion Day Quote 1TDDImmersionQuote2v2TDDImmersionQuote3v2

TDDImmersionQuote4

TDD in a nutshell

Test Driven Development will make you a better developer if you work exclusively with Agile development methodologies.

  • It will shorten the time to market and improve the quality of your code.
  • It will give you a better understanding of how the innards of your application work.
  • You will no longer have to patch code to make it run.
  • You will not have to dream up outlandish hacks to update your app or add new features.
  • Your productivity and value as a developer or a team will increase in the long run.

Interested?

If you'd like to arrange a TDD Immersion Day for your development team, get in touch