Should I Change My Code For The Unit Tests?

I don’t get tired of hearing that question, because if I did, I’d need to sleep for a couple of years. It usually comes up with unit tests, as developers prepare to test their day-old or year-old code. That question… Continue Reading…

“How to TDD in Legacy Code” From JCon 2022

I was honored to come back to JCON, and present “How to TDD in Legacy Code”. In Java of course. Ok, it was in English, the examples were in Java. TDD (Test driven development) is not just new code, you… Continue Reading…

“How to TDD in Legacy Code” Recording from Conf42 Python 2022

Well that’s a new thing! Sort of new. Well, the session is not new. Everybody now does TDD in legacy code. But in Python? Gil, are you saying that you can do these things in Python? Shocked, I tell you.… Continue Reading…

Gil Zilberfeld explains about refactoring test cases in legacy code

Refactoring Kung Fu – Part IV

The current code version we’re talking about is tag 1.1. Last time, we have surrounded our code with a boundary, doing some early refactoring. We now know the entry points, and the exits are covered by interfaces, leaving code we… Continue Reading…

Gil Zilberfeld explains the principles of refactoring legacy code

Refactoring Kung Fu – Part II

Last time I gave you a sneak peak at our PastaMaker. You can check the whole project here. Let’s take a closer look. The main logic is in our PastaMaker, so focusing on testing it makes sense. Most of the… Continue Reading…

Gil Zilberfeld goes through an example of refactoring legacy code, on the way to creating tests for it

Refactoring Kung Fu – Part I

As long time readers, you know that if we’ve got legacy code, we want tests for that. However, the code doesn’t always play along. As you’ll see in this example, this is the kind of code that really needs tests.… Continue Reading…

“Better Code for Better Tests” Slides from #LetsTest

Really sorry it’s the last Let’s Test. Great fun! Anyway, here are the slides. [slideshare id=75994166&doc=betercodeforbettertests-170515180216]

Over Exposure and Privacy Issues

This conversation comes up in every training I do about testing. I know exactly when it will happen. I know what I’m going to say, what they will say, and I know no one comes out completely convinced. Then violence… Continue Reading…

Error handling: Checking for exceptions

When we talked about understanding what we’re actually testing in error handling, we talked about the ability to understand the behavior of our code-under-test . Just to recall, here are the three types of error implementation, and what we can… Continue Reading…

Legacy Code To Testable Code #12: Instance Constructors

Other awesome posts in the series: So we talked about static constructors and how to go around them. How about instance constructors? Are they innocent or guilty of the same crimes as their static brothers? I think Java got the… Continue Reading…

Copyright Gil Zilberfeld, 2025