Hanalei, Hawaii Monday, February 08, 2010

Kona: Continuous Integration and Better Unit Testing

This screencast went from a simple idea - talking to Brad Wilson about better Unit Testing - to some pretty broad topics such as source control, unit testing, and continuous integration. I seriously could have written a whole book based on the stuff flying through my mind.

This screencast went from a simple idea - talking to Brad Wilson about better Unit Testing - to some pretty broad topics such as source control, unit testing, and continuous integration. I seriously could have written a whole book based on the stuff flying through my mind. I reigned it in a bit and decided to focus on two things that I don't think get enough press: writing a good Unit Test coupled with Continuous Integration. It still came in at 50 minutes - oh well. I think it's all good. What I decided to do was to answer the following question:
Why should I care about Unit Tests (aside from being made fun of)? Why should I care in a Business Way?
When talking about Unit Testing (and TDD for that matter) most people will say "yah I know I should be writing more tests." in a "yah I know I shouldn't drink so much beer." sort of way. This isn't really a healthy thing - you shouldn't feel that you need to write tests to be a good person (though a few folks might say so). You're a smart person - and I'd like to respect that and see if I can appeal to your business mind. What if I told you that if you spent some time mastering Unit Tests (coupled with a Build Server) you could:
  • Code in less time
  • Prove you're finished (bug free)
  • Come in under budget
  • Sleep at night
If this sounds interesting to you - this screencast is for you. I should mention this is only an introduction; if what you see here appeals to you I'd like to suggest you get on down to Borders or hit Google to find out more! The Code is Here You can download the screencast here (double-click to view full screen)


robconery - April 9, 2009 - This is just cleanup on my part...
arezkiStoreFront - April 9, 2009 - Rob,



Again excellent screencast.



I have small questions, in your code you have:



StructureMapControllerFactory.cs

KonaControllerFactory.cs



which are exaclty the same, what is the rule of avoiding duplication of code. Is there a tool out there that can link user stories to unit tests?



Thanks and keep up the good work



Yaz

DaveMac - April 9, 2009 - Totally agree with fireflys point. If you work alone (probably in a dark room, drinking excessive amounts of red bull) and know your code inside out then unit testing maybe not be for you.

But as soon as you introduce a team you obviously increase the chance of mistakes being made. Having a good set of tests to run, quickly gives you peace of mind (and a good nights sleep!). They become even more valuable when you have 2,3,4 other people working on the same project.... and even more so if you team is rapidly growing

robconery - April 9, 2009 - Thanks Kay - I think there might be restrictions on the number of users -

not too sure.
Kay - April 9, 2009 - What's exactly are the restrictions of the free edition of TeamCity? I read about it on the JetBrains page, but I really don't get it.

Currently I'm using CC.Net, but TeamCity really looks promising.



Thanks for any explanation and a really good screencast BTW :-)
arezkiStoreFront - April 9, 2009 - Mr Brainy



TDD is about:



Design

Executable documention

Continuous Integration.



Funny you mention Debug, why do you debug?



Because you do not know what is happening. This is a time when you needto write a Unit Test.

Most often if you cannot test something it is because the code is not well designed.



Cheers

Yaz

firefly - April 8, 2009 - You are working by yourself so that explain everything :)



Unit Testing is vital when there are multiples people working on multiples project. It's not about proving oneself. It's all about quality control. Human are prone to mistakes; now if we take that to a team environment that error factor quickly become a factorial.



Speaking of business requirement then Unit Testing are one way to make sure that we are, at least, satisfying the basic requirement.



Now TDD is another story, I think it's a nice design tool for a small module but for a large project it could quickly turn into an architecture nightmare.
robconery - April 8, 2009 - TDD isn't a Silver Bullet and I wish I would have made that more clear. All

I ask is Unit Testing :) but I'm glad you found it useful!@
ms440 - April 8, 2009 - Rob,



