Get a Head Start on Unit Testing

clean_code_thumbIf you’re eager, as I am, to get started with unit testing, I am very pleased to report that Ben Lobaugh (@benlobaugh) is speaking about this very topic at WordCamp Denver this weekend. If you have the opportunity, you should absolutely attend the event. I know you won’t be disappointed.

If you cannot attend, I have good news! Ben has written an incredible blog post about getting up-and-running with unit tests. In it he discusses briefly the merits of testing your code, how to install PHPUnit and the WordPress Testing Library, and even takes things to the next level with an intro to”continuous integration” (tests that run automatically every time you commit new code).

Read what Ben has to say on unit testing.

Ben’s post is a seriously great pre-requisite for this month’s session: WordPress Unit Testing. Once you’ve wet your appetite with Ben’s article you can satisfy your hunger learning from three more experts with live Q&A. If you haven’t gotten one already, you can save 20% on your ticket by purchasing it by Friday, Nov 15.

Writing Clean, Testable Code

Clean, Testable Code

Earlier this year my eyes were opened. While casually browsing around the web I happened across an amazing video featuring a man named Miško Hevery. In this video, Miško, a Google employee, was training other Google employees on the extreme importance of code testing.

The truth about Unit Tests

At the time, I knew only very little about unit tests. I knew that they were difficult to create and challenging to implement. As it turns out, I didn’t actually know anything.

Unit tests are both easy to write and simple to implement. What is difficult, though, is modifying your behavior in order to write clean, testable code.

I can say this: since watching the one-hour video below, I have completely changed how I approach functions and writing code. Everything I build is significantly better and easier to work with because of this.

If you’re even remotely interested in growing as a developer, I cannot stress enough the value of these lessons from Miško. You would be doing yourself a disservice if you didn’t watch this video. Seriously.

Writing Testable Code

But wait, there’s more!

When you’re through with this video, I also recommend reading Miško’s complimentary blog posts on the same subject: his Comprehensive Guide to Writing Testable Code and the more sussinct Top 10 Tips for Testability. Finally, don’t forget to attend this month’s session on Unit Testing.

How can we develop better?

I’m always interested in learning more and getting better. Do you have any great advice to share? Have you learned something new? Please share in the comments!