Skip to content

Commit 56f6cbf

Browse files
feat(tests): relax validation rules and expand enum coverage in well-inventory-csv feature
- Move site_name, elevation_ft, elevation_method, and measuring_point_height_ft from required to optional - Replace "both contact_name and contact_organization required" rule with "at least one required" rule - Remove all-or-nothing water level rule; water_level_date_time now required only when depth_to_water_ft is provided, all other water level fields are independent and optional - Add negative scenarios for invalid address_type, state abbreviation, well_hole_status, monitoring_status, and well_pump_type with allowed values specified - Add well_notes, well_measuring_notes, water_notes, historical_notes, well_hole_status, and monitoring_status to optional fields
1 parent 0ff7bcc commit 56f6cbf

1 file changed

Lines changed: 98 additions & 48 deletions

File tree

tests/features/well-inventory-csv.feature

Lines changed: 98 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,15 @@ Feature: Bulk upload well inventory from CSV via CLI
3535
| required field name |
3636
| project |
3737
| well_name_point_id |
38-
| site_name |
3938
| date_time |
4039
| field_staff |
4140
| utm_easting |
4241
| utm_northing |
4342
| utm_zone |
44-
| elevation_ft |
45-
| elevation_method |
46-
| measuring_point_height_ft |
4743
And each "well_name_point_id" value is unique per row
4844
And the CSV includes optional fields when available:
4945
| optional field name |
46+
| site_name |
5047
| field_staff_2 |
5148
| field_staff_3 |
5249
| contact_1_name |
@@ -110,32 +107,41 @@ Feature: Bulk upload well inventory from CSV via CLI
110107
| completion_source |
111108
| total_well_depth_ft |
112109
| historic_depth_to_water_ft |
110+
| historical_notes |
113111
| depth_source |
114112
| well_pump_type |
115113
| well_pump_depth_ft |
116114
| is_open |
117115
| datalogger_possible |
118116
| casing_diameter_ft |
117+
| elevation_ft |
118+
| elevation_method |
119+
| measuring_point_height_ft |
119120
| measuring_point_description |
120121
| well_purpose |
121122
| well_purpose_2 |
122-
| well_status |
123+
| well_hole_status |
124+
| well_status |
123125
| monitoring_frequency |
126+
| monitoring_status |
124127
| sampling_scenario_notes |
128+
| well_notes |
129+
| well_measuring_notes |
130+
| water_notes |
125131
| well_measuring_notes |
126132
| sample_possible |
127-
And the csv includes optional water level entry fields when available:
133+
And the csv includes optional water level entry fields when available:
128134
| water_level_entry fields |
129135
| measuring_person |
130136
| sample_method |
131137
| water_level_date_time |
132138
| mp_height |
133139
| level_status |
134140
| depth_to_water_ft |
135-
| data_quality |
141+
| data_quality |
136142
| water_level_notes |
137-
And the required "date_time" values are valid ISO 8601 timezone-naive datetime strings (e.g. "2025-02-15T10:30:00")
138-
And the optional "water_level_date_time" values are valid ISO 8601 timezone-naive datetime strings (e.g. "2025-02-15T10:30:00") when provided
143+
And the required "date_time" values are valid ISO 8601 timezone-naive datetime strings (e.g. "2025-02-15T10:30:00")
144+
And the optional "water_level_date_time" values are valid ISO 8601 timezone-naive datetime strings (e.g. "2025-02-15T10:30:00") when provided
139145

140146
# And all optional lexicon fields contain valid lexicon values when provided
141147
# And all optional numeric fields contain valid numeric values when provided
@@ -161,15 +167,11 @@ Feature: Bulk upload well inventory from CSV via CLI
161167
| required field name |
162168
| project |
163169
| well_name_point_id |
164-
| site_name |
165170
| date_time |
166171
| field_staff |
167172
| utm_easting |
168173
| utm_northing |
169174
| utm_zone |
170-
| elevation_ft |
171-
| elevation_method |
172-
| measuring_point_height_ft |
173175
When I run the well inventory bulk upload command
174176
Then the command exits with code 0
175177
And the system should return a response in JSON format
@@ -204,15 +206,15 @@ Feature: Bulk upload well inventory from CSV via CLI
204206