Thank you very much for the excellent presentation. It will help me a lot to convince my bosses :)



I was pleasantly surprised that you are using TeamCity - so am I for the last year (currently in the third big project). Before that I was using different continuous integration tools - CC.NET and CI-Factory.NET. They are OK, but TeamCity is a real improvement.



TDD is a hot topic in my team for quite some time - as you said many times, it does require a different mind set. It also not very easy to push into the project plan, etc. As someone mentioned here, we're paid for the "productive" LOC, not for the unit tests. Again, your presentation will help a lot!



In our current project (SubSonic 2.1 based, btw, we look forward for 3.0 please, please) we are using TestDriven + MbUnit + Galio but mostly as a regression insurance. It takes time and efforts to switch to TDrivenD...



Thanks Rob & Brad! You guys are great :)



robconery - April 8, 2009 - As I mention above - sometimes there is no convincing better than

experience. If you don't believe me, check this out:

http://code.google.com/p/subsonicproject/source/list



I rapid-fired about 40 bugs today and I feel great that the patches sent in

didn't break anything. I added tests for each feature and I moved through

this bug list at lightning speed. It really doesn't matter the size of the

app my friend :).
Santos Ray Victorero, II - April 8, 2009 - Mr. Brainy (I doubt it!)



Test Driven Design is a development technique:

http://www.agiledata.org/essays/tdd.html



If you are so "smart" why you don't identify yourself? :-P



brunocaimar - April 8, 2009 - Awesome screencast. I'm using CC.Net but Teamcity really looks very easy to use.

Brad Wilson's tip about naming methods was great too.
William - April 8, 2009 - Actually I am a testing person, I have been down the path of writing tests both unit, integration and security based tests, I just don't believe that you have to write a test for everything and I don't believe in the false sense of security that testing can offer at times. You have confidence in your code after you see the green lights, I have confidence in my code as I write it so what (if any) is the difference? Just because you have a full set of tests your code is better in some way or will magically make the client that much happier? That would be very ALT.NET of you to think that. :P



Your example about Subsonic is what I am getting at, your code/component is used for a much bigger picture so of course you would write tests for it. The people who use it would be pretty PO'd if you gave them buggy code. So the need for testing is almost a requirement.



How do you know that people don't already say "Dude, Will is so professional - you can't argue with these results and he only writes tests 25% of the time!". Just ask me people say it all the time ;)
robconery - April 8, 2009 - Again - you're confusing TDD with Unit Testing :) and unless/until you try

it for yourself and see that it can work well for you (despite the weirdness

of it) - well then there's not much I can offer :). And that's OK - *as long

as you're still testing your code*

That's my ultimate point - not TDD but Unit Testing :)
ruffone - April 8, 2009 - I am sorry, I will get acquainted with it.
ruffone - April 8, 2009 - I am no fancy developer. Coding is not even how I make a living. But I have being around these controversies since the days of WYSIWYG or Notepad, that became FrontPage or Notepad, Web Matrix or Notepad. There was something between FrontPage and Matrix I think. There was a resistance to all these tools in favor of Notepad and other text editing tools because which ever of these tools used. If I missed a comma the app would be in debug for a month. So there was not sufficient benefit to learning the new interfaces and paradises.



I remember sitting in my local ASP.NET Developers meeting in NY City and watched a bug filled demonstration of app, point of which to demonstrate IntelliSense given by a purported member of the Dot Net Team. I wish I remembered her name. I just never thought I would ever recount the occasion. That room of about 150 in attendance, (if I remember correctly they were giving away a copy of Visual Studio to all in attendance) irrupted in applause for at least 5 minutes. (and I am not exaggerating). The domo needed no further explanation. It just maid sense I don't think anyone use Notepad for code development since then.



