inovex / scrumlr.io

Webapp for collaborative online retrospectives
https://scrumlr.io
MIT License
263 stars 58 forks source link

Evaluate BDD testing frameworks for our API #3428

Open bitionaire opened 1 year ago

Martheos commented 1 year ago

Ginkgo seems like a viable option

BenedictHomuth commented 7 months ago

BDD Test Framework Evaluation

Behaviour-Driven Development (BDD) can be seen as a way to bridge the gap between the software and business people in regards to communicating desired behaviors of a system. It is encouraging collaboration across roles and fosters a shared understanding of the problem to solve.

Ideally, it creates a human-readable file – often expressed in gherkin syntax.

Example gherkin syntax:

Feature: User Login

  Scenario: Successful login with valid credentials
    Given I am on the login page
    When I enter "username" as the username
    And I enter "password" as the password
    Then I should be logged in to the system

Contenders

Build for BDD

Testframeworks which support BDD

Other / Related

Tryout

godog

ginkgo

goconvey

Conlusion

There can always be a debate on which framework is better for a specific purpose. Nonetheless, I find it important to go for frameworks that are already very stable and have a community behind them, that will maintain it going forward. With this being the minimum criteria, from all the listed tools only three remained: godog, ginkgo, and goconvey!

Out of those, godog could be dismissed, since it felt too clunky to handle. The only positive thing to say is, that it forces you to have your requirements listed in .feature files, and as soon as you change up something either in a test or feature file, the test breaks.

The remaining two are depending on our team's preference:

If we really want to go for the BDD spirit, I would suggest going with goconvey, since it comes closest to representing the gherkin-syntax in test cases. Additionally, it comes with a WebUI where you can write a gherkin text, and the test code is generated for you. This would give non-technical people the possibility to describe their requirements themselves.

On the other hand the by far superior testing framework (including matching results) here was ginkgo. It is easy to pick up, tests are readable almost like natural language and the gomega matching library most often used with ginkgo is also very intuitive. The downside is that there is not a built-in gherkin to test-boilerplate editor or a way to sync specified requirements with tests on changes in either of those files.