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

Andy Allan notifications at github.com
Wed Feb 19 13:42:47 UTC 2020

#2390 introduces tests using cucumber, and I think we should discuss this aspect of the PR separately.

[Cucumber](https://cucumber.io/) is a syntax for writing tests, as an alternative to the MiniTest syntax (that we use) or RSpec (which is very common in the Ruby community). It aims to be a "natural language" way of writing tests, rather than the code-centric approach of the other formats. Here's an example from #2390 , to give a flavour of the syntax:

 Scenario: Edit a microcosm
    Given there is a user "abe at example.com" with name "Abe"
    And this user is an organizer of this microcosm
    When user "abe at example.com" logs in
    And I am on the microcosms page
    And I click the link to "/microcosms/mappingdc/edit"
    And I set the microcosm in ".edit_microcosm" to "Baltimore", "40", "-76"
    And I submit the form
    Then I should not see "Washington, DC, USA"
    Then I should see "Baltimore"

It's often written for "system" (or "feature") level tests, that is, tests that use a web browser to read the page output, push buttons and fill in forms, and make assertions based on the results. I tend not to find it used much for the other types of test, like "model", "mailer", "controller" tests and so on.

Cucumber claims that its syntax has a number of advantages, and that being written in something approaching natural language makes it easier for non-technical people to read and contribute to the tests. It's often aimed at "Product Owners" and similar positions in larger companies.

We should discuss whether it's something that we want to use in this repo, or whether we should continue to use the current approach for our system-level tests.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20200219/6a9bf8cf/attachment.htm>

More information about the rails-dev mailing list