The point is, the resistance to this TDD is not because it is not a good idea. It's not because there isn't huge benefits to it's implementation. It's not because the developer is not serious about his work. The resistance is because it is cumbersome and tedious to implement. The developer has to implement it at a cost to his bottom line for no benefits for himself but for the satisfaction. Inside an organization where application are written for resale there as an assessed cost benefit structure for quality control and all the benefits mentioned in this blog. This implementation of TDD makes sense in these kinds of operation. In an operation where the developer is under the gun to meet deadline for new tools and keep the operation up and running and make a profit we need a solution that needs no explanation.



I know, with all my responses it is probably bordering on abuse. But I have seen this pitch all over the place by our elders and I think it is a little coordinated and a little preachy when there is a long history to show that the community responds in a positive way when the implementations need no explanation.
robconery - April 8, 2009 - I'm still struggling with taking you seriously - I kind of have a feeling I

know who you are and that you're having some fun with me... could be... not

sure yet... getting there...

If you are serious - well it reminds me of about 100 different projects I've

picked up written by you: Rewrite :).
boj - April 8, 2009 - "...by me alone..."



Inexplicable...a so nice guy works alone. No employee, no colleague, no team. A big loss for the world and the community!





XD
boj - April 8, 2009 - Hey,



that's was awesome! I'm a big fan of CC.NET but TeamCity is already in my VPC too. Please make more and more and more and more screencasts!:)



Bests and really congratulations!
Brainy - April 8, 2009 - Regarding maturity and taking your work seriously, there is a level above the one you are talking about. At that level you hold your system in your head and can know that you have not broken anything when making changes. You know how things work and what your changes do. You do not need crutches to help you feel confident about work you've done. You know it.



If your goal is to prove to someone quality of your code then by all means unit testing is the only way to do that. Most of developers are not hired to do that, rather they work to satisfy business requirement and support some business process. You can create set of tests that validate that but proving the quality of the code itself is not most of customers are willing to pay for.
robconery - April 8, 2009 - The interesting thing here is the TDD is relatively new - *not* Unit Testing. That's been around for a very, very long time :) and it's something people should always do - no matter their feelings about *when* they write the tests.



Good points - the Return key is your friend also...
robconery - April 8, 2009 - Brainy for what it's worth I don't mind counter-arguments, but if you're going to act like an asshole (like the last two comments I've just deleted) I'll delete your stuff.



As far as I can tell you're more interested in being a dick and are trolling - tell me if I'm wrong.
Mark Nijhof - April 8, 2009 - Hi Rob,



Very good introduction in how to get started with TDD, forwarding it to our internal mailing list. I like the fact that it almost looks like you went out of your way to get non Microsoft products in there :) even the browser is Chrome.



-Mark
Mark Nijhof - April 8, 2009 - Team City is free as well for some (actually not so limited) use.



-Mark
ruffone - April 8, 2009 - This is a heart felt but sad commentary. Not for what it says about huey but for what it says about Unit Testing. Sadly huey has expressed my experience and I am willing to bet the experience of more than a few people who has tried this concept. I beg to differ with Brainy's statement "Unit testing is for crappy, weak developers." I think Unit testing is for strong experienced developers who is reminiscing of the days of ado.net and looking for new challenges. Unit testing the way it is done today is king of like Classic ASP. A hodgepodge of stuff throne together to fill an emergent need. If you did well with those tools that it was built from or if you worked really hard to overcome the learning curve then you did well in Classic ASP. When people sat down and built ASP.Net with intellisense then building websites became more natural. I think the same kind of thought need to be put into this Unit Testing concept before the evangelist go off seeking soles. If it is natural they will come. Ask the same questions that was said to be asked when Linq went into development and see where you end up. Because this to me seem to be a level of complexity creeping back into coding to rival the issues that were said to be found with T-SQL. But unlike T-SQL it is hard to explain to our employers why they should pay us to write Unit Test while there application languish.



WOOOH! talk about long winded
robconery - April 8, 2009 - I used to think just like you and (cue a Green Eggs and Ham moment..) had my

