You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Checks that the current value of a field is unique in a CSV or JSON input file</p>
7907
+
</summary>
7908
+
<p>Where</p>
7909
+
<ul>
7910
+
<li><code><name></code>the name of the field to check</li>
7911
+
<li><code><filepathRef file></code> is the name of the binding containing the path of the CSV or JSON file</li>
7912
+
</ul>
7913
+
7914
+
The data value contained in the first record that satisifes the given predicate will be bound to the global scope. Otherwise if no records match, then no value will be bound.
7915
+
7916
+
<p>Examples</p>
7917
+
7918
+
##### CSV Check
7919
+
7920
+
Given the CSV file: resources/StateCodes.csv
7921
+
7922
+
```csv
7923
+
Code,Name
7924
+
ACT,Australian Capital Territory
7925
+
NSW,New South Wales
7926
+
NT,Northern Territory
7927
+
QLD,Queensland
7928
+
SA,South Australia
7929
+
TAS,Tasmania
7930
+
VIC,Victoria
7931
+
WA,Western Australia
7932
+
```
7933
+
7934
+
The following will check that all values in the <code>Name</code> column are unique:
7935
+
7936
+
```gherkin {2}
7937
+
Given the mapping file is "resources/StateCodes.csv"
7938
+
Then Name should be unique in the mapping file
7939
+
```
7940
+
7941
+
##### JSON Check
7942
+
7943
+
Given the JSON file: resources/StateCodes.json
7944
+
7945
+
```json
7946
+
[
7947
+
{ "Code": "ACT", "Name": "Australian Capital Territory" },
7948
+
{ "Code": "NSW", "Name": "New South Wales" },
7949
+
{ "Code": "NT", "Name": "Northern Territory" },
7950
+
{ "Code": "QLD", "Name": "Queensland" },
7951
+
{ "Code": "SA", "Name": "South Australia" },
7952
+
{ "Code": "TAS", "Name": "Tasmania" },
7953
+
{ "Code": "VIC", "Name": "Victoria" },
7954
+
{ "Code": "WA", "Name": "Western Australia" }
7955
+
]
7956
+
```
7957
+
7958
+
The following will check that all <code>Name</code> properties are unique:
7959
+
7960
+
```gherkin {1}
7961
+
Given the mapping file is "resources/StateCodes.json"
0 commit comments