<div dir="ltr"><br><br><div class="gmail_quote">On Thu, Aug 28, 2008 at 5:47 PM, John Arbash Meinel <span dir="ltr"><<a href="mailto:john@arbash-meinel.com">john@arbash-meinel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
-----BEGIN PGP SIGNED MESSAGE-----<br>
Hash: SHA1<br>
<br>
Geoff Bache wrote:<br>
...<br>
<div class="Ih2E3d"><br>
><br>
> But you need a lot less tests this way. Because you can have non-coders<br>
> involved, and because you necessarily focus on possible usage of the system<br>
> and interesting usage of the system, you don't end up writing thousands of<br>
> tests for things that will never happen in practice (or that nobody will<br>
> care about if they do)<br>
<br>
</div>If experience has taught me anything. There is very little that "will never<br>
happen in practice". Users are *extremely* good at finding all of the edge<br>
cases in your code.<br>
<div class="Ih2E3d"></div></blockquote><div class="Ih2E3d"><br>Well yes, but my point is that there are many "whitebox things" you can do with any given collection of code that are totally impossible via the external interface so that no user can do it however hard they try. Then there is another class of operations that can be done but it's just taken as read that they aren't interesting. I bet I can trigger a few internal errors in bzr by deleting half of the files in my repository and it probably won't give me nice error messages (actually I triggered a nice python stack by turning some of it into symbolic links while writing these tests...) but I doubt you're too worried about that. At the level of classes and methods this kind of thing can seem important to test, but in practice they just bloat the test suite most of the time.<br>
<br>
><br>
> Leveraging code structure is good if you want to provide well isolated units<br>
> that can seamlessly be used in a different context. In practice though most<br>
> code will only ever be used for one purpose as part of one system. It has<br>
> the big disadvantage that it "holds the code hostage" after a while:<br>
> nobody's going to redesign the code, however necessary it gets, if doing so<br>
> means rewriting 300 tests.<br>
<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">That is also usually a sign of poorly written tests. When they test "more than<br>
they should". </blockquote><div><br>True, but in my experience it seems to be very easy to write whitebox tests "poorly" in this respect, and very difficult to do it well. If you've managed to write 15000 whitebox tests and avoid this problem then all power to you, but my experience<br>
and word from those I know suggests this is a fairly common problem.<br> <br>> (And blackbox tests tend to fall under this because they test<br>
> the whole stack at once.)<br><br>But if they're properly blackbox they don't depend on the internal structure, so changes in design can't cause them to need rewriting surely? The basic issue is how much stuff they depend on that is extraneous to the purpose of the test, not how much stuff in total they depend on.<br>
<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d"><br>
> If in-process speed is seen as all-important, yes. I personally think that<br>
> should be well down the list of priorities for an automated test suite,<br>
> especially if it's already well beyond being able to be run interactively.<br>
> And I think parallelising is easier than you might think and a better<br>
> generic solution to slow tests : hardware is cheap these days (though I<br>
> admit this equation is more complicated if all the developers are working at<br>
> home).<br>
<br>
</div>And yes, we are. Not to mention... this is open source, and we want to<br>
encourage people who submit patches to run the test suite.<br>
<br>
I'm in the US, Robert, Martin, Andrew, Ian are in Australia, Vincent is in<br>
France, Aaron is in Canada, HQ is in London, etc.<br>
<br>
The PQM (automated system that runs the test suite and if it passes commits to<br>
mainline.) is in London, and *is* in a data center with a lot of machines<br>
(somewhere around 100+). However, the machines are dedicated to specific uses,<br>
and the admins are fairly strict.<br>
<div class="Ih2E3d"></div></blockquote><div class="Ih2E3d"><br>OK. That's still not necessarily fatal to parallelism (you don't need a data centre with 100 machines, I have 3 machines at home and making use of those would near enough triple the speed of a large enough test suite, which is still pretty useful) But I take the point. <br>
><br>
> - IMO user acceptance tests are not equivalent to black box tests -<br>
>> they are testing that the users goals really are satisfied; so they<br>
>> may sometimes be best represented by driving the UI, but may also<br>
>> be othertimes best represented by driving the API. (For starters,<br>
>> it depends on the 'user' - the folk writing qbzr and bzr-gtk need<br>
>> API level tests, folk driving the CLI probably want UI tests, except<br>
>> when the thing they are asking about really isn't a UI problem.<br>
><br>
><br>
> Yes, this is true. And IMO user acceptance tests are the most important and<br>
> most effective form of testing (though not usually the fastest..)<br>
><br>
<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">They are *a* good part of testing. However, we currently support 9 repository<br>
formats which can be accessed over 5 transports (bzr+ssh, sftp, http, ftp,<br>
local). And you don't really want to run a set of heavyweight tests against<br>
all formats for all possible permutations of commands.<br>
We also support 4+ branch formats, and 3 working tree formats. Which (in<br>
general) can be mixed and matched. We certainly have default configurations,<br>
but when you do "bzr status" it has to extract data from the repository, and<br>
compare it to the working tree. So you should make sure that sort of thing works.<br>
<br>
We do that internally with white-box interface testing. So all repository<br>
implementations have 400+ tests run against them. However, this prevents us<br>
from having to run a single test 3*4*9*5=540 times.<br>
<br>
It is also really helpful when *implementing* a new Repository format, because<br>
when the new 400+ tests pass, you can be quite sure that your repository<br>
format conforms.<br>
</blockquote><div><br>Sure. Doubtless a good idea.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br><div class="Ih2E3d">>> Two related projects to bzr that may well love testtext are the bzr-gtk<br>
>> and qbzr projects, which are writing GUI's - and unlike bzr's core,<br>
>> don't have a really slick way to write comprehensive tests for gui<br>
>> interacting code (or didn't last time I looked - I may be out of date).<br>
>><br>
><br>
> OK. If I feel inspired I might try and write a little test suite for bzr-gtk<br>
> : it's always easier to convince people who don't already have lots of tests<br>
> :)<br>
<br>
</div>Though you may have to convince them to... run the test suite. I wrote quite a<br>
few tests for bzr-gtk when I did some work on it. It turns out that the gtk<br>
gui code is fairly easy to whitebox test. Because you don't actually have to<br>
run the event loop to inject changes and have it propagate values. (You can<br>
simulate button presses, etc, and then check the values in the text areas.)<br>
<br>
However, the test suite has broken a few times, because people didn't ever<br>
actually run it before bringing in new patches. Usually trivial things, but<br>
just a sign that the devs in the project don't commonly run the test suite.<br>
</blockquote><div><br>OK. I'll see if I feel like it's worth the effort. <br><br>Thanks for an interesting discussion anyway, it's given me some insights into<br>the bazaar project and the open source world in general.<br>
<br>Regards,<br>Geoff<br> <br></div></div></div>