mind changed rather dramatically.

First, however, yah - I (used to) have 3 paypal.com domains as feathers in

my hat, my little pride and joy :). No, I didn't sleep - I was worried about

a lot of things. Yes, a complete set of tests would have made me feel better

about every push - so I do know something about Big Domains.



I won't lie to you - it takes time to get the hang of proper testing and to

get good at it. Once you do, you start to realize that tracing the

"co-incident" bugs you introduce is cut by an order of magnitude. So it's

not really up-front costs that you save, it's maintenance.



For instance, I'm adding lots of patches to SubSonic right now - every time

I do I run my tests. When I get all greens my level of confidence is pretty

high. I then added another test or two and make sure the patch fixes what it

said it would then I'm done - and I feel great about it.



Without tests - I wouldn't, and I'd spend a lot more time worrying about it.



The main thing here is that people like this stuff for a reason - and it's

not because we're greedy guys who want to charge more. If you've run a dev

shop then you're familiar with a developer saying "this works". Let's say

he's your ace developer - he rocks. How do you know he's done? Because you

trust him? Is that a good statement?



I trust every developer that's worked under me - it doesn't mean that I

shouldn't check their work. You need to be sure. If you see the results of a

set of tests and code coverage - you're sure.



So - it sounds to me like you're not a testing person - and that's your

choice. To me it's a maturity level that you reach in this profession when

you, quite literally, start taking your work seriously. You might bristle at

this - and you might think I'm being mean :). But consider, for a moment,

that we're talking about you proving the quality of your code to others.

This isn't a game of "I know Will - he's good people" it's a game of "Dude,

Will is so professional - you can't argue with these results!".



All I ask is that you try it and see. I promise you that if you give it some

time you'll have a change of heart.
William - April 8, 2009 - "Code in less time"

With writing Unit/Integration tests isn't that like writing 1.5x the amount of code? Better yet I have found that some Unit/Integration tests have 3x more code than the actual code being tested. So I am not aure I believe in that one based on experience myself



"Prove you're finished (bug free)"

The code is bug free but in my experience it's not bug free until it is live and running without issues or do you run the Unit/Integration tests on the live environment too?



"Come in under budget"

Does that include the cost of the Unit tests? Try and explain charging 1.5x more than the next guy so you can write tests to make sure your code works, tests that the end user probably sees no value in no matter how many times you explain it. Shhhh that is a consultants dirty little secret...



"Sleep at night"

You have never maintained a site that gets 20k+ unique visitors a day and have rolled out updates every day for a week have you? No amount of Unit/Integration testing lets you sleep at night. Every environment is, well, just different and for some reason it usually never goes your way.



But seriously there are good and bad reasons for doing / not doing Unit/Integration testing, the bottom line is what kinds of code are you testing? Do you need to write tests to prove your database call is going to work or the file is going to be written? Probably not, however logic frameworks, business rules, CPU bound code should require this kind of testing because it is most often used in a bigger system. That should be tested automatically. The rest; meh.

robconery - April 8, 2009 - Millions! Why not billions! You lazy ass...
robconery - April 8, 2009 - You're awesome! I wish I was you :)
robconery - April 8, 2009 - Yah I did a whole section on Unfuddle but it sounded like i was pitching it

(which I sort of was :). Given that i was up to 50 mins i had to cut it :)
Brainy - April 8, 2009 - Are you available for hire?
Brainy - April 8, 2009 - C# dude and I made millions of USD's with it...
Brainy - April 8, 2009 - Rob, the point is that you don't need unit tests and TDD for everything even large system. It depends on what your project structure is.



As I said, you need those things because you either have clueless devs on project or just not so experienced ones.



I see incompetent and lazy developers hiding behind TDD, unit tests, patterns and refactoring... I have nothing against these techniques but everything has its place. You do not need 100% Unit Test coverage if you have competent people on project...



