Skip to content

Commit 473be86

Browse files
authored
test: Update gherkin test sub module (#1236)
Signed-off-by: Bernd Warmuth <[email protected]>
1 parent 409fd04 commit 473be86

File tree

7 files changed

+28
-24
lines changed

7 files changed

+28
-24
lines changed

.gitmodules

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
[submodule "test-harness"]
2-
path = test-harness
3-
url = https://github.com/open-feature/test-harness
1+
[submodule "spec"]
2+
path = spec
3+
url = https://github.com/open-feature/spec/

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ If you're adding tests to cover something in the spec, use the `@Specification`
2323

2424
## End-to-End Tests
2525

26-
The continuous integration runs a set of [gherkin e2e tests](https://github.com/open-feature/test-harness/blob/main/features/evaluation.feature) using `InMemoryProvider`.
26+
The continuous integration runs a set of [gherkin e2e tests](https://github.com/open-feature/spec/blob/main/specification/assets/gherkin/evaluation.feature) using `InMemoryProvider`.
2727

2828
to run alone:
2929
```

pom.xml

+3-4
Original file line numberDiff line numberDiff line change
@@ -554,22 +554,21 @@
554554
<argument>submodule</argument>
555555
<argument>update</argument>
556556
<argument>--init</argument>
557-
<argument>test-harness</argument>
557+
<argument>spec</argument>
558558
</arguments>
559559
</configuration>
560560
</execution>
561561
<execution>
562-
<id>copy-gherkin-tests</id>
562+
<id>copy-evaluation-gherkin-tests</id>
563563
<phase>validate</phase>
564564
<goals>
565565
<goal>exec</goal>
566566
</goals>
567567
<configuration>
568568
<!-- copy the feature spec we want to test into resources so them can be easily loaded -->
569-
<!-- run: cp test-harness/features/evaluation.feature src/test/resources/features/ -->
570569
<executable>cp</executable>
571570
<arguments>
572-
<argument>test-harness/features/evaluation.feature</argument>
571+
<argument>spec/specification/assets/gherkin/evaluation.feature</argument>
573572
<argument>src/test/resources/features/</argument>
574573
</arguments>
575574
</configuration>

spec

Submodule spec added at d4a9a91

src/test/java/dev/openfeature/sdk/e2e/RunCucumberTest.java src/test/java/dev/openfeature/sdk/e2e/EvaluationTest.java

+8-3
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@
55
import org.junit.platform.suite.api.SelectClasspathResource;
66
import org.junit.platform.suite.api.Suite;
77

8+
import static io.cucumber.junit.platform.engine.Constants.GLUE_PROPERTY_NAME;
89
import static io.cucumber.junit.platform.engine.Constants.PLUGIN_PROPERTY_NAME;
910

1011
@Suite
1112
@IncludeEngines("cucumber")
12-
@SelectClasspathResource("features")
13+
@SelectClasspathResource("features/evaluation.feature")
1314
@ConfigurationParameter(key = PLUGIN_PROPERTY_NAME, value = "pretty")
14-
public class RunCucumberTest {
15-
15+
@ConfigurationParameter(key = GLUE_PROPERTY_NAME, value = "dev.openfeature.sdk.e2e.evaluation")
16+
public class EvaluationTest {
17+
1618
}
19+
20+
21+

src/test/java/dev/openfeature/sdk/e2e/StepDefinitions.java src/test/java/dev/openfeature/sdk/e2e/evaluation/StepDefinitions.java

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package dev.openfeature.sdk.e2e;
1+
package dev.openfeature.sdk.e2e.evaluation;
22

33
import dev.openfeature.sdk.Value;
44
import dev.openfeature.sdk.EvaluationContext;
@@ -52,7 +52,7 @@ public class StepDefinitions {
5252

5353
@SneakyThrows
5454
@BeforeAll()
55-
@Given("an openfeature client is registered with cache disabled")
55+
@Given("a provider is registered")
5656
public static void setup() {
5757
Map<String, Flag<?>> flags = buildFlags();
5858
InMemoryProvider provider = new InMemoryProvider(flags);
@@ -67,7 +67,7 @@ public static void setup() {
6767
// boolean value
6868
@When("a boolean flag with key {string} is evaluated with default value {string}")
6969
public void a_boolean_flag_with_key_boolean_flag_is_evaluated_with_default_value_false(String flagKey,
70-
String defaultValue) {
70+
String defaultValue) {
7171
this.booleanFlagValue = client.getBooleanValue(flagKey, Boolean.valueOf(defaultValue));
7272
}
7373

@@ -117,7 +117,7 @@ public void an_object_flag_with_key_is_evaluated_with_a_null_default_value(Strin
117117

118118
@Then("the resolved object value should be contain fields {string}, {string}, and {string}, with values {string}, {string} and {int}, respectively")
119119
public void the_resolved_object_value_should_be_contain_fields_and_with_values_and_respectively(String boolField,
120-
String stringField, String numberField, String boolValue, String stringValue, int numberValue) {
120+
String stringField, String numberField, String boolValue, String stringValue, int numberValue) {
121121
Structure structure = this.objectFlagValue.asStructure();
122122

123123
assertEquals(Boolean.valueOf(boolValue), structure.asMap().get(boolField).asBoolean());
@@ -132,7 +132,7 @@ public void the_resolved_object_value_should_be_contain_fields_and_with_values_a
132132
// boolean details
133133
@When("a boolean flag with key {string} is evaluated with details and default value {string}")
134134
public void a_boolean_flag_with_key_is_evaluated_with_details_and_default_value(String flagKey,
135-
String defaultValue) {
135+
String defaultValue) {
136136
this.booleanFlagDetails = client.getBooleanDetails(flagKey, Boolean.valueOf(defaultValue));
137137
}
138138

@@ -148,13 +148,13 @@ public void the_resolved_boolean_value_should_be_the_variant_should_be_and_the_r
148148
// string details
149149
@When("a string flag with key {string} is evaluated with details and default value {string}")
150150
public void a_string_flag_with_key_is_evaluated_with_details_and_default_value(String flagKey,
151-
String defaultValue) {
151+
String defaultValue) {
152152
this.stringFlagDetails = client.getStringDetails(flagKey, defaultValue);
153153
}
154154

155155
@Then("the resolved string details value should be {string}, the variant should be {string}, and the reason should be {string}")
156156
public void the_resolved_string_value_should_be_the_variant_should_be_and_the_reason_should_be(String expectedValue,
157-
String expectedVariant, String expectedReason) {
157+
String expectedVariant, String expectedReason) {
158158
assertEquals(expectedValue, this.stringFlagDetails.getValue());
159159
assertEquals(expectedVariant, this.stringFlagDetails.getVariant());
160160
assertEquals(expectedReason, this.stringFlagDetails.getReason());
@@ -168,7 +168,7 @@ public void an_integer_flag_with_key_is_evaluated_with_details_and_default_value
168168

169169
@Then("the resolved integer details value should be {int}, the variant should be {string}, and the reason should be {string}")
170170
public void the_resolved_integer_value_should_be_the_variant_should_be_and_the_reason_should_be(int expectedValue,
171-
String expectedVariant, String expectedReason) {
171+
String expectedVariant, String expectedReason) {
172172
assertEquals(expectedValue, this.intFlagDetails.getValue());
173173
assertEquals(expectedVariant, this.intFlagDetails.getVariant());
174174
assertEquals(expectedReason, this.intFlagDetails.getReason());
@@ -182,7 +182,7 @@ public void a_float_flag_with_key_is_evaluated_with_details_and_default_value(St
182182

183183
@Then("the resolved float details value should be {double}, the variant should be {string}, and the reason should be {string}")
184184
public void the_resolved_float_value_should_be_the_variant_should_be_and_the_reason_should_be(double expectedValue,
185-
String expectedVariant, String expectedReason) {
185+
String expectedVariant, String expectedReason) {
186186
assertEquals(expectedValue, this.doubleFlagDetails.getValue());
187187
assertEquals(expectedVariant, this.doubleFlagDetails.getVariant());
188188
assertEquals(expectedReason, this.doubleFlagDetails.getReason());
@@ -217,7 +217,7 @@ public void the_variant_should_be_and_the_reason_should_be(String expectedVarian
217217

218218
@When("context contains keys {string}, {string}, {string}, {string} with values {string}, {string}, {int}, {string}")
219219
public void context_contains_keys_with_values(String field1, String field2, String field3, String field4,
220-
String value1, String value2, Integer value3, String value4) {
220+
String value1, String value2, Integer value3, String value4) {
221221
Map<String, Value> attributes = new HashMap<>();
222222
attributes.put(field1, new Value(value1));
223223
attributes.put(field2, new Value(value2));
@@ -253,7 +253,7 @@ public void the_resolved_flag_value_is_when_the_context_is_empty(String expected
253253
// not found
254254
@When("a non-existent string flag with key {string} is evaluated with details and a default value {string}")
255255
public void a_non_existent_string_flag_with_key_is_evaluated_with_details_and_a_default_value(String flagKey,
256-
String defaultValue) {
256+
String defaultValue) {
257257
notFoundFlagKey = flagKey;
258258
notFoundDefaultValue = defaultValue;
259259
notFoundDetails = client.getStringDetails(notFoundFlagKey, notFoundDefaultValue);
@@ -273,7 +273,7 @@ public void the_reason_should_indicate_an_error_and_the_error_code_should_be_fla
273273
// type mismatch
274274
@When("a string flag with key {string} is evaluated as an integer, with details and a default value {int}")
275275
public void a_string_flag_with_key_is_evaluated_as_an_integer_with_details_and_a_default_value(String flagKey,
276-
int defaultValue) {
276+
int defaultValue) {
277277
typeErrorFlagKey = flagKey;
278278
typeErrorDefaultValue = defaultValue;
279279
typeErrorDetails = client.getIntegerDetails(typeErrorFlagKey, typeErrorDefaultValue);

test-harness

-1
This file was deleted.

0 commit comments

Comments
 (0)