205207
@negative @validation @BDMS-TBD
206208
Scenario: Upload fails when a row has an invalid postal code format
207-
Given my CSV file contains a row that has an invalid postal code format in contact_1_address_1_postal_code
209+
Given my CSV file contains a row that has an invalid postal code format in contact_1_address_1_postal_code
208210
When I run the well inventory bulk upload command
209211
Then the command exits with a non-zero exit code
210212
And the system should return a response in JSON format
211213
And the response includes a validation error indicating the invalid postal code format
212214
And no wells are imported
213215

214216
@negative @validation @BDMS-TBD
215-
Scenario: Upload fails when a row has a contact with a invalid phone number format
217+
Scenario: Upload fails when a row has a contact with an invalid phone number format
216218
Given my CSV file contains a row with a contact with a phone number that is not in the valid format
217219
When I run the well inventory bulk upload command
218220
Then the command exits with a non-zero exit code
@@ -221,7 +223,7 @@ Feature: Bulk upload well inventory from CSV via CLI
221223
And no wells are imported
222224

223225
@negative @validation @BDMS-TBD
224-
Scenario: Upload fails when a row has a contact with a invalid email format
226+
Scenario: Upload fails when a row has a contact with an invalid email format
225227
Given my CSV file contains a row with a contact with an email that is not in the valid format
226228
When I run the well inventory bulk upload command
227229
Then the command exits with a non-zero exit code
@@ -230,7 +232,7 @@ Feature: Bulk upload well inventory from CSV via CLI
230232
And no wells are imported
231233

232234
@negative @validation @BDMS-TBD
233-
Scenario: Upload fails when a row has contact without a contact_role
235+
Scenario: Upload fails when a row has a contact without a contact_role
234236
Given my CSV file contains a row with a contact but is missing the required "contact_role" field for that contact
235237
When I run the well inventory bulk upload command
236238
Then the command exits with a non-zero exit code
@@ -239,7 +241,7 @@ Feature: Bulk upload well inventory from CSV via CLI
239241
And no wells are imported
240242

241243
@negative @validation @BDMS-TBD
242-
Scenario: Upload fails when a row has contact without a "contact_type"
244+
Scenario: Upload fails when a row has a contact without a "contact_type"
243245
Given my CSV file contains a row with a contact but is missing the required "contact_type" field for that contact
244246
When I run the well inventory bulk upload command
245247
Then the command exits with a non-zero exit code
@@ -248,7 +250,7 @@ Feature: Bulk upload well inventory from CSV via CLI
248250
And no wells are imported
249251

250252
@negative @validation @BDMS-TBD
251-
Scenario: Upload fails when a row has contact with an invalid "contact_type"
253+
Scenario: Upload fails when a row has a contact with an invalid "contact_type"
252254
Given my CSV file contains a row with a contact_type value that is not in the valid lexicon for "contact_type"
253255
When I run the well inventory bulk upload command
254256
Then the command exits with a non-zero exit code
@@ -257,7 +259,7 @@ Feature: Bulk upload well inventory from CSV via CLI
257259
And no wells are imported
258260

259261
@negative @validation @BDMS-TBD
260-
Scenario: Upload fails when a row has contact with an email without an email_type
262+
Scenario: Upload fails when a row has a contact with an email without an email_type
261263
Given my CSV file contains a row with a contact with an email but is missing the required "email_type" field for that email
262264
When I run the well inventory bulk upload command
263265
Then the command exits with a non-zero exit code
@@ -266,7 +268,7 @@ Feature: Bulk upload well inventory from CSV via CLI
266268
And no wells are imported
267269

268270
@negative @validation @BDMS-TBD
269-
Scenario: Upload fails when a row has contact with a phone without a phone_type
271+
Scenario: Upload fails when a row has a contact with a phone without a phone_type
270272
Given my CSV file contains a row with a contact with a phone but is missing the required "phone_type" field for that phone
271273
When I run the well inventory bulk upload command
272274
Then the command exits with a non-zero exit code
@@ -275,14 +277,59 @@ Feature: Bulk upload well inventory from CSV via CLI
275277
And no wells are imported
276278