Peace brother!
Matt S - April 8, 2009 - Hi Rob, hosted SVN is a good way to go too. I use Unfuddle, which also has a very nice ticketing system. One less thing to worry about in terms of installing and you can get to it from home or at the office. I also like that it's offsite so if my server goes south don't lose the whole shooting match.
Todd morrison - April 8, 2009 - Hey, I have been playing with a Small Agile Team Feature Crew process.

Developers, give me some feedback as to how I can improve my practices: http://www.deepelement.com/blog/post/2009/04/08/Feature-Crew-Model-for-Small-Agile-Teams.aspx
Noffie - April 8, 2009 - You have 300,000 LOC? That is so crappy and weak. I could have written that system with THREE lines in a DOS batch file. Oh, and of course ZERO wimpy unit tests.
dustinson - April 8, 2009 - You've been working on the same app for 10 years by yourself? Good for you! I only took Wedding Vows.

Good luck with the next 20 years. If this approach works for COBOL why not other languages?
Chad Moran - April 8, 2009 - I don't think anyone has ever said you can't code without tests. However for those that want continue integration testing there's nothing wrong with tests.



You also helped prove a point. Testing has more value with the more people you have on a project to ensure someone doesn't break the code.
hkarthik - April 8, 2009 - Your other major option for CI is CruiseControl.NET (which is free). However the configuration requires modifying a lot of XML for CC.NET. TeamCity has a lot less friction for your Configuration Manager to deal with.
robconery - April 8, 2009 - Crappy, weak developers? Wow everything you wrote here, especially the tone,

really makes me want to listen closely to everything you say! Especially the

last part!
arezkiStoreFront - April 8, 2009 - Rob,



Is it possible to download the screencast and then listen to it on the train or plane without being connected to the internet



TIA

Yaz
Andrew Davey - April 8, 2009 - I found the walkthrough of setting up TeamCity really interesting, thank you.

I've looked at CI factory in the past but got too annoyed with all the setup and configuration. Team City seems to make this stuff much easier.

In the future are you going to explore having your full build deploy the application as well?
justin - April 8, 2009 - I've been getting into unit testing, and normal, simple tests are fairly easy to do. But every once in awhile you run into an error that is only an issue with your tests and not with your code. Currently I'm stumped on a big one, and I'm not at all sure on how to proceed to fix/get around it; and boy is that a turn off for unit testing. I have a post on stackoverflow about it if anyone here is interested in helping me out.



http://stackoverflow.com/questions/727181/asp-net-mvc-system-web-compilation-compilationlock
huey - April 8, 2009 - I'm still new with TDD (I know, different than Unit Testing) and embaressingly I haven't made it through a whole project yet with tests intact. I keep getting to a point where I break a large majority of my tests and then just throw my arms up and disable the test project.



