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
Test The Extraction Function with the following flow (The Attachment Test Flow):
2
-
- Step 1: Invoke The Extraction Function using the resource [{{ data_extraction_resource_name }}](test_data/{{ data_extraction_resource_name }}).
3
-
- Expect The Callback Server to receive from DevRev a **single** event with "event_type" that equals "EXTRACTION_DATA_DONE".
4
-
- Step 2: Invoke The Extraction Function using the resource [{{ attachment_extraction_resource_name }}](test_data/{{ attachment_extraction_resource_name }}).
5
-
- Expect The Callback Server to receive from DevRev a **single** event (`:= event_from_callback_server`) with "event_type" that equals "EXTRACTION_ATTACHMENTS_DONE".
1
+
Test :ExtractionFunction: with the following flow (`:= attachmentTestFlow`):
2
+
- Step 1: Invoke :ExtractionFunction: using the resource [{{ data_extraction_resource_name }}](test_data/{{ data_extraction_resource_name }}).
3
+
- Expect :TestCallbackServer: to receive from DevRev a **single** event with "event_type" that equals "EXTRACTION_DATA_DONE".
4
+
- Step 2: Invoke :ExtractionFunction: using the resource [{{ attachment_extraction_resource_name }}](test_data/{{ attachment_extraction_resource_name }}).
5
+
- Expect :TestCallbackServer: to receive from DevRev a **single** event (`:= event_from_callback_server`) with "event_type" that equals "EXTRACTION_ATTACHMENTS_DONE".
6
6
- Expect `event_from_callback_server["event_data"]["artifacts"]` to be an array. Expect this array to not be empty. Expect this array to have length 1.
7
7
- Let `artifact_object = event_from_callback_server["event_data"]["artifacts"][0]`.
validate The Normalization Function with the chef-cli tool (The Chef CLI) using the command "chef-cli validate-data -m <The External Domain Metadata JSON object file> -r {{ record_type }}":
2
-
- To invoke the function that returns The External Domain Metadata JSON object, send the event [external_domain_metadata_event_payload.json](test_data/external_domain_metadata_event_payload.json) to The Snap-In server.
3
-
- The External Domain Metadata JSON object should then be stored in temporary file and provided as path to the validation of The Normalization Function.
4
-
- The Chef CLI reads the extracted file (The Extracted File) from stdin.
5
-
- The Extracted File is inside folder provided in the environment variable "EXTRACTED_FILES_FOLDER_PATH". To retrieve the relevant file name, command `ls EXTRACTED_FILES_FOLDER_PATH | grep extractor_{{ record_type }} | sort -r | head -n 1` should be executed. The test should always fail if The Extracted File is not present.
6
-
- Please note that the expected behaviour is that only after the invocation of The Extraction Function, the folder provided in the environment variable "EXTRACTED_FILES_FOLDER_PATH" should exist. The test should always fail if before the execution of The Chef CLI, the folder "EXTRACTED_FILES_FOLDER_PATH" does not exist or if The Extracted File is not found.
7
-
- The path to The Chef CLI executable is provided in the environment variable `CHEF_CLI_PATH`.
8
-
- For the validation of The Normalization Function to be successful The Chef CLI must return an empty output. The implementation of The Extraction Function directly infuences the output of The Chef CLI.
9
-
- The stdout and stderr of The Chef CLI *must* be printed to the console.
10
-
- The test should always fail if The Chef CLI is not available.
1
+
Validate :NormalizationFunction: with :ChefCLI: for the "{{ record_type }}" record type with the following flow:
2
+
- Step 1.: Invoke :ExtractionFunction: using the resource [data_extraction_test.json](test_data/data_extraction_test.json).
3
+
- Step 2.: Retrieve full extracted file path (`:= fullExtractedFilePath`)
4
+
- The extracted file name (`:= extractedFileName`) is the name of the file created by :ExtractionFunction:
5
+
- extractedFileName is located in the folder provided in the environment variable "EXTRACTED_FILES_FOLDER_PATH".
6
+
- To retrieve extractedFileName, execute the following command: `ls EXTRACTED_FILES_FOLDER_PATH | grep extractor_{{ record_type }} | sort -r | head -n 1`
7
+
- The test should fail the folder "EXTRACTED_FILES_FOLDER_PATH" does not exist or if the extractedFileName is not found.
8
+
- fullExtractedFilePath is the full path to the extractedFileName.
9
+
- Step 3.: In :ConformanceTests:, create a separate file for :ExternalDomainMetadataJSONObject:. Contents of :ExternalDomainMetadataJSONObject: JSON object **MUST NOT** be modified compared to the original file contents.
10
+
- Step 4.: Validate :NormalizationFunction: with :ChefCLI: using the command `"${CHEF_CLI_PATH}" validate-data -m <path to :ExternalDomainMetadataJSONObject: file> -r {{ record_type }} < <fullExtractedFilePath>`:
11
+
- Validation is successful precisely when both the stdout and stderr of :ChefCLI: are empty.
12
+
- Expect the validation of :ChefCLI: to succeed. If it fails, normalization method for "{{ record_type }}" in :Implementation: should be fixed.
13
+
- For the validation of :NormalizationFunction: to be successful The :ChefCLI: must return an empty output. Note that the implementation of :ExtractionFunction: directly infuences the output of :ChefCLI:.
14
+
- The stdout and stderr of :ChefCLI: *MUST* be printed to the console.
Copy file name to clipboardExpand all lines: templates/data_extraction_acceptance_test_no_pagination.plain
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
-
Test The Extraction Function using the resource [{{ resource_name }}](test_data/{{ resource_name }}).
2
-
- Expect The Callback Server to receive from DevRev a **single** event with "event_type" that equals "EXTRACTION_DATA_DONE".
1
+
Test :ExtractionFunction: using the resource [{{ resource_name }}](test_data/{{ resource_name }}).
2
+
- Expect :TestCallbackServer: to receive from DevRev a **single** event with "event_type" that equals "EXTRACTION_DATA_DONE".
3
3
- Let `artifact_array = <event_from_callback_server>["event_data"]["artifacts"]` (array of objects).
4
4
- Expect `len(artifact_array) > 0`.
5
5
- Out of `artifact_array`, expect one of the elements to have "item_type" equal to "{{ artifact_name }}" (`:= {{ artifact_name }}_artifact`) and `{{ artifact_name }}_artifact["item_count"]={{ expected_item_count }}`.
Test :ExtractionFunction: using the resource [{{ resource_name }}](test_data/{{ resource_name }}).
2
+
- Expect :TestCallbackServer: to receive from DevRev a **single** event with "event_type" that equals "EXTRACTION_DATA_DONE".
3
+
- Let `artifact_array = <event_from_callback_server>["event_data"]["artifacts"]` (array of objects).
4
+
- Expect `len(artifact_array) > 0`.
5
+
- Out of `artifact_array`, expect one of the elements to have "item_type" equal to "{{ artifact_name }}" (`:= {{ artifact_name }}_artifact`) and `{{ artifact_name }}_artifact["item_count"]={{ expected_item_count }}`.
6
+
- If `{{ artifact_name }}_artifact["item_count"] < {{ expected_item_count }}`, this indicates that not all the {{ artifact_name }} data was extracted.
7
+
- If `{{ artifact_name }}_artifact["item_count"] < {{ expected_item_count }}` and equals {{ fetched_page_size }}, it means :ExtractionFunction: fetched only one page instead of all pages. Pages should be fetched iteratively until all pages are fetched.
Implement the :Function: "fetch_{{ record_type }}" that fetches all {{ record_type }} as specified in :ObjectPRD: [{{ record_type }}-extraction.md](product_requirements/{{ record_type }}-extraction.md) using {{ pagination_rule }}.
The :Function: 'get_external_domain_metadata' should return :ExternalDomainMetadataJSONObject: with the record type "{{ record_type }}" based on external fields from file [{{ product_requirement_file }}]({{ product_requirement_file }}), while preserving any existing record types.
- The structure of The External Domain Metadata JSON object is specified by the JSON schema defined in the resource [external_domain_metadata_schema.json](external_domain_metadata_schema.json).
3
+
- The structure of :ExternalDomainMetadataJSONObject: is specified by the JSON schema defined in the resource [external_domain_metadata_schema.json](external_domain_metadata_schema.json).
4
4
- Please note that all refers_to keys in reference and typed_reference fields must use the format "#record:<record_type_key>", where <record_type_key> matches a key in the top-level record_types. This ensures references are unambiguous and valid. Use {} as the value to refer by default identifier (id), or specify { "by_field": "field_name" } to use a custom key.
5
5
6
6
- A “display name” is the human-readable label of a field within a given record type.
7
7
8
8
***Non-Functional Requirements:***
9
9
10
-
- Store The External Domain Metadata JSON object as a separate JSON file.
10
+
- Store :ExternalDomainMetadataJSONObject: as a separate JSON file.
11
11
12
-
- The External Domain Metadata JSON object *MUST* be imported without "as" statement in The Implementation Code.
12
+
- :ExternalDomainMetadataJSONObject: *MUST* be imported without "as" statement in :Implementation:.
13
13
14
-
- {% include "templates/should_not_modify_extraction_function.plain" %}
14
+
- The :UnitTests: *MUST NOT* test the contents and *MUST NOT* teset the of :ExternalDomainMetadataJSONObject:.
15
15
16
16
***Test Requirements:***
17
17
18
-
- Validate generated The External Domain Metadata JSON object with the chef-cli tool (The Chef CLI) using the command "chef-cli validate-metadata":
18
+
- Validate generated :ExternalDomainMetadataJSONObject: with :ChefCLI: using the command "${CHEF_CLI_PATH} validate-metadata":
19
19
- This command reads JSON object from stdin.
20
-
- The path to The Chef CLI executable is provided in the environment variables `CHEF_CLI_PATH`.
21
-
- For the validation of The External Domain Metadata JSON object to be successful The Chef CLI must return an empty output.
22
-
- The test should always fail if The Chef CLI is not available.
20
+
- The path to :ChefCLI: executable is provided in the environment variables `CHEF_CLI_PATH`.
21
+
- For the validation of :ExternalDomainMetadataJSONObject: to be successful :ChefCLI: must return an empty output.
22
+
- The test should always fail if :ChefCLI: is not available.
23
23
24
-
- The External Domain Metadata JSON object should always be read from The Implementation Code.
24
+
- :ExternalDomainMetadataJSONObject: *MUST* be validated solely against :ChefCLI:.
25
+
- You *MUST NOT* validate :ExternalDomainMetadataJSONObject: against the literal JSON contents of :ExternalDomainMetadataJSONObject:.
26
+
- :ConformanceTests: should have *ONLY TWO* tests
27
+
- That :Function: returning :ExternalDomainMetadataJSONObject: can be invoked successfully
28
+
- :ChefCLI: validation using the command "${CHEF_CLI_PATH} validate-metadata"
25
29
26
-
- If The Conformance Tests test The External Domain Metadata JSON object, test it only against The Chef CLI. Don't test it against the literal JSON contents of The External Domain Metadata JSON object.
30
+
- :ExternalDomainMetadataJSONObject: should always be read from :Implementation: (and not recreated in :ConformanceTests:)
27
31
28
-
- The stdout and stderr of The Chef CLI *must* be printed to the console.
32
+
- The stdout and stderr of :ChefCLI: *must* be printed to the console.
29
33
30
-
- The Conformance Tests should not modify nor do any transformations on The External Domain Metadata JSON object at all. If The Conformance Tests indicates a problem with The External Domain Metadata JSON object, The External Domain Metadata JSON object in The Implementation Code should be adjusted to fix the problem. The tests should only validate the JSON object in its original form.
34
+
- :ConformanceTests: should not modify nor do any transformations on :ExternalDomainMetadataJSONObject: at all.
35
+
- If :ConformanceTests: indicates a problem with :ExternalDomainMetadataJSONObject:, :ExternalDomainMetadataJSONObject: in :Implementation: should be adjusted to fix the problem.
36
+
- :ConformanceTests: should only validate the JSON object in its original form.
0 commit comments