Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tests): Introducing BDD tests for all bindings #1654

Merged
merged 2 commits into from
Mar 17, 2023

Conversation

Xuanwo
Copy link
Member

@Xuanwo Xuanwo commented Mar 17, 2023

This pull request aims to introduce Behavior-Driven Development (BDD) tests for all of our bindings. It serves as a proof-of-concept and uses the Python binding as an example.

Moving forward, we will maintain the same feature file for all bindings. Only when a binding passes all feature tests will it be marked as ready.

Here is an example using Python:

:) behave tests
Feature: OpenDAL Binding # tests/binding.feature:18

  Scenario: OpenDAL Blocking Operations                             # tests/binding.feature:20
    Given A new OpenDAL Blocking Operator                           # tests/steps/binding.py:23 0.000s
    When Blocking write path "test" with content "Hello, World!"    # tests/steps/binding.py:27 0.000s
    Then The blocking file "test" should exist                      # tests/steps/binding.py:31 0.000s
    Then The blocking file "test" entry mode must be file           # tests/steps/binding.py:35 0.000s
    Then The blocking file "test" content length must be "13"       # tests/steps/binding.py:39 0.000s
    Then The blocking file "test" must have content "Hello, World!" # tests/steps/binding.py:43 0.000s

  Scenario: OpenDAL Async Operations                             # tests/binding.feature:28
    Given A new OpenDAL Async Operator                           # tests/steps/binding.py:48 0.000s
    When Async write path "test" with content "Hello, World!"    # tests/steps/binding.py:53 0.001s
    Then The async file "test" should exist                      # tests/steps/binding.py:58 0.000s
    Then The async file "test" entry mode must be file           # tests/steps/binding.py:63 0.000s
    Then The async file "test" content length must be "13"       # tests/steps/binding.py:69 0.000s
    Then The async file "test" must have content "Hello, World!" # tests/steps/binding.py:75 0.000s

1 feature passed, 0 failed, 0 skipped
2 scenarios passed, 0 failed, 0 skipped
12 steps passed, 0 failed, 0 skipped, 0 undefined
Took 0m0.002s

Signed-off-by: Xuanwo <github@xuanwo.io>
@Xuanwo Xuanwo requested a review from PsiACE March 17, 2023 06:14
@Xuanwo
Copy link
Member Author

Xuanwo commented Mar 17, 2023

I would also like to invite the maintainers of bindings, @suyanhanx and @messense for review.

@Xuanwo
Copy link
Member Author

Xuanwo commented Mar 17, 2023

For nodejs: https://github.com/cucumber/cucumber-js
For C: https://github.com/cucumber/cucumber-cpp

Going forward, BDD test frameworks for Go, Lua, and Java will be used independently.

Copy link
Member

@PsiACE PsiACE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that BDD would be a good choice when not involving the details of implementation. I have a positive attitude towards this PR overall. I need some time to check it, and also look forward to suggestions from other bindings' maintainers.

bindings/python/tests/steps/binding.py Outdated Show resolved Hide resolved
bindings/python/pyproject.toml Outdated Show resolved Hide resolved
Signed-off-by: Xuanwo <github@xuanwo.io>
@suyanhanx
Copy link
Member

This form of testing is quite good for us. It helps to ensure consistency between various bindings, and reasonably splitting test files provides some guidance for synchronizing the functionality of new bindings.

@Xuanwo Xuanwo merged commit 9b77d96 into main Mar 17, 2023
@Xuanwo Xuanwo deleted the bdd-tests-for-bindings branch March 17, 2023 07:43
@suyanhanx suyanhanx mentioned this pull request Mar 30, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement mock services to test our bindings Create a mock serivces to allow testing our bindings
3 participants