It is possible to use a component in a test case that is not defined in the components section of the yaml file. This happens because the components used in the source and target of the test_steps section are validated against components that are already created in the database by other test cases.
Steps to reproduce
In the interop test platform, import test-case-1.yml below. This test case has two components: Service Provider (slug: sp) and Mobile Money Provider (slug: mmp). The test-case-1.yml file should be imported without errors.
name: Test Case 1
slug: test-case-1
use_case: Demo
behavior: positive
description: This test case is for testing a bug in validation
precondition: Test case described in https://developer.mobilemoneyapi.io/content/check-service-availability-4
components:
- name: Service Provider
slug: sp
- name: Mobile Money Provider
slug: mmp
test_steps:
- path: '/heartbeat'
pattern: '^heartbeat$'
method: GET
source: sp
target: mmp
api_spec: 'MM v1.1.2'
request:
method: GET
uri: '/heartbeat'
headers:
X-Date: '{{ new_date_iso8601() }}'
content-type: application/json
body: empty_body
response:
status: 200
Now import test-case-2.yml. This test case is missing Mobile Money Provider (slug: mmp) in its yaml definition but the test-case-2.yaml is still imported without errors.
name: Test Case 2
slug: test-case-2
use_case: Demo
behavior: positive
description: This test case is for testing a bug in validation
precondition: Test case described in https://developer.mobilemoneyapi.io/content/check-service-availability-4
components:
- name: Service Provider
slug: sp
test_steps:
- path: '/heartbeat'
pattern: '^heartbeat$'
method: GET
source: sp
target: mmp
api_spec: 'MM v1.1.2'
request:
method: GET
uri: '/heartbeat'
headers:
X-Date: '{{ new_date_iso8601() }}'
content-type: application/json
body: empty_body
response:
status: 200
There is no validation for a component that is used in the test case definition but are not defined in the components section. In this case, the validation allows to pass because the component was created in the ITP database by test-case-1.yml previously imported.
Expected outcome
For test-case-2.yml, the ITP interface should report an error like that:
form-file.inputs.errors.file
Test Case validation failed. Please resolve errors listed below:
Test step 1:
The target component does not exist.
It is possible to use a component in a test case that is not defined in the
components
section of the yaml file. This happens because thecomponents
used in thesource
andtarget
of thetest_steps
section are validated againstcomponents
that are already created in the database by other test cases.Steps to reproduce
test-case-1.yml
below. This test case has twocomponents
:Service Provider
(slug:sp
) andMobile Money Provider
(slug:mmp
). Thetest-case-1.yml
file should be imported without errors.test-case-2.yml
. This test case is missingMobile Money Provider
(slug:mmp
) in its yaml definition but thetest-case-2.yaml
is still imported without errors.components
section. In this case, the validation allows to pass because the component was created in the ITP database bytest-case-1.yml
previously imported.Expected outcome
For
test-case-2.yml
, the ITP interface should report an error like that:Actual outcome
The
test-case-2.yml
file is imported successfuly.