gsmainclusivetechlab / interop-test-platform

MIT License
6 stars 1 forks source link

Test cases are allowed with components that are not defined in the yaml file #553

Closed cesdias closed 3 years ago

cesdias commented 3 years ago

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

  1. 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
  2. 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
  3. 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.

Actual outcome

The test-case-2.yml file is imported successfuly.