Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Skill Up: A Software Developer's Guide to Life and Career

You're reading from   Skill Up: A Software Developer's Guide to Life and Career 65 steps to becoming a better developer

Arrow left icon
Product type Paperback
Published in Jul 2017
Publisher
ISBN-13 9781787287037
Length 302 pages
Edition 1st Edition
Concepts
Arrow right icon
Author (1):
Arrow left icon
Jordan Hudgens Jordan Hudgens
Author Profile Icon Jordan Hudgens
Jordan Hudgens
Arrow right icon
View More author details
Toc

Table of Contents (5) Chapters Close

Preface I. Coder Skills II. Freelancer Skills FREE CHAPTER III. Career Skills Index

Chapter 39. Importance of Test-Driven Development for Coders

Let`s discuss the importance of test-driven development. First and foremost, if the terms TDD or BDD, which are short for test- and behavior-driven development, are foreign to you, they are the practice of building code tests for applications.

And even more specifically, TDD and BDD are software development processes in which you create a test that sets an expectation before implementing any code.

An example of using TDD to create a feature for returning a full name from a user class would be to:

  1. Create a test that calls a new method, such as full_name, that combines the first and last name of a user and returns a string combining the names into a single value:
    Importance of Test-Driven Development for Coders
  2. Then we'd run the test, knowing that it will fail:
    Importance of Test-Driven Development for Coders
  3. Then we would go and add a barebones implementation of the code:
    Importance of Test-Driven Development for Coders

    This will get the test passing:

  4. Then we'd go back and refactor the implementation to ensure it conforms to best practices and that the refactor...
You have been reading a chapter from
Skill Up: A Software Developer's Guide to Life and Career
Published in: Jul 2017
Publisher:
ISBN-13: 9781787287037
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image