The hardest part for me is the start. Since my last project I've read Kent Beck's book on TDD. I feel like I need to do more diligence in defining exactly what I need. Previously I've kind of just picked a nugget of business logic without really thinking about where it is going to fit in which is I think why my tests haven't scaled well. I'm going to try to focus on the inputs and outputs a bit more -- what the user needs displayed, what I need from the user, what persistent information needs to be interacted with. I don't know if this is right or not, but I like the idea that tests as defining the program requirements and those types of things seem very requirement related. (I guess this isn't what Kent Beck did at all with his example on money/currency... he started with a simple piece of logic... maybe this is a bad idea!)



I guess I had hoped I could just read about this stuff (blogs / books) and be an expert but it is taking practice and experience (shocking!). Even if I haven't had a real successful implementation yet, I can definitely tell that it is impacting my code in beneficial ways and I'm improving.



Anyways, I guess that is a long winded way of saying thanks for sharing all of your experiences as well.
Brainy - April 8, 2009 - Unit testing is for crappy, weak developers. Honestly, if you don't know what you are doing than you spend time writing unit tests. Please!



Developers are getting lazy. Instead of thinking about what they write and debugging it while they write it, they write unit tests. Instead of thinking of what are they trying to accomplish they constantly refactor.



If you are working on a team than you do need unit tests. The quality of the people on team vary and unit tests serve as protection from low quality developers. In Microsoft you certainly need it since very likely you will not be working on v2 of that code anyway and next developer working on it surely will not understand what he is doing...



As testimonial, I have code base of 300,000 LOC that is being improved constantly in last 10 Years by me alone. This is used by more than 10,000 people on daily basis. I have ZERO unit tests. Everything works very well...
cowgaR - April 8, 2009 - to a certain degree R# helps here...



ruffone - April 7, 2009 - I think some good arguments is being made for Unit Testing. I just think the process is redundant. There has to be a better approach to doing it. If I build a test project then my production project should be inferred from it and if I build a production project then my test project should be built from that. This process is like if in order to build a database table I had to walk up to some GUI tool and do some work and them I had to get out EM and write some T-Sql I hope some ware there is someone working on some "Linq to Sql" type implementation of unit test that will generate all this test code on the fly. In fact when are we going to add the GridView to the Database. I know, I heard Kona
robconery - April 7, 2009 - Not sure if I mention this in the screencast - but TeamCity is just what I'm

most familiar with - haven't used other CI servers.
Radu Grama - April 7, 2009 - Any comments with regards to the other integration tools you mentioned? Why you picked TeamCity, what other options you considered?
Chris Kolenko - April 11, 2009 - Just installing Team City on my server.. I like the 50 min screen cast but might take me a few weeks to make my mind up on it. But at least you have me trying it out. As for this Test Driven stuff.. I see it's point. The only problem i have with it which is nothing to do with development but mainly on the clients end of things. I sort of work with clients that like to change there mind a lot.. They don't like the agile development structure and basically want us to drop everything in a second to support them. I find that most of the stuff we develop is more of a Prototype thing. We are developing for them to basically say yeah we like it keep going, or stop everything lets change direction. This is where TDD can be very frustrating. I hate that feeling of working 100 hours on a feature just to have the client say nope hate it. :( Image using TDD and spending an extra 100 hours on tests. on my own projects i'll be adopting TDD. .. .. as for people who say TDD sucks and shouldn't be used.. I think that's a bad attitude and if you're never going to be open to new ideas different patterns or even different languages you're really limiting yourself as a developer.
robconery - April 11, 2009 - Good points Chris - I know the pain you feel there :). I would offer to you, however, that this type of \"quick change\" is PRECISELY when testing is good (not specifically TDD but...).


Let's say your client says \"I think I want to make sure that instead of having an email come at the end of an order - it should come at the beginning and say 'thanks we're putting it together'. Then, we'll take the Order offline and charge it when we can instead of synchronously - this way we can save time/money\".


OK - so you need to change your Order Process here big time. You sit down, think it through, then start refactoring. While you refactor you keep running your tests to make sure your changes don't crater the rest of your app - if they do you might want to look at why!


When you're done you run everything through your tests again (having killed some, changed others, added more) and guess what you have...


All in all, you'll come out ahead. I can't emphasize enough that everyone lives under these restrictions but still find a way :)
arezkiStoreFront - April 11, 2009 - Scott, In future screencasts, are you going to cover on how to make to of a Common Service Locator so that we are not tied up to a specific DI container? Thanks Yaz
Chris Kolenko - April 12, 2009 - Questions: I've been using Team City for a day now. Set up MySql Database and got my CI set up. I check in and it builds and runs my tests. This i like. Ok.. Now why can't I click on the latest build and get it? Is there something i'm missing. My project is now at a state where i would like to deploy to a live production environment.. can Team City configure all this.. Yes sorry for the laziness by asking this on your blog Rob but i really couldn't see anything in the configs for this :S
arezkiStoreFront - April 12, 2009 - TDD test is used to drive the design of an application. http://www.stephenwalther.com/blog/archive/2009/0... or Kent becks and Martin fowler Yaz
robconery - April 12, 2009 - LOL yah - that's Stephen trying to make a point and getting completely lost in it :). There's plenty to say there but I'll just step aside from the debate.
arezkiStoreFront - April 12, 2009 - Rob, I had not read the whole thing when I posted it, however, there is good discussion on that link. It would be nice if you put the edit button back. TIA Yaz
arezkiStoreFront - April 12, 2009 - Hello Rob, TDD has driven people to do BDD (Behavior Driven Design) using tools like NBehave, MbUnit and I think xUnit. Are you going to cover BDD? Thanks Yaz
robconery - April 12, 2009 - I might - was thinking about it. TDD/BDD usually erupts into weird debates :)
arezkiStoreFront - April 12, 2009 - Excellent
Borek - April 13, 2009 - Pity that we can't see the transition from the silly implementation ("the simplest thing that will make the test pass") to a real world one. I get the point of Red, Green, Refactor but spending time on silly implementations like "return 1" doesn't seem quite sensible to me. Is that really how you work on real life projects?
robconery - April 13, 2009 - I'm not as TDD oriented as Brad is - but yes, this is how he works in RL, albeit about 100 times faster :). I'm just hoping people leverage testing in general - TDD or not. I do know that the folks who haver tried TDD for a bit really love it - I like it a lot myself - but I'll be honest it's hard to make the transition
briantcva - April 13, 2009 - Is "Coder to Developer" still relevant? I ask b/c I'm trying to move my shop to a less cowboy-esque style - more structure and less "everything in the code-behind." I guess I'm looking for ways to keep us as successful as we've been (at least from a customer perspective) while moving to a more "professional" level. What I don't want to do is implement more work that I can't justify from an ROI perspective. And writing tests, much less designing to be testable, will definitely be viewed as more work around here.
Juan Blanco - April 16, 2009 - Rob, You are making a great job to bringing good development practices to the community, some times you dont realize what people are doing out there until you move shops (this is proven by "Brainy" comments). And you are giving us great material to teach "best practices"! BDD with DDD will be a great screen cast as it emphasises the differences between TDD and normal Unit Testing. Keep the good work!
Jason Simone - April 16, 2009 - Rob, this post needs some tags! Your attempts to introduce me to TDD have been more successful than anyone else's to date. The video was great and I want to make sure I find it again!
abusing.me » Blog Archive » WinForms DataBindings testen - April 16, 2009 - [...] by: Kona: Continuous Integration and Better Unit Testing Category: .net  |  Comment (RSS) [...]
Kobe – the ASP.NET MVC sample application « Bogdan Brinzarea’s blog - April 19, 2009 - [...] Kona represents Rob Conery effort to change the MVC StoreFront into an open source community application. I think Rob’s decision is something that the guys from Microsoft should’ve done with their reference application. I also think that Rob’s application as it is right now represents a good starting point for building a reference application. [...]
David Montgomery - April 21, 2009 - @Rob, I recently discovered your blog and I'm really enjoying listening to your Storefront webcasts @Brainy, I've been the primary developer on a very commercially successful web-based system for 10+ years as well. The ROI for the code I wrote ten years ago is absolutely fantastic (cha-ching!), but as with any system that is in a state of active development for that long, things are going to get a bit 'organic'. Yes, you personally may hold the system's design in your head, but I would be willing to bet you don't have complete developer documentation you could give to a new coder to have him make short-term improvements and enhancements to your code base. You're counting on always hiring the 'superstar' developer (which are exceedingly rare), or YOU will always be the one to add functionality to your system...I see TDD and unit testing as an enforced way to constantly be updating your concrete developer 'documentation' -- what must the system do in order to remain functional. Personally, I wish I could have made the switch to this sort of coding five years ago.
Bruno Nepomuceno - May 14, 2009 - Hi Conery, First of all, I would like to say that I am a huge fan of you and I've been following your work since almost one year. Well, I've saw in Storefront(old version) and Kona that, when you've created the model, you've tried to do something independent from O/R mapping and persistence frameworks. I don't know if it's a silly question but, anyway, what I would like to know is: why haven't you used bidirectional associations? For example, in Kona, in your Order class, you have a IList of OrderLine. BUT... in Order Lines you don't have anything related to Order. I was expecting an Order property there. I am making this question because I have noticed exactly the same approach in Oxite project. Why do you both haven't implemented bidirectional associations? It won’t be a problem in the future? Is it correct from an Object Oriented Programming point of view? Thank you very much for your attention and congratulations for your work!!!
robconery - May 14, 2009 - Thanks Bruno :). Bi-directional associations cause problems in more complex systems - it's a DDD thing but it doesn't always apply.

