On Oct 17, 1:41 pm, Kent Tenney <kten...@gmail.com> wrote: > As I understand the discipline expected in the Zope community: > > When approaching a bug, begin by writing a test which fails > due to the bug. Then fix the code such that the test succeeds. > > Patches which don't follow this convention are not considered. > (code without tests is assumed buggy)
Kent, this post has had the delayed effect of revolutionized my approach to unit testing. I consider it one of the most important posts ever written on leo-editor. Now, my first response to any bug is to create a *failing* @test node describing the bug. I am now training myself to create the @test node even when the fix is "trivial", as with the recent fix to updateEditors. Actually, I fixed the bug first, and then remembered this post. Oops! I "unfixed" the code, created the @test node in unitTest.leo, verified that the @test node failed when run locally, redid the fix, and verified that the unit test then passed after reloading unitTest.leo. This is the one and *only* way of verifying any patch. The process would have been simpler if the test could have been run externally, but this bug involved gui code so running the unit test externally was out of the question. Your post probably would not have been so influential had it not been for the huge speedup caused by running unit tests externally (edit, Alt-4, edit, Alt-4,...). But now that creating @test nodes has become second nature, I have started to create @test nodes even when I must run unit tests locally, and even when there is no obvious way to get @test nodes to fail and succeed as desired. If nothing else, the @test nodes are prominent reminders that all is not well and that all is not complete. This is the case at present: I have lots of @test nodes that could be said not even to have been properly started, because I can't get them to fail reliably. But that is still a huge improvement over doing nothing at all. As I said in reply to Terry's post, I may have to create a unit test that verifies that tests have been run "manually" with execute-script... Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To post to this group, send email to leo-editor@googlegroups.com. To unsubscribe from this group, send email to leo-editor+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/leo-editor?hl=en.