I will be in Vienna again in two weeks, from Feb 15-19 ,doing my TDD master class . There are two seats left – and I’d love to see you there!
here’s what other people who attended had to say about this class.
You can register here.
before scott bellware disappeared off the twitter radar, he kept talking about the idea of “celebrity” being the big problem with communities such as ALT.NET, and lately with the Lean and Craftsmanship movements.
I actually think that celebrity is an essential and important driving force for any programming community.
The analogy I can draw is to the drug-creating companies. drugs helps people feel better – they make the world better, actually. but they are not free. in fact some of the most helpful drugs out there are far from easy to purchase, and cost so much money you’d need to sell a house or two to sponsor treatments using them.
That’s not by chance. Drugs need to cost money so that the companies that make them have a good incentive to do the heavy lifting when it comes to researching the creation of new drugs. The fact that drugs cost so much money actually helps drive the creation of new and better drugs to the world.
taken a few notches down, many developers, consultants and trainers out there want to become some sort of vertical celebrity in some field in software. They will work hard to drive and become a specific field where they will be known as someone to go to in that field. They will do the heavy lifting when it comes to researching new and exciting methods to develop software, to use new programming languages and to bring something new to the existing world we live in.
The need for people to stand out in the crowd is a very large driver for change in behavior, practices and whole methodologies.
But what happens when those people get what they wanted? maybe they will just stand still, trying to hold on to the thing they’ve gotten, protecting it from others? No to worry. For each existing celebrity, there exists N unknown future celebrities who also want to stand out. they will be forced to drive through, to push other boundaries than the ones that already exist (since they already have people associated with them) and to drive home a new concept, language, practice, methodology – anything unique that can make waves in the community, and by chance also get their names up in print somewhere in the future.
It’s free market, and trying to throw rocks at those who’ve already achieved this is as useless as telling drug companies to lower their prices. Don’t worry – there’s always another company out there with the next big cure for something – the existing companies cannot hold back progress- since it’s ingrained in people.
In a previous post I explained the different between Continuous Integration tools and Build automation tools, but there’s also lots of be said for HOW to pick a specific CI or BA tool.
What do I look for in a CI tool?
- first and foremost – how intuitive and usable is it? how easy is it to add, remove or change build configurations? How long will it take me to explain to a new dev on my team how these builds are connected?, and how long will it take them to change or fix a build related problem?
- Does it have the ability to run builds on “slave” machines or just on the local machine where its installed?
- Do I need to use XML to configure it?
- How easy is it to see the status of a build, history of builds?
- can I “kill” and detect a “stuck” build?
- How long does it take to setup?
- Does it have good metrics?
- does it contain ability to launch random “exe” or “command line” batch files?
- Does it allow for build hierarchies? (builds that depend on each other’s output, or that trigger each other automatically, or that all have to pass )
- Is there a large community or product support in case of a commercial product?
- How much does it cost? will it cost me more to use a “free” tool given the questions above?
What do I look for in a build automation tool?
- first and foremost – how intuitive and usable is it? is the configuration interface visual? XML based? tree based? how easy is it to add, remove or change existing scripts? How long will it take me to explain to a new dev on my team how the build works, and how long will it take them to change or fix a build related problem?
- How many built in tasks are there with the tool? the more “custom” tasks i need to create to make my build work, the less productive I am
- How easy is it to create a custom task? in what language? how easy is it to integrate a custom task into a build flow?
- Can a script run other scripts ?
- How easy is it to read the log generated by the build tool?
- How well does it play with my existing toolset? (if I use TFS – can I easily invoke it from TFS? can it invoke TFS related things like add new TFS task items?)
- Is there a large community or product support in case of a commercial product?
- How much does it cost? will it cost me more to use a “free” tool given the questions above?
Bonus question:
- Am I choosing this tool blindly because someone I respect is using it, or did I check other options and this choice is based on the actual pros and cons of the tool?
The January meeting of the Israel Dot Net Developers User Group will be held on Wednesday January 20, 2010. This meeting will focus on real-real issues and practices in developing unit tests, with a variety of tools. Our speakers will be Dror Helper and Gil Zilberfeld from the company Typemock.
Details of his special user group presentation are given below:
Please register for this event at: IDNDUG January 2010 registration
When: Wednesday January 20, 2010 At:
Microsoft Israel
2 Hapnina St, Ra'anana (09) 7625-100
Floor 0 , Dekel Room
It is the building across from Amdocs.
Turn right at the first traffic circle and then there is an area for (free) parking.
Abstract:
Unit tests increase the programmer’s confidence that individual units of source code are fit for use.
Although most software developers have heard about unit testing and some even use TDD at their work there is more to unit tests then writing tests using a framework.
This session is intended for developers that want to know more about unit testing and TDD and how it can help them produce better code.
Part 1 – Real life unit testing
Tools are not enough. If you want to succeed overtime, you need more ammunition. Some people call them best practices. We call them real life lessons. Let’s share.
· Why should every developer unit test his code
· Unit testing tools
· TDD & Unit testing best practices
· How to avoid writing fragile tests
· Testing special scenarios
Part 2 - How to make a mockery
So you’ve decided you want to unit test. Good for you. But are you ready for the next step? In the real world, applications are so complex, that in order to test a component in isolation, you need a new set of tools.
He’s what we’re going to learn:
• What’s the problem?
• Why is it so confusing?
• That’s how I roll (my own mocks)
• All sorts of Isolation frameworks
• Road-bumps and stabilizers
17:30 - 18:00 Assembly
18:00 - 19:15 “Real_life Unit Testing”
Dror Helper and Gil Zilberfeld, Typemock
19:15 - 19:30 Break
19:30 – 20:30 “How to Make a Mockery”
Dror Helper and Gil Zilberfeld, Typemock
About the presenters:
Dror Helper is an experienced software developer currently working at Typemock where he develops unit testing tools. Over the past 7 years, he has designed and developed applications in various fields including video streaming, eCommerce and performance tools. He is passionate about programming best practices and unit testing, and is always willing to talk about the subject. He was a guest presenter at several user groups. Visit Dror’s blog (http://blogs.microsoft.co.il/blogs/dhelper/) where he writes about software development and best practices.
Gil Zilberfeld has been in software since childhood, starting with Logo turtles. After 15 years in commercial software companies, he has vast experience in development and development practices. Currently Gil is the Technical Evangelist of Typemock, promoting unit testing and some incredibly cool tools. He's also taken part in the Alt.Net Israel community, and has run talks in different groups. Gil blogs on the Typemock blog (http://blog.typemock.com). Gil and Dror produce the “This Week in Testing” webcast on the Typemock site.
Take Care,
Lots of people have a common misunderstanding of the (subtle) differences between the various tooling regarding continuous integration and build automateion. Here’s the gist of it:
Build automation:
Build automation tools are tools you use to automate the build process, instead of doing it manually. Build automation tools include:
- batch files
- MSBuild files (csproj and vbproj files are really msbuild files inside, for example)
- NAnt files
- FinalBuilder (slick, visual editor, hundreds of built in tasks)
- VisualBuild (slick, visual editor)
- Rake (based on Ruby)
- BooBS (Boo Build System)
Continuous Integration:
CI tools are the triggers that listen to various “events’ in the network (a check-in to source control, for example could be a trigger. You can configure these tools to do a few simple things when an event happens. One of those things can be to invoke one of the tools in the previous list. Some of the CI tools, though, include a few simple built in build atomation power (such as built in MSBuild support, or running tests) but you would do much better choosing a CI tool that invokes a build automation power tool, since each are design with different goals in mind.
CI tools include:
What should you use?
I really like to take the best of each category. I’ve found the combination of using TeamCity to listen and configure events which then triggers a FinalBuilder script file as an ultimate combination of both power and (very important!) maintainability and understandability of the process.
I really despise tools that force you to configure huge xml files (msBuild, CCNet, NAnt) as that is a maintainability nightmare waiting to happen.
BizTalk is notoriously hard to test. But I just came a cross a couple of interesting solutions to do unit testing for biztalk related logic and orchestration.
- BizMock :
“BizMock is a framework for testing BizTalk solutions, using a Domain Driven Design (DDD) approach and fluent interface API. It has mocking capabilities, so no need to rely on dependent infraestructure like web services or DBs. The tests are writen and executed from within VS using regular Visual Studio Tests and C# code, allowing a TDD and agile development style of BizTalk solutions.”
- Bizmonade: (I really don’t like the name)
“Bizmonade is a new project being developed to enable unit testing of BizTalk orchestrations, in isolation of other components, without deploying the orchestrations to BizTalk and without doing any configuration (bindings).
It allows running orchestrations directly from unit tests written in C#, using NUnit, MSTest or any another .Net testing tool. The orchestrations therefore run in complete isolation from the whole BizTalk environment, reducing the time needed to do quick tests of new orchestrations or of modifications to existing ones.”
the API for BizMonade looks really interesting, but since I’m no Biztalk Guru, I don’t know if it satisfies what you’d want to test in a biztalk solution.
With BizMock, the fact that one would need a “DeploymentItem” on the tests might mean that it’s an integration style test framework that’s just easier to get up and running, but not a “pure” unit testing solution. However, I’m not sure since I have not used it.
Do you use these? or other solutions?
Update: there’s also BizUnit , but god help me if I ever recommend people to use XML for making tests. DON’T USE XML.
Please.
if you use NUnit, did you know it has a fluent API option? Do you use it?
you can write the following:
Assert.That( someString,
Is.Not.Null
.And.Not.Empty
.And.EqualTo("foo")
.And.Not.EqualTo("bar")
.And.StartsWith("f"));
Assert.That(someEnumerable,
Has.Count.EqualTo(2),
.And.Contains.Some.Matches(x => x.FirstName == "Jim")
.And.Contains.None.Matches(x => x.LastName == "Jones"));
Assert.That( x => <some code>,
Throws.TypeOf<ArgumentException>().With.Message.EqualTo("Too Bad!");
Want to be famous? If you’ve used SilverUnit to successfully help you test your silverlight code, I might be able to help.
I’m working on a conference talk showing SilverUnit and the idea of system wide isolation, and I want to also mention people who’ve used SilverUnit to help solve tough testing issues. I’ll also be doing a short song about this, and if you send me a cool story of how it actually helped you, I’ll include your name in the song which will be videos and put on my site for the world to see :)
Ping me and tell me all about your SilverUnit success story.
How long i’ve been looking for some concrete list of interfaces – god knows. There is only this category-like list of possible extensible areas. but that’s not good enough.
went to Reflector, and analyzed all the usages of ImportAttribute in the visual studio assemblies.
For future lookup, here’s the full list of interfaces that can (and are) used to extend visual studio 2010 functionality. I’m sure most of it is not usable , but it’s good to know just how big this ecosystem is.
nice and simple, eh? (1.1 mb file of this image is here)
Today in class I got to understand, for the first time, what I define as “the simplest thing that could possibly work” when doing TDD. Many people struggle with the idea of simplicity. the idea of doing things to the point of “micro-increments” to the code, that will then help in driving out new tests that you had not thoguht about, is really tough.
what’s missing is a simple set of rules you can check your implementation against.
here’s a set of rules to serve as the basis for this discussion. I’m sure there are more, and i’m sure this will change over time, as defining this “simplicity pattern” is a rather new thing for me. I have not seen this done elsewhere.
the situation:
- You had a failing test
- You went to the production code, and made the test (and all other tests) pass, in the simplest way you thought possible.
- But was it really the simplest way?
look at the code you just wrote in your production code and ask yourself the following:
“Can I implement the same solution in a way that is ..”
- “.. More Hard coded ..”
- “.. Closer to the beginning of the method i wrote it in.. “
- “.. Less indented (in as less “scopes” as possible like “if”s, loops, try-catch ..”
- “.. shorter (literally less characters to write) yet still readable ..”
“… and still make all the tests pass?”
if the answer to one of these is “yes” then do that, and see all the tests still passing.
the trick is this: by doing this, you’ve implemented the same feature (or part of feature) and yet you knowthat the feature is not complete yet. Something is missing. it might be too hard coded now, or not in the correct scope or it’s missing a check.. but all the tests are still passing, so you can’t change the code now(in tdd you can only change production code functionality when you have a failing test)!
what do you have to do to be able to change the code?
Add a test that proves that something is missing in the code!
sometimes, you might discover that the simpler way is actually a good enough solution that does not need changing, or any more tests.
either case, you’ve won – you either got a simpler solution to the same problem, or you discovered a test that was missing.
Example:
say, that, you had a new requirement to add a call to a logger when a login succeeds for a user. I won’t show the test that failed, just the code that you might have written to make the test pass:
You added one line of code, that calls a logger with the string containing the user name and a short message.
Now, let’s see how we can make this implementation simpler, without breaking any tests:
1. can I make it “.. More Hard coded ..” without breaking tests?
YES (I only have one test)
assuming the test was trying to log in with a user names “testuser” i can make the test pass by hardcoding the user name. this would force me to write another test that sends in a different user name to the method, that proves this cannot be a hard coded string.
2. can I write it “.. Closer to the beginning of the method i wrote it in.. “
YES. Assuming there is no test that assume logger is called otherwise from this method, I can do this easily without breaking the test. I’ll just move the code up to the start of the method:
3. can i make it “.. Less indented (in as less “scopes” as possible like “if”s, loops, try-catch ..”
YES. I already did, in the previous step.
4. can I make it “.. shorter (literally less characters to write) yet still readable ..”
doesn’t look like it.
now, I have this code, and i know it is not good enough. I need to prove that using tests before I can change it, which forces me to think of two new tests: one that logs in with a different user name, and another that makes sure the logger is not called unless the login is successful.
Are these tests valuable?
I’m not sure. Do we really need a double test with two different values? I’m partial to this.
Do we realy need a test that proves something doesn’t happen? not crazy about it. it feels a but like over specification – why should i care if the logger is called or not in a place I don’t care about in terms of functionality? that test would break the second someone would add logging there, which is obviously needed, so it might just be a test waiting to be deleted.
on the other hand…
doing things so incrementally is a god way to teach small, incremental steps. as students become proficient, they can choose which increments to skip, but these small steps are good for “muscle memory” during kata training.
should i really forgo these increments (therby loostening up the need to “micro-increment” and giving up muscle learning) in favor of teaching types of tests that arn’t needed? or is muscle memory important enough to “sacrifice” some robustness in a few tests (which is also very very important).
which value is more important? micro-increments? or recognizing un-needed tests? which one is easier to learn later? it seems micro-increments (the way i teach) require writing some tests that may feel un-needed. but do I really want to let go of forcing this very powerful habit?
More Posts
Next page »