277279
@negative @validation @BDMS-TBD
278-
Scenario: Upload fails when a row has contact with an address without an address_type
280+
Scenario: Upload fails when a row has a contact with an address without an address_type
279281
Given my CSV file contains a row with a contact with an address but is missing the required "address_type" field for that address
280282
When I run the well inventory bulk upload command
281283
Then the command exits with a non-zero exit code
282284
And the system should return a response in JSON format
283285
And the response includes a validation error indicating the missing "address_type" value
284286
And no wells are imported
285287

288+
@negative @validation @BDMS-TBD
289+
Scenario: Upload fails when a row has a contact with an invalid "address_type"
290+
Given my CSV file contains a row with an address_type value that is not one of: Work, Personal, Mailing, Physical
291+
When I run the well inventory bulk upload command
292+
Then the command exits with a non-zero exit code
293+
And the system should return a response in JSON format
294+
And the response includes a validation error indicating an invalid "address_type" value
295+
And no wells are imported
296+
297+
@negative @validation @BDMS-TBD
298+
Scenario: Upload fails when a row has a contact with an invalid state abbreviation
299+
Given my CSV file contains a row with a state value that is not a valid 2-letter US state abbreviation
300+
When I run the well inventory bulk upload command
301+
Then the command exits with a non-zero exit code
302+
And the system should return a response in JSON format
303+
And the response includes a validation error indicating an invalid state value
304+
And no wells are imported
305+
306+
@negative @validation @BDMS-TBD
307+
Scenario: Upload fails when a row has an invalid well_hole_status value
308+
Given my CSV file contains a row with a well_hole_status value that is not one of: "Abandoned", "Active, pumping well", "Destroyed, exists but not usable", "Inactive, exists but not used"
309+
When I run the well inventory bulk upload command
310+
Then the command exits with a non-zero exit code
311+
And the system should return a response in JSON format
312+
And the response includes a validation error indicating an invalid "well_hole_status" value
313+
And no wells are imported
314+
315+
@negative @validation @BDMS-TBD
316+
Scenario: Upload fails when a row has an invalid monitoring_status value
317+
Given my CSV file contains a row with a monitoring_status value that is not one of: "Open", "Open (unequipped)", "Closed", "Datalogger can be installed", "Datalogger cannot be installed", "Abandoned", "Active, pumping well", "Destroyed, exists but not usable", "Inactive, exists but not used", "Currently monitored", "Not currently monitored"
318+
When I run the well inventory bulk upload command
319+
Then the command exits with a non-zero exit code
320+
And the system should return a response in JSON format
321+
And the response includes a validation error indicating an invalid "monitoring_status" value
322+
And no wells are imported
323+
324+
@negative @validation @BDMS-TBD
325+
Scenario: Upload fails when a row has an invalid well_pump_type value
326+
Given my CSV file contains a row with a well_pump_type value that is not one of: "Submersible", "Jet", "Line Shaft", "Hand"
327+
When I run the well inventory bulk upload command
328+
Then the command exits with a non-zero exit code
329+
And the system should return a response in JSON format
330+
And the response includes a validation error indicating an invalid "well_pump_type" value
331+
And no wells are imported
332+
286333
@negative @validation @BDMS-TBD
287334
Scenario: Upload fails when a row has utm_easting utm_northing and utm_zone values that are not within New Mexico
288335
Given my CSV file contains a row with utm_easting utm_northing and utm_zone values that are not within New Mexico
@@ -292,6 +339,24 @@ Feature: Bulk upload well inventory from CSV via CLI
292339
And the response includes a validation error indicating the invalid UTM coordinates
293340
And no wells are imported
294341

342+
@negative @validation @BDMS-TBD
343+
Scenario: Upload fails when a row has a contact with neither contact_name nor contact_organization
344+
Given my CSV file contains a row with contact fields filled but both "contact_1_name" and "contact_1_organization" are blank
345+
When I run the well inventory bulk upload command
346+
Then the command exits with a non-zero exit code
347+
And the system should return a response in JSON format
348+
And the response includes a validation error indicating that at least one of "contact_1_name" or "contact_1_organization" must be provided
349+
And no wells are imported
350+
351+
@negative @validation @BDMS-TBD
352+
Scenario: Upload fails when water_level_date_time is missing but depth_to_water_ft is provided
353+
Given my CSV file contains a row where "depth_to_water_ft" is filled but "water_level_date_time" is blank
354+
When I run the well inventory bulk upload command
355+
Then the command exits with a non-zero exit code
356+
And the system should return a response in JSON format
357+
And the response includes a validation error indicating that "water_level_date_time" is required when "depth_to_water_ft" is provided
358+
And no wells are imported
359+
295360
@negative @validation @required_fields @BDMS-TBD
296361
Scenario Outline: Upload fails when a required field is missing
297362
Given my CSV file contains a row missing the required "<required_field>" field
@@ -305,15 +370,11 @@ Feature: Bulk upload well inventory from CSV via CLI
305370
| required_field |
306371
| project |
307372
| well_name_point_id |
308-
| site_name |
309373
| date_time |
310374
| field_staff |
311375
| utm_easting |
312376
| utm_northing |
313377
| utm_zone |
314-
| elevation_ft |
315-
| elevation_method |
316-
| measuring_point_height_ft |
317378

318379
@negative @validation @boolean_fields @BDMS-TBD
319380
Scenario: Upload fails due to invalid boolean field values
@@ -359,9 +420,9 @@ Feature: Bulk upload well inventory from CSV via CLI
359420
And no wells are imported
360421

361422

362-
# ###########################################################################
363-
# # FILE FORMAT SCENARIOS
364-
# ###########################################################################
423+
###########################################################################
424+
# FILE FORMAT SCENARIOS
425+
###########################################################################
365426

366427
@negative @file_format @limits @BDMS-TBD
367428
Scenario: Upload fails when the CSV exceeds the maximum allowed number of rows
@@ -409,7 +470,6 @@ Feature: Bulk upload well inventory from CSV via CLI
409470
And the response includes a validation error indicating a repeated header row
410471
And no wells are imported
411472

412-
413473
@negative @validation @header_row @BDMS-TBD
414474
Scenario: Upload fails when the header row contains duplicate column names
415475
Given my CSV file header row contains the "contact_1_email_1" column name more than once
@@ -419,7 +479,6 @@ Feature: Bulk upload well inventory from CSV via CLI
419479
And the response includes a validation error indicating duplicate header names
420480
And no wells are imported
421481

422-
423482
###########################################################################
424483
# DELIMITER & QUOTING / EXCEL-RELATED SCENARIOS
425484
###########################################################################
@@ -448,27 +507,18 @@ Feature: Bulk upload well inventory from CSV via CLI
448507
Then the command exits with code 0
449508
And the system should return a response in JSON format
450509
And all wells are imported
451-
#
452-
# @negative @validation @numeric @excel @BDMS-TBD
453-
# Scenario: Upload fails when numeric fields are provided in Excel scientific notation format
454-
# Given my CSV file contains a numeric-required field such as "utm_easting"
455-
# And Excel has exported the "utm_easting" value in scientific notation (for example "1.2345E+06")
456-
# When I run the well inventory bulk upload command
457-
# Then the command exits with a non-zero exit code
458-
# And the system should return a response in JSON format
459-
# And the response includes a validation error indicating an invalid numeric format for "utm_easting"
460-
# And no wells are imported
461-
462-
###########################################################################
510+
511+
###########################################################################
463512
# WATER LEVEL ENTRY VALIDATION
464-
###########################################################################
513+
###########################################################################
465514

466-
# if one water level entry field is filled, then all are required
515+
# water_level_date_time is required only when depth_to_water_ft is provided
516+
# all other water level fields are optional and independent
467517
@negative @validation @BDMS-TBD
468-
Scenario: Water level entry fields are all required if any are filled
469-
Given my csv file contains a row where some but not all water level entry fields are filled
518+
Scenario: Upload fails when depth_to_water_ft is provided but water_level_date_time is missing
519+
Given my csv file contains a row where "depth_to_water_ft" is filled but "water_level_date_time" is blank
470520
When I run the well inventory bulk upload command
471521
Then the command exits with a non-zero exit code
472522
And the system should return a response in JSON format
473-
And the response includes validation errors for each missing water level entry field
523+
And the response includes a validation error indicating that "water_level_date_time" is required when "depth_to_water_ft" is provided
474524
And no wells are imported

0 commit comments

Comments
 (0)