Skip to content

Commit 230bad2

Browse files
toddbaertKavindu-Dodanliran2000
authored
feat: add appendix b, gherkin suite (#203)
Signed-off-by: Todd Baert <[email protected]> Co-authored-by: Kavindu Dodanduwa <[email protected]> Co-authored-by: Liran M <[email protected]>
1 parent f45bb27 commit 230bad2

File tree

4 files changed

+85
-1
lines changed

4 files changed

+85
-1
lines changed

specification/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ sidebar_position: 0
1616
- [Evaluation Context](./sections/03-evaluation-context.md)
1717
- [Hooks](./sections/04-hooks.md)
1818
- [Events](./sections/05-events.md)
19-
- [Appendix-A](./appendix-A.md)
19+
- [Appendix A: Included Utilities](./appendix-a-included-utilities.md)
20+
- [Appendix B: Gherkin Suites](./appendix-b-gherkin-suites.md)
2021

2122
## Conformance
2223

File renamed without changes.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
id: appendix-b
3+
title: "Appendix B: Gherkin Suites"
4+
description: A Set of End-to-End Tests for Validating OpenFeature Implementations
5+
sidebar_position: 5
6+
---
7+
8+
# Appendix B: Gherkin Suites
9+
10+
This section contains a set of language-agnostic end-to-end tests (defined in gherkin).
11+
These tests can be used to validate the behavior of an OpenFeature implementation.
12+
"Features" (test suites) can be used in conjunction with a cucumber test-runner for the language in question.
13+
14+
## Evaluation Feature
15+
16+
The [evaluation feature](./assets/gherkin/evaluation.feature) contains tests for the basic functionality of the [Evaluation API](./sections/01-flag-evaluation.md).
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
Feature: Flag evaluation
2+
3+
# This test suite contains scenarios to test the flag evaluation API.
4+
5+
Background:
6+
Given a provider is registered with cache disabled
7+
8+
# basic evaluation
9+
Scenario: Resolves boolean value
10+
When a boolean flag with key "boolean-flag" is evaluated with default value "false"
11+
Then the resolved boolean value should be "true"
12+
13+
Scenario: Resolves string value
14+
When a string flag with key "string-flag" is evaluated with default value "bye"
15+
Then the resolved string value should be "hi"
16+
17+
Scenario: Resolves integer value
18+
When an integer flag with key "integer-flag" is evaluated with default value 1
19+
Then the resolved integer value should be 10
20+
21+
Scenario: Resolves float value
22+
When a float flag with key "float-flag" is evaluated with default value 0.1
23+
Then the resolved float value should be 0.5
24+
25+
Scenario: Resolves object value
26+
When an object flag with key "object-flag" is evaluated with a null default value
27+
Then the resolved object value should be contain fields "showImages", "title", and "imagesPerPage", with values "true", "Check out these pics!" and 100, respectively
28+
29+
# detailed evaluation
30+
Scenario: Resolves boolean details
31+
When a boolean flag with key "boolean-flag" is evaluated with details and default value "false"
32+
Then the resolved boolean details value should be "true", the variant should be "on", and the reason should be "STATIC"
33+
34+
Scenario: Resolves string details
35+
When a string flag with key "string-flag" is evaluated with details and default value "bye"
36+
Then the resolved string details value should be "hi", the variant should be "greeting", and the reason should be "STATIC"
37+
38+
Scenario: Resolves integer details
39+
When an integer flag with key "integer-flag" is evaluated with details and default value 1
40+
Then the resolved integer details value should be 10, the variant should be "ten", and the reason should be "STATIC"
41+
42+
Scenario: Resolves float details
43+
When a float flag with key "float-flag" is evaluated with details and default value 0.1
44+
Then the resolved float details value should be 0.5, the variant should be "half", and the reason should be "STATIC"
45+
46+
Scenario: Resolves object details
47+
When an object flag with key "object-flag" is evaluated with details and a null default value
48+
Then the resolved object details value should be contain fields "showImages", "title", and "imagesPerPage", with values "true", "Check out these pics!" and 100, respectively
49+
And the variant should be "template", and the reason should be "STATIC"
50+
51+
# context-aware evaluation
52+
Scenario: Resolves based on context
53+
When context contains keys "fn", "ln", "age", "customer" with values "Sulisław", "Świętopełk", 29, "false"
54+
And a flag with key "context-aware" is evaluated with default value "EXTERNAL"
55+
Then the resolved string response should be "INTERNAL"
56+
And the resolved flag value is "EXTERNAL" when the context is empty
57+
58+
# errors
59+
Scenario: Flag not found
60+
When a non-existent string flag with key "missing-flag" is evaluated with details and a default value "uh-oh"
61+
Then the default string value should be returned
62+
And the reason should indicate an error and the error code should indicate a missing flag with "FLAG_NOT_FOUND"
63+
64+
Scenario: Type error
65+
When a string flag with key "wrong-flag" is evaluated as an integer, with details and a default value 13
66+
Then the default integer value should be returned
67+
And the reason should indicate an error and the error code should indicate a type mismatch with "TYPE_MISMATCH"

0 commit comments

Comments
 (0)