From 87dd630f92d1d46defe2c6eb2d4aee1f85916836 Mon Sep 17 00:00:00 2001 From: Tom Gilbert Date: Thu, 12 Sep 2019 10:44:29 +0100 Subject: [PATCH 1/3] test(#1235): Add numeric field dependency tests --- .../numeric/FieldDependencies.feature | 222 ++++++++++++++++++ 1 file changed, 222 insertions(+) create mode 100644 orchestrator/src/test/java/com/scottlogic/deg/orchestrator/cucumber/features/operators/numeric/FieldDependencies.feature diff --git a/orchestrator/src/test/java/com/scottlogic/deg/orchestrator/cucumber/features/operators/numeric/FieldDependencies.feature b/orchestrator/src/test/java/com/scottlogic/deg/orchestrator/cucumber/features/operators/numeric/FieldDependencies.feature new file mode 100644 index 000000000..d0b5f3047 --- /dev/null +++ b/orchestrator/src/test/java/com/scottlogic/deg/orchestrator/cucumber/features/operators/numeric/FieldDependencies.feature @@ -0,0 +1,222 @@ +Feature:As a User + I can specify that a numeric value is greater than, less than or equal to a numeric value in a different field + So that I can setup the test data to meet my requirements + + Background: + Given the generation strategy is full + And the combination strategy is minimal + And there is a field foo + And foo is of type "integer" + And foo is greater than 1 + And foo is anything but null + And there is a field bar + And bar is of type "integer" + And bar is anything but null + + +###Integer + + Scenario: The one where a user can specify that one number should be greater than another number + Given bar is greater than 1 + And the generator can generate at most 3 rows + And there is a constraint: + """ + { + "field": "bar", + "is": "greaterThan", + "otherField": "foo" + } + """ + Then the following data should be generated: + | foo| bar| + | 1 | 2 | + | 2 | 3 | + | 3 | 4 | + + Scenario: The one where a user can specify that one number should be greater than or equal to another number + Given bar is greater than 1 + And the generator can generate at most 3 rows + And there is a constraint: + """ + { + "field": "bar", + "is": "greaterThanOrEqualTo", + "otherField": "foo" + } + """ + Then the following data should be generated: + | foo| bar| + | 1 | 1 | + | 2 | 2 | + | 3 | 3 | + + Scenario: The one where a user can specify that one number should be less than another number + Given bar is greater than 1 + And the generator can generate at most 3 rows + And there is a constraint: + """ + { + "field": "bar", + "is": "lessThan", + "otherField": "foo" + } + """ + Then the following data should be generated: + | foo| bar| + | 1 | 0 | + | 2 | 1 | + | 3 | 2 | + + Scenario: The one where a user can specify that one number should be less than or equal to another number + Given bar is greater than 1 + And the generator can generate at most 3 rows + And there is a constraint: + """ + { + "field": "bar", + "is": "lessThanOrEqualTo", + "otherField": "foo" + } + """ + Then the following data should be generated: + | foo| bar| + | 1 | 1 | + | 2 | 2 | + + Scenario: The one where a user can specify that one number should be equal to another number + Given bar is greater than 1 + And the generator can generate at most 3 rows + And there is a constraint: + """ + { + "field": "bar", + "is": "equalTo", + "otherField": "foo" + } + """ + Then the following data should be generated: + | foo| bar| + | 1 | 1 | + | 2 | 2 | + | 3 | 3 | + + Scenario: The one where a user can specify that one number should be equal to another number with a positive offset + Given bar is greater than 1 + And the generator can generate at most 3 rows + And there is a constraint: + """ + { + "field": "bar", + "is": "equalTo", + "otherField": "foo", + "offset": 3, + "offsetUnit": "integer" + } + """ + Then the following data should be generated: + | foo| bar| + | 1 | 4 | + | 2 | 5 | + | 3 | 6 | + + Scenario: The one where a user can specify that one number should be equal to another number with a negative offset + Given the generator can generate at most 3 rows + And there is a constraint: + """ + { + "field": "bar", + "is": "equalTo", + "otherField": "foo", + "offset": -3, + "offsetUnit": "integer" + } + """ + Then the following data should be generated: + | foo| bar| + | 1 | -2 | + | 2 | -1 | + | 3 | 0 | + + Scenario: The one where a user can specify that one number should be greater than another number with a positive offset + Given bar is greater than 1 + And the generator can generate at most 3 rows + And there is a constraint: + """ + { + "field": "bar", + "is": "greaterThan", + "otherField": "foo", + "offset": 3, + "offsetUnit": "integer" + } + """ + Then the following data should be generated: + | foo| bar| + | 1 | 4 | + | 2 | 5 | + | 3 | 6 | + + Scenario: The one where a user can specify that one number should be less than another number with a negative offset + Given the generator can generate at most 3 rows + And there is a constraint: + """ + { + "field": "bar", + "is": "lessThan", + "otherField": "foo", + "offset": -3, + "offsetUnit": "integer" + } + """ + Then the following data should be generated: + | foo| bar| + | 1 | -2 | + | 2 | -1 | + | 3 | 0 | + + ###Decimal + + Scenario: The one where a user can specify that one decimal number should be greater than another decimal number + Given foo is of type "decimal" + And foo is greater than 1.0 + And bar is of type "decimal" + And bar is greater than 1.0 + And the generator can generate at most 3 rows + And there is a constraint: + """ + { + "field": "bar", + "is": "greaterThan", + "otherField": "foo" + } + """ + Then the following data should be generated: + | foo | bar | + | 1.0 | 1.1 | + | 1.1 | 1.2 | + | 1.2 | 1.3 | + + ###Exhaustive + + Scenario: The one where a user can specify that one number should be greater than another number - exhaustive + Given the combination strategy is exhaustive + And bar is greater than 1 + And bar is less than 5 + And the generator can generate at most 6 rows + And there is a constraint: + """ + { + "field": "bar", + "is": "greaterThan", + "otherField": "foo" + } + """ + Then the following data should be generated: + | foo| bar| + | 1 | 2 | + | 1 | 3 | + | 1 | 4 | + | 2 | 3 | + | 2 | 4 | + | 3 | 4 | + From 5f662b013412d587b6bbff695ff9ef73102a76f3 Mon Sep 17 00:00:00 2001 From: Tom Gilbert Date: Thu, 12 Sep 2019 13:30:45 +0100 Subject: [PATCH 2/3] test(#1235): Tweak decimal test and exhaustive test following feedback --- .../features/operators/numeric/FieldDependencies.feature | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/orchestrator/src/test/java/com/scottlogic/deg/orchestrator/cucumber/features/operators/numeric/FieldDependencies.feature b/orchestrator/src/test/java/com/scottlogic/deg/orchestrator/cucumber/features/operators/numeric/FieldDependencies.feature index d0b5f3047..0e5a7cbae 100644 --- a/orchestrator/src/test/java/com/scottlogic/deg/orchestrator/cucumber/features/operators/numeric/FieldDependencies.feature +++ b/orchestrator/src/test/java/com/scottlogic/deg/orchestrator/cucumber/features/operators/numeric/FieldDependencies.feature @@ -178,8 +178,10 @@ Feature:As a User Scenario: The one where a user can specify that one decimal number should be greater than another decimal number Given foo is of type "decimal" + And foo is granular to 0.1 And foo is greater than 1.0 And bar is of type "decimal" + And bar is granular to 0.1 And bar is greater than 1.0 And the generator can generate at most 3 rows And there is a constraint: @@ -200,7 +202,7 @@ Feature:As a User Scenario: The one where a user can specify that one number should be greater than another number - exhaustive Given the combination strategy is exhaustive - And bar is greater than 1 + And bar is greater than 0 And bar is less than 5 And the generator can generate at most 6 rows And there is a constraint: From 08ad85e273af87a19eda0478d7cdc85e5243121b Mon Sep 17 00:00:00 2001 From: Tom Gilbert Date: Fri, 13 Sep 2019 16:05:57 +0100 Subject: [PATCH 3/3] test(#1235): Add ignore tag at feature level --- .../features/operators/numeric/FieldDependencies.feature | 1 + 1 file changed, 1 insertion(+) diff --git a/orchestrator/src/test/java/com/scottlogic/deg/orchestrator/cucumber/features/operators/numeric/FieldDependencies.feature b/orchestrator/src/test/java/com/scottlogic/deg/orchestrator/cucumber/features/operators/numeric/FieldDependencies.feature index 0e5a7cbae..12d79a4b0 100644 --- a/orchestrator/src/test/java/com/scottlogic/deg/orchestrator/cucumber/features/operators/numeric/FieldDependencies.feature +++ b/orchestrator/src/test/java/com/scottlogic/deg/orchestrator/cucumber/features/operators/numeric/FieldDependencies.feature @@ -1,3 +1,4 @@ +@ignore #pending development of #1235 - Allow a Numeric Field to Depend On Another Numeric Field Feature:As a User I can specify that a numeric value is greater than, less than or equal to a numeric value in a different field So that I can setup the test data to meet my requirements