Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submission of test cases (Gherkin feature files) #63

Closed
trehman-gsma opened this issue Oct 19, 2023 · 7 comments · Fixed by #70
Closed

Submission of test cases (Gherkin feature files) #63

trehman-gsma opened this issue Oct 19, 2023 · 7 comments · Fixed by #70

Comments

@trehman-gsma
Copy link
Collaborator

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
Copy link
Collaborator

  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
Copy link
Collaborator

hdamker commented Oct 20, 2023

@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 (camaraproject/Template_API_Repository#1)

@trehman-gsma
Copy link
Collaborator Author

  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
Copy link
Collaborator

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

@trehman-gsma
Copy link
Collaborator Author

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

@DT-DawidWroblewski
Copy link
Collaborator

Awaiting resolution of #94

@trehman-gsma
Copy link
Collaborator Author

Closing this issue as PR #70 has submitted a series of test cases that comply with the latest CAMARA test guidelines

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants