camaraproject / SimSwap

Repository to describe, develop, document and test the Sim Swap API family
Apache License 2.0
21 stars 18 forks source link

Submission of test cases (Gherkin feature files) #63

Open trehman-gsma opened 8 months ago

trehman-gsma commented 8 months ago

Hi all,

As briefly discussed during the SimSwap meeting on 19/10/23 - I have a number of Gherkin test cases that I'm interested in submitting. Examples are below. Please can you take a look and advise if I should create a Pull Request?

The Commonalities API Readiness Checklist does not yet have a reference template for test cases (it is labelled as TBD) - however I have looked through other CAMARA repositories and noted Gherkin feature files from the following projects (click to be taken to the feature files):

The SimSwap test cases would follow a similar pattern to the above feature files. These are some examples:


Feature: Check if SIM Swap has been performed during a past period 

  @Test_Verify_Swap_True
  Scenario: Confirm that a SIM has been swapped
    Given a valid phone number "<phoneNumber>" whose SIM has been swapped in the last "<maxAge>" hours
    When a Check SimSwap request is made with a maxAge parameter of "<maxAge>"
    Then the response status code should be 200
    And the response body should confirm that a SIM swap has been performed 

    Examples:
      | phoneNumber   | maxAge |
      | +346661113334 | 24     |
      | +447748357814 | 48     |      

  @Test_Verify_Swap_True_Default_MaxAge
  Scenario: Confirm that a SIM has been swapped without specifying maxAge (should default to maxAge of 240)
    Given a valid phone number "<phoneNumber>" whose SIM has been swapped within the default max age value (240)
    When a Check SimSwap request is made without a maxAge parameter
    Then the response status code should be 200
    And the response body should confirm that a SIM swap has been performed 

  @Test_Verify_Swap_False
  Scenario: Confirm that a SIM has not been swapped
    Given a valid phone number "<phoneNumber>" whose SIM has been swapped in the last "<maxAge>" hours
    When a Check SimSwap request is made with a maxAge parameter of "<maxAge>" 
    Then the response status code should be 200
    And the response body should confirm that a SIM swap has not been performed 

    Examples:
      | phoneNumber   | maxAge |
      | +346661113334 | 24     |
      | +447748357814 | 48     |       

  @Test_Negative_MaxAge
  Scenario: Input an invalid maxAge value (less than 1)
    Given a valid phone number "<phoneNumber>" whose SIM has been swapped in the last "<maxAge>" hours
    When a Check SimSwap request is made with a maxAge parameter of "-1"
    Then the response status code should be 400
    And the response should contain an error message indicating an invalid argument

I have further test cases but have included the above as an example of the language and syntax. Appreciate your thoughts.

gregory1g commented 8 months ago

1.

  1. Reading this makes me thinking that 240 is a API level defined default value for maxAge. Afaik, this is not the case - so far, the discussed agreement default and upper limit for maxAge is implementation specific. Therefore, for the test case I would suggest to mention implementation specific value explicitly to avoid misinterpretation. Like: @Test_Verify_Swap_True_Default_MaxAge Scenario: Confirm that a SIM has been swapped without specifying maxAge (should default to maxAge of 240) Given a valid phone number "" whose SIM has been swapped some time ago When a Check SimSwap request is made without a maxAge parameter AND defaultMaxAge is configured to DEFAULT_MAX_AGE by the MNO AND SimSwap happened within DEFAULT_MAX_AGE .... Examples: | phoneNumber | DEFAULT_MAX_AGE | | +346661113334 | 240 | | +447748357814 | 160 |
hdamker commented 8 months ago

@trehman-gsma if the maintainers of the sub project (@DT-DawidWroblewski) are ok with a PR please use/create /code/Test_definitions directory for the feature file, as recently introduced into the sub project template (https://github.com/camaraproject/Template_Lead_Repository/pull/1)

trehman-gsma commented 8 months ago
  1. Reading this makes me thinking that 240 is a API level defined default value for maxAge. Afaik, this is not the case - so far, the discussed agreement default and upper limit for maxAge is implementation specific. Therefore, for the test case I would suggest to mention implementation specific value explicitly to avoid misinterpretation. Like: @Test_Verify_Swap_True_Default_MaxAge Scenario: Confirm that a SIM has been swapped without specifying maxAge (should default to maxAge of 240) Given a valid phone number "" whose SIM has been swapped some time ago When a Check SimSwap request is made without a maxAge parameter AND defaultMaxAge is configured to DEFAULT_MAX_AGE by the MNO AND SimSwap happened within DEFAULT_MAX_AGE .... Examples: | phoneNumber | DEFAULT_MAX_AGE | | +346661113334 | 240 | | +447748357814 | 160 |

Thanks @gregory1g. Yes, I can change this during the pull request once I get the approval to go ahead.

Though, I believe 240 is the current default value in the specification?

    CreateCheckSimSwap:
      type: object
      properties:
        phoneNumber:
          $ref: "#/components/schemas/PhoneNumber"
        maxAge:
          type: integer
          example: 240
          description: |
            Period in hours to be checked for SIM swap.
          format: int32
          minimum: 1
          maximum: 2400
          default: 240
gregory1g commented 8 months ago

@trehman-gsma , thanks for correction, you are right I confused it with another age related attribute in this respect.

trehman-gsma commented 8 months ago

Hi @DT-DawidWroblewski. As we discussed, I will create a PR for the test cases and they can be appropriately reviewed.

DT-DawidWroblewski commented 5 months ago

Awaiting resolution of #94