[Gambas-user] Crash with latest version

Christof Thalhofer chrisml at deganius.de
Mon Mar 8 14:14:01 CET 2021


Am 07.03.21 um 21:00 schrieb Benoît Minisini:

> Another point: I don't want to write tests myself, for psychological 
> reasons: I noticed that a programmer unconsciously avoids any behaviour 
> that make the program he wrotes encounter its bugs.

I think you are assuming the wrong things.

Test driven development is not to find/avoid bugs but to test *expected
behavior*. If you want to create a new method you usually have in mind
that it alters the state of the machine in a special way.

But instead of writing the method and then play around with it a bit you
you first can write a test that tests what you want to get from that method:

Asser.Equals(42, MyProgram.GiveAnswer("The Question of everything"))

After that you write MyProgram.GiveAnswer()

The test helps to ensure that the *expected behavior* will be the same
in future, even if you change or extend MyProgram.GiveAnswer two years
later!

It does not help to find out that (maybe) ...

MyProgram.GiveAnswer("Crash the system"))

...crashes the system. Because this was not tested!

> Jussi should agree. He wrote a lot of strange test code I would have 
> never imagine, and found a lot of bugs with it. :-)

No, he found bugs and then he wrote a couple of tests which help you to
avoid these bugs in future. This is a different thing.

What you thought about is "Fuzzing":
https://en.wikipedia.org/wiki/Fuzzing

This is another playing field.

But it would help a lot if you could write the expected behavior in
tests before you create a new method because if someone later would
alter the program we could assure that it won't destroy the expected
behavior.

You are still free to produce any bugs you want. ;-)

Alles Gute

Christof Thalhofer

-- 
Dies ist keine Signatur

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210308/7ba199c4/attachment.sig>


More information about the User mailing list