[openstreetmap/openstreetmap-website] Cucumber tests (#2545)

Sarah Hoffmann notifications at github.com
Wed Feb 19 19:53:33 UTC 2020


Just to add a data point: I've used BDD-style extensively for [testing Nominatim](https://github.com/openstreetmap/Nominatim/blob/master/test/bdd/db/import/addressing.feature) (after getting the idea from OSRM) and in this context I'm actually quite happy with it. That is because the test all follow a very narrowly defined pattern: fill table A with data -> run import script -> expect data in table B. Nominatim has hundreds of these functional tests and BDD provides a concise notation for them.

Following that success I tried to do other tests in BDD format as well and quickly gave up on it again. Programmers are simply quicker in reading code than reading some English language translation, so BDD gets in the way when writing and reading the tests. I kept forgetting what English language terms I had defined and needed to look them up all the time. And you loose the flexibility of a function that can be called with many different parameters. Everything needs an extra instruction.

Long story short: BDD has a use if you can represent your test suite with only a few instruction patterns where each instruction still represents a fairly complex step and/or where representing your test data in a table is helpful. For everything else: stay away from it.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/2545#issuecomment-588417094
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20200219/3e8efdea/attachment-0001.htm>


More information about the rails-dev mailing list