That said - if you use something like Linq to Sql or ActiveRecord (forthcoming in SubSonic) - this isn't a concern. It just depends on how strict you feel like being.
Michael D. Hall - May 15, 2009 - @David Montgomery, @Brainy I am one of those developers that inherited a system that was handed off from another developer who turned in his notice three days after I accepted the offer then he left without giving me any training, a huge project in progress and a pissed off client. Now I've spent months trying to learn the system being terrified that one of my changes are going to break the app. Not one test, not one *useful* bit of documentation, nothing to look at excepts 100's of K's of code and dynamic dependencies. He may have had that code in his head, good for him, but it doesn't do me one damn bit of good. There are allot of sound arguments for writing tests, and consideration for the next guy is one of them. /sigh A professional job isn't just about the system working while you're assigned to it, but designing it so that it can live past your tour then be handed off to the next generation without making their lives a living hell.
number1fan - May 19, 2009 - good for you :p numpty
David Sandberg - July 4, 2009 - First off, Rob, thanks so much for these videos. Some of the comments have suggested that unit testing is of the greatest value to teams of multiple developers. What I would like to suggest is that every project that isn't a one-off, do-it-and-forget-it project is essentially a multiple developer project, even if you are the only one who ever works on it. Because when it's time to come back to work on the project after six months away from it (not even to mention five YEARS later), you are very unlikely to have retained the same intimate knowledge of the code that you had when you wrote it, no matter how many comments you added. Essentially, you will someday be a different developer than the one that originally wrote the code, and supplying a suite of unit tests right up front when you're steeped in the intricacies of the code seems to me like one good way to help protect that future programmer, which could be someone like Michael D. Hall above ... or it could simply be your future self. Now, if you're one of the exceedingly rare people who really can retain all of their intimate knowledge about code for years after the fact, then lucky you ... I can only wish I had such a gift. But then again, I've worked with people who believed they were one of the special few who can remember everything about their code, and such hubris often comes back to haunt them (although they'd never admit it) and their clients.
Maciej Gren - September 14, 2009 - Thank you Rob for your links. I am currently playing a little bit with your Kona project and I was trying to fit it to my image of Unit Testing but I failed. The approach I have found in Kona is to have for instance Category as partial class which is generated by SubSonic and has also some static methods which you can find in previous versions in Repository classes. I really like this approach but when I want to test for instance controller method call where I query the database, I cannot mock the static method there because it is hard coded and static. Of course, for static methods I can use TypeMock but I've noticed here http://codebetter.com/blogs/jeffrey.palermo/archive/2005/09/16/132084.aspx that this is not a good approach.

My question is... do you plan to change the way how you implemented data access logic in Kona?(currently in partial classes you have static methods) Or maybe you want to keep it in such way? why? do you plan to test it?

thanks in advance for your help!
Chris Williams - November 5, 2009 - Hi, looking for the video of Kona episode #2, but it seems to have gone missing. I can't d/l it or see it on the page. Can you check the link?

Thanks!
Gecko