Workshop: Test Driven Development with Java
Test diven development is so simple to explain - “Red, Green, Refactor” - yet still difficult to learn and master. But it can be a great tool in your toolbox. Working in the TDD way can help you create better designs. It can help you to know where to stop - i.e. to avoid “gold plating” your software. It can give you confidence during refactoring, which helps you to evolve your design and architecture.
When you first start with TDD, you will make mistakes. That’s OK, since you are learning. The problem is: Some of those mistakes will come back to you very late. It can be months or years until they bite you, but then they’ll bite you hard. Even if you are aware of them - Wouldn’t it be cool if you could practice TDD in a safe environment before you use it in a production software?
In this workshop, you will perform many exercises around TDD. Those exercises will help you to understand TDD, to internalise it, and to use it productively.
You have heared that some people are really convinced that developing software in a test-driven way is better and more efficient than other ways. So you want to try it. It works quite well for simple problems (“FizzBuzz”), but you cannot quite imagine how you could use it in the real world. How do you test user interfaces? Network API calls? Database integration?
There are some things you cannot easily from exercises. Because exercises are always too simple for the real world - by definition! But doing lots of exercises will help you anyway: They will help you to develop a “feeling” for the process: When to use mocks and when not, how to test external dependencies, how to create testable designs.
And a workshop will provide a safe learning environment for you for a few days. An environment where you can solve problems together with your peers and discuss with the trainer.
You are working on a legacy system and want to add some automated tests. Maybe you have some architecture documentation, but your “actual” architecture it quite different. There are some architecture violations and some design problems that make it really hard for you to add tests. Like, you want to add tests for a class, but this class is so tightly coupled to the rest of the system that you do not really know how to test it in isolation.
Adding tests to legacy code can be really challenging. But when you want to move forward, you have to do it. Otherwise it will be very hard for you to change and improve your architecture and design without breaking any functionality.
You are working on a large(ish) project that has a test suite. You want to change a very small piece of code, and suddenly, many tests break. Even though you are absolutely sure you didn’t change any functionality. You have a feeling that the tests you have are an impediment to refactoring. After every little change, you have to fix a dozen tests.
You are experiencing a problem that many teams face when they start with TDD or unit testing in general. Your tests are creating a lock on how the code are implemented. Maybe you use mock objects in a way so they’ll make the code harder to test. Your tests are probably not really independent, that’s why many of them break at once. I wrote about some of those problems earlier in “The Mock Objects Trap”.
Introducing the Workshop "TDD in Java"
In this hands-on workshop, we will start from zero (what is TDD?) but we will also practice advanced topics (Inside-out vs outside-in, mock objects, object oriented design and TDD, …). Do you have only little experience with TDD and want to try it out? Or do you want to improve your existing TDD skills in a relaxed atmosphere? Join this workshop and practice together with your peers.
What you will learn:
- Test First vs. Test Driven Development
- How to write the first test / the next test
- How to write good tests
- Tests as documentation
- Outside-in vs. inside-out TDD
- Effectively using test doubles (Mock objects, stubs, fakes, ...)
- Refactoring to improve your software design
We will do all exercises using the Java programming language and JUnit. We will mostly concentrate on TDD itself, but we will also discuss some interesting features of JUnit and our mocking framework Mockito.
You will practice your TDD skills in a safe learning environment. An environment where you can take the time you need to learn together with your peers, to solve problems and to discuss what you have learned. Even though we can only do small exercises in the workshop, those exercises will help you to internalize the test-driven way of working. So, when you are back in your day-to-day work, you don’t have to think about “Red-Green-Refactor” anymore, and you can concentrate on the functionality you want to implement.
How We Will Work Together
I come to your company and we spend one, two or three days learning new things. Or even better: We book a nice training location near your company, where we can get your developers, testers, Scrum Masters or Product Owners out of their daily routine.
Next Step: Book Free Skype Consulting
Now we should find out if working together would make sense for us. I want to talk to you about what I can do for you. I would like to have a 30 minute Hangout or Skype call with you, where we can talk about what you need and how I can help you.
Still Not Sure?
Start with asking a question. Any question, really…