Skip to content

feat: add basic gherkin test suite for tracking feature (WIP) #285

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions specification/assets/gherkin/tracking.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Feature: Tracking

# This test suite contains scenarios to test the tracking API.

Background:
Given a provider is registered

Scenario Outline: Invalid event names
When an event was tracked with tracking event name <event_name>
Then nothing should have been tracked
And the tracking operation shall error
Examples: Basic
| event_name |
| "" |
| "NULL" |

Scenario Outline: Provider's track functionality is called
Copy link
Member

Choose a reason for hiding this comment

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

The track API is rich not just an event_name - hence this gherkin file should also test the other cases properly, with information enrichment (if there is some) - https://openfeature.dev/specification/sections/tracking#conditional-requirement-6111 and this would actually be already a test verifying this specification.

We can also reuse the step from the flags (https://github.com/open-feature/spec/blob/main/specification/assets/gherkin/evaluation.feature#L53)

When context contains keys "fn", "ln", "age", "customer" with values "Sulisław", "Świętopełk", 29, "false"

Copy link
Member

Choose a reason for hiding this comment

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

maybe we are also able to write a scenario for https://openfeature.dev/specification/sections/tracking#requirement-614

When an event was tracked with tracking event name <event_name>
Then the tracking provider should have been called with event name <event_name>
Examples: Basic
| event_name |
| "the-event" |
Loading