updated resoscript variables and added further test support

This commit is contained in:
Joshua Darnell 2020-02-24 19:15:45 -08:00
parent 366cb07f8f
commit d5202cf3de
4 changed files with 67 additions and 51 deletions

Binary file not shown.

View File

@ -282,48 +282,48 @@
/>
<Request
TestDescription="Query Support: $filter - Integer Comparison: eq (equal)"
RequirementId="REQ-WA103-QO2.filter.compare.int.eq"
TestDescription="Query Support: $filter - Integer Arithmetic Comparison: eq (equal)"
RequirementId="REQ-WA103-QO2.filter.arithmetic.compare.int.eq"
MetallicLevel="Core"
Capability="Filterability ($filter)"
WebAPIReference="2.4.4"
OutputFile="REQ-WA103-QO2.filter.compare.int.eq.json"
OutputFile="REQ-WA103-QO2.filter.arithmetic.compare.int.eq.json"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_TopCount*&amp;$select=*Parameter_SelectList*&amp;$filter=*Parameter_FilterIntegerField* eq *Parameter_FilterIntegerValueLow**Parameter_RequiredParameters*"
/>
<Request
TestDescription="Query Support: $filter - Integer Comparison: ne (not equal)"
RequirementId="REQ-WA103-QO3.filter.compare.int.ne"
TestDescription="Query Support: $filter - Integer Arithmetic Comparison: ne (not equal)"
RequirementId="REQ-WA103-QO3.filter.arithmetic.compare.int.ne"
MetallicLevel="Core"
Capability="Filterability ($filter)"
WebAPIReference="2.4.4"
OutputFile="REQ-WA103-QO3.filter.compare.int.ne.json"
OutputFile="REQ-WA103-QO3.filter.arithmetic.compare.int.ne.json"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_TopCount*&amp;$select=*Parameter_SelectList*&amp;$filter=*Parameter_FilterIntegerField* ne *Parameter_FilterIntegerValueLow**Parameter_RequiredParameters*"
/>
<Request
TestDescription="Query Support: $filter - Integer Comparison: gt (greater than)"
RequirementId="REQ-WA103-QO4.filter.compare.int.gt"
TestDescription="Query Support: $filter - Integer Arithmetic Comparison: gt (greater than)"
RequirementId="REQ-WA103-QO4.filter.arithmetic.compare.int.gt"
MetallicLevel="Core"
Capability="Filterability ($filter)"
WebAPIReference="2.4.4"
OutputFile="REQ-WA103-QO4.filter.compare.int.gt.json"
OutputFile="REQ-WA103-QO4.filter.arithmetic.compare.int.gt.json"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_TopCount*&amp;$select=*Parameter_SelectList*&amp;$filter=*Parameter_FilterIntegerField* gt *Parameter_FilterIntegerValueLow**Parameter_RequiredParameters*"
/>
<Request
TestDescription="Query Support: $filter - Integer Comparison: ge (greater or equal)"
RequirementId="REQ-WA103-QO5.filter.compare.int.ge"
TestDescription="Query Support: $filter - Integer Arithmetic Comparison: ge (greater or equal)"
RequirementId="REQ-WA103-QO5.filter.arithmetic.compare.int.ge"
MetallicLevel="Core"
Capability="Filterability ($filter)"
WebAPIReference="2.4.4"
OutputFile="REQ-WA103-QO5.filter.compare.int.ge.json"
OutputFile="REQ-WA103-QO5.filter.arithmetic.compare.int.ge.json"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_TopCount*&amp;$select=*Parameter_SelectList*&amp;$filter=*Parameter_FilterIntegerField* ge *Parameter_FilterIntegerValueLow**Parameter_RequiredParameters*"
/>
<Request
TestDescription="Query Support: $filter - Integer Comparison: lt (less than)"
RequirementId="REQ-WA103-QO6.filter.compare.int.lt"
TestDescription="Query Support: $filter - Integer Arithmetic Comparison: lt (less than)"
RequirementId="REQ-WA103-QO6.filter.arithmetic.compare.int.lt"
MetallicLevel="Core"
Capability="Filterability ($filter)"
WebAPIReference="2.4.4"
@ -332,37 +332,37 @@
/>
<Request
TestDescription="Query Support: $filter - Integer Comparison: le (less or equal)"
RequirementId="REQ-WA103-QO7.filter.compare.int.le"
TestDescription="Query Support: $filter - Integer Arithmetic Comparison: le (less or equal)"
RequirementId="REQ-WA103-QO7.filter.arithmetic.compare.int.le"
MetallicLevel="Core"
Capability="Filterability ($filter)"
WebAPIReference="2.4.4"
OutputFile="REQ-WA103-QO7.filter.compare.int.le.json"
OutputFile="REQ-WA103-QO7.filter.arithmetic.compare.int.le.json"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_TopCount*&amp;$select=*Parameter_SelectList*&amp;$filter=*Parameter_FilterIntegerField* le *Parameter_FilterIntegerValueLow**Parameter_RequiredParameters*"
/>
<Request
TestDescription="Query Support: $filter - Logical: and"
RequirementId="REQ-WA103-QO9"
TestDescription="Query Support: $filter - Integer Logical Comparison: and"
RequirementId="REQ-WA103-QO9.filter.logical.compare.int.and"
MetallicLevel="Core"
Capability="Filterability ($filter)"
WebAPIReference="2.4.4"
OutputFile="REQ-WA103-QO9_filter_and.json"
OutputFile="REQ-WA103-QO9.filter.logical.compare.int.and.json"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_TopCount*&amp;$select=*Parameter_SelectList*&amp;$filter=*Parameter_FilterIntegerField* gt *Parameter_FilterIntegerValueLow* and *Parameter_FilterIntegerField* lt *Parameter_FilterIntegerValueHigh**Parameter_RequiredParameters*"
/>
<Request
TestDescription="Query Support: $filter - Logical: or"
RequirementId="REQ-WA103-QO10"
TestDescription="Query Support: $filter - Integer Logical Comparison: or"
RequirementId="REQ-WA103-QO10.filter.logical.compare.int.or"
MetallicLevel="Core"
Capability="Filterability ($filter)"
WebAPIReference="2.4.4"
OutputFile="REQ-WA103-QO10_filter_or.json"
OutputFile="REQ-WA103-QO10.filter.logical.compare.int.or.json"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_TopCount*&amp;$select=*Parameter_SelectList*&amp;$filter=*Parameter_FilterIntegerField* gt *Parameter_FilterIntegerValueHigh* or *Parameter_FilterIntegerField* lt *Parameter_FilterIntegerValueLow**Parameter_RequiredParameters*"
/>
<Request
TestDescription="Query Support: $filter - Logical: not"
TestDescription="Query Support: $filter - Integer Logical: not"
RequirementId="REQ-WA103-QO11"
MetallicLevel="Core"
Capability="Filterability ($filter)"

View File

@ -72,44 +72,58 @@ Feature: Web API Server 1.0.2 Certification
When a GET request is made to the resolved Url in "REQ-WA103-QO1.orderby.desc.case"
Then the server responds with a status code of 400 if the server headers report OData version "4.0"
@REQ-WA103-QO2 @REQ-WA103-QO2.filter.compare.int.eq @core @2.4.4 @filterability-endorsement
Scenario: Query Support: $filter - Integer Comparison: eq
@REQ-WA103-QO2 @core @2.4.4 @filterability-endorsement
Scenario: Query Support: $filter - Integer Arithmetic Comparison: eq
When a GET request is made to the resolved Url in "REQ-WA103-QO2.filter.compare.int.eq"
Then the server responds with a status code of 200
And the response is valid JSON
And Integer data in "Parameter_FilterIntegerField" "eq" the value in "Parameter_FilterIntegerValueLow"
And Integer data in "Parameter_FilterIntegerField" is "eq" the value in "Parameter_FilterIntegerValueLow"
@REQ-WA103-QO3 @REQ-WA103-QO3.filter.compare.int.ne @core @2.4.4 @filterability-endorsement
Scenario: Query Support: $filter - Integer Comparison: ne
@REQ-WA103-QO3 @core @2.4.4 @filterability-endorsement
Scenario: Query Support: $filter - Integer Arithmetic Comparison: ne
When a GET request is made to the resolved Url in "REQ-WA103-QO3.filter.compare.int.ne"
Then the server responds with a status code of 200
And the response is valid JSON
And Integer data in "Parameter_FilterIntegerField" "ne" the value in "Parameter_FilterIntegerValueLow"
And Integer data in "Parameter_FilterIntegerField" is "ne" the value in "Parameter_FilterIntegerValueLow"
@REQ-WA103-QO4 @REQ-WA103-QO4.filter.compare.int.gt @core @2.4.4 @filterability-endorsement
Scenario: Query Support: $filter - Integer Comparison: gt
@REQ-WA103-QO4 @core @2.4.4 @filterability-endorsement
Scenario: Query Support: $filter - Integer Arithmetic Comparison: gt
When a GET request is made to the resolved Url in "REQ-WA103-QO4.filter.compare.int.gt"
Then the server responds with a status code of 200
And the response is valid JSON
And Integer data in "Parameter_FilterIntegerField" "gt" the value in "Parameter_FilterIntegerValueLow"
And Integer data in "Parameter_FilterIntegerField" is "gt" the value in "Parameter_FilterIntegerValueLow"
@REQ-WA103-QO5 @REQ-WA103-QO5.filter.compare.int.ge @core @2.4.4 @filterability-endorsement
Scenario: Query Support: $filter - Integer Comparison: ge
@REQ-WA103-QO5 @core @2.4.4 @filterability-endorsement
Scenario: Query Support: $filter - Integer Arithmetic Comparison: ge
When a GET request is made to the resolved Url in "REQ-WA103-QO5.filter.compare.int.ge"
Then the server responds with a status code of 200
And the response is valid JSON
And Integer data in "Parameter_FilterIntegerField" "ge" the value in "Parameter_FilterIntegerValueLow"
And Integer data in "Parameter_FilterIntegerField" is "ge" the value in "Parameter_FilterIntegerValueLow"
@REQ-WA103-QO6 @REQ-WA103-QO6.filter.compare.int.lt @core @2.4.4 @filterability-endorsement
Scenario: Query Support: $filter - Integer Comparison: lt
@REQ-WA103-QO6 @core @2.4.4 @filterability-endorsement
Scenario: Query Support: $filter - Integer Arithmetic Comparison: lt
When a GET request is made to the resolved Url in "REQ-WA103-QO6.filter.compare.int.lt"
Then the server responds with a status code of 200
And the response is valid JSON
And Integer data in "Parameter_FilterIntegerField" "lt" the value in "Parameter_FilterIntegerValueLow"
And Integer data in "Parameter_FilterIntegerField" is "lt" the value in "Parameter_FilterIntegerValueLow"
@REQ-WA103-QO7 @REQ-WA103-QO7.filter.compare.int.le @core @2.4.4 @filterability-endorsement
Scenario: Query Support: $filter - Integer Comparison: le
@REQ-WA103-QO7 @core @2.4.4 @filterability-endorsement
Scenario: Query Support: $filter - Integer Arithmetic Comparison: le
When a GET request is made to the resolved Url in "REQ-WA103-QO7.filter.compare.int.le"
Then the server responds with a status code of 200
And the response is valid JSON
And Integer data in "Parameter_FilterIntegerField" "le" the value in "Parameter_FilterIntegerValueLow"
And Integer data in "Parameter_FilterIntegerField" is "le" the value in "Parameter_FilterIntegerValueLow"
@REQ-WA103-QO8 @core @2.4.4 @filterability-endorsement
Scenario: Query Support: $filter - Integer Arithmetic Comparison: le
When a GET request is made to the resolved Url in "REQ-WA103-QO7.filter.compare.int.le"
Then the server responds with a status code of 200
And the response is valid JSON
And Integer data in "Parameter_FilterIntegerField" is "le" the value in "Parameter_FilterIntegerValueLow"
@REQ-WA103-QO9 @core @2.4.4 @filterability-endorsement
Scenario: Query Support: $filter - Integer Logical Comparison: and
When a GET request is made to the resolved Url in "REQ-WA103-QO7.filter.compare.int.le"
Then the server responds with a status code of 200
And the response is valid JSON
And Integer data in "Parameter_FilterIntegerField" is "le" the value in "Parameter_FilterIntegerValueLow"

View File

@ -363,29 +363,32 @@ public class WebAPIServer_1_0_2 implements En {
* Compares field data (LHS) to a given parameter value (RHS). The operator is passed as a string,
* and is used to select among the supported comparisons.
*/
And("^Integer data in \"([^\"]*)\" \"([^\"]*)\" the value in \"([^\"]*)\"$", (String parameterFieldName, String op, String parameterAssertedValue) -> {
And("^Integer data in \"([^\"]*)\" is \"([^\"]*)\" the value in \"([^\"]*)\"$", (String parameterFieldName, String op, String parameterAssertedValue) -> {
LOG.info("Parameter_FieldName: " + parameterFieldName + ", op: " + op + ", Parameter_Value: " + parameterAssertedValue);
String fieldName = Utils.resolveValue(parameterFieldName, settings);
int assertedValue = Integer.parseInt(Utils.resolveValue(parameterAssertedValue, settings));
AtomicReference<Integer> fieldValue = new AtomicReference<>();
//iterate through response data and ensure that with data, the statement fieldName "op" assertValue is true
from(responseData.get()).getList(JSON_VALUE_PATH, HashMap.class).forEach(item -> {
fieldValue.set(Integer.parseInt(item.get(fieldName).toString()));
if (op.equals("eq")) {
assertEquals(Integer.parseInt(item.get(fieldName).toString()), assertedValue);
assertEquals(fieldValue.get().intValue(), assertedValue);
} else if (op.equals("ne")) {
assertTrue(Integer.parseInt(item.get(fieldName).toString()) != assertedValue);
assertTrue(fieldValue.get() != assertedValue);
} else if (op.equals("gt")) {
assertTrue(Integer.parseInt(item.get(fieldName).toString()) > assertedValue);
assertTrue(fieldValue.get() > assertedValue);
} else if (op.equals("ge")) {
assertTrue(Integer.parseInt(item.get(fieldName).toString()) >= assertedValue);
assertTrue(fieldValue.get() >= assertedValue);
} else if (op.equals("lt")) {
assertTrue(Integer.parseInt(item.get(fieldName).toString()) < assertedValue);
assertTrue(fieldValue.get() < assertedValue);
} else if (op.equals("le")) {
assertTrue(Integer.parseInt(item.get(fieldName).toString()) <= assertedValue);
assertTrue(fieldValue.get() <= assertedValue);
}
});
});
}
private static class Utils {
@ -404,7 +407,6 @@ public class WebAPIServer_1_0_2 implements En {
}
}
/**
* Resolves the given item into a value
* @param item an item which can either be a reference to a parameter, client setting, or it can be an actual value.