Skip to content

Instantly share code, notes, and snippets.

@purrarri
Created August 2, 2023 13:35
Show Gist options
  • Select an option

  • Save purrarri/14adfa698fc795f53e348a424f786a6d to your computer and use it in GitHub Desktop.

Select an option

Save purrarri/14adfa698fc795f53e348a424f786a6d to your computer and use it in GitHub Desktop.
Paper.id-QA Assesment Solution
  Please describe :
  a. How to test this form (Picture 1)?

Solution : -> There are many way to perform test to the following form behavior as validate the response, the sent request, load/ performance, but since limitted by interactions with the following form so assume the way I can propose by validate the following existing field and focusing the testing on the optimal and reasonable paths. The thing I want to asses first is validate the existing field and type. So assume we have the following object model such as the following field :


    | Field         | Type           | Required |
    | Tipe Mitra    | Dropdown       | Yes      |
    | No. Mitra     | Text (Varchar) | Yes      |
    | Badan Usaha   | Dropdown       | No       |
    | Nama          | Text (Varchar) | Yes      |
    | Email         | Email          | No       |
    | No.Telepon    | Text (String)  | Yes      |
    | Lainnya       | Dropdown       | No       |

Then, as from there we can try to combine the possibility of each field behaviour. The way I to propose to validate the following combinantion is through the generation of test cases. Since the following form indicate the "Creation of new partner" so assume the following behaviour will be summarized as in BDD format using Gherkin/ Cucumber.

So, as the result the following test case will answered the 'How to test the form' :

Feature: Create New Partner Form


Scenario: Validate the behaviour of following field
  Given I am on the Partner Management page
  When I click on the "Create New Partner" button
  Then I should see the "Create New Partner" form with the following fields:
    | Field         | Type           | Required |
    | Tipe Mitra    | Dropdown       | Yes      |
    | No. Mitra     | Text (Varchar) | Yes      |
    | Badan Usaha   | Dropdown       | No       |
    | Nama          | Text (Varchar) | Yes      |
    | Email         | Email          | No       |
    | No.Telepon    | Text (String)  | Yes      |
    | Lainnya       | Dropdown       | No       |
  And Validate the following field <Tipe Mitra> will return the dropdown value
  And Validate the following field <Badan Usaha> will return the load the dropdown value
  And Validate the following field <Lainnya> will return the load the dropdown value
  And I should see the "Batal" button
  And I should see the "Simpan" button menu containing dropdown button options "Simpan dan Tambah Baru" and "Simpan dan Tutup"

Scenario: Create New Partner with All Required Fields
  Given I am on the "Create New Partner" form
  When I fill in the following information:
    | Field        | Value                   |
    | Tipe Mitra   | Business Partner        |
    | No. Mitra    | ABC123                  |
    | Nama         | John Doe                |
    | No.Telepon   | 1234567890              |
  And I click on the "Simpan" button
  Then I should see a success message "Partner created successfully"
  And I should be redirected to the Partner Management page
  And the newly created partner with the provided details should be listed on the page

Scenario: Create New Partner with Optional Fields
  Given I am on the "Create New Partner" form
  When I fill in the following information:
    | Field        | Value                   |
    | Tipe Mitra   | Customer                |
    | No. Mitra    | XYZ789                  |
    | Badan Usaha  | Private Limited Company |
    | Nama         | Jane Smith              |
    | Email        | jane@example.com        |
    | No.Telepon   | 9876543210              |
    | Lainnya      | Informasi Alamat        |
  And I click on the "Simpan dan Tambah Baru" button
  Then I should see a success message "Partner created successfully"
  And the form should be reset for creating another partner

Scenario: Attempt to Create New Partner with Missing Required Fields
  Given I am on the "Create New Partner" form
  When I click on the "Simpan dan Tutup" button without filling in any required fields
  Then I should see validation error messages for each required field
  And I should not be able to submit the form

Scenario: Attempt to Create New Partner with Invalid Email Format
  Given I am on the "Create New Partner" form
  When I fill in the following information with an invalid email format:
    | Field        | Value             |
    | Tipe Mitra   | Supplier          |
    | No. Mitra    | PQR456            |
    | Nama         | Mark Johnson      |
    | Email        | invalid_email.com |
    | No.Telepon   | 4567891230        |
  And I click on the "Simpan dan Tutup" button
  Then I should see a validation error message for the "Email" field
  And I should not be able to submit the form
  
  
Scenario: Create New Partner with Duplicate No. Mitra
  Given I am on the "Create New Partner" form
  And there is an existing partner with the No. Mitra "ABC123"
  When I fill in the following information:
    | Field        | Value                |
    | Tipe Mitra   | Business Partner     |
    | No. Mitra    | ABC123               | (Duplicate value)
    | Nama         | Mike Johnson         |
    | No.Telepon   | 9876543210           |
  And I click on the "Simpan dan Tutup" button
  Then I should see a validation error message for the "No. Mitra" field
  And I should not be able to submit the form

Scenario: Create New Partner with Additional Phone Number
  Given I am on the "Create New Partner" form
  When I fill in the following information:
    | Field        | Value                |
    | Tipe Mitra   | Supplier             |
    | No. Mitra    | XYZ789               |
    | Nama         | Anna Smith           |
    | No.Telepon   | 9876543210           |
    | Lainny       | No.Telepon           |
  And I click on the "Simpan dan Tutup" button
  Then I should see a success message "Partner created successfully"
  And the partner's details should include the additional phone number

Scenario: Create New Partner with Informasi Alamat
  Given I am on the "Create New Partner" form
  When I fill in the following information:
    | Field        | Value                |
    | Tipe Mitra   | Customer             |
    | No. Mitra    | PQR456               |
    | Nama         | Laura Johnson        |
    | No.Telepon   | 1234567890           |
    | Lainnya      | Informasi Alamat     |
  And I click on the "Simpan dan Tutup" button
  Then I should see a success message "Partner created successfully"
  And the partner's details should include the address information

Scenario: Create New Partner with Website and Note
  Given I am on the "Create New Partner" form
  When I fill in the following information:
    | Field        | Value                |
    | Tipe Mitra   | Supplier             |
    | No. Mitra    | MNO789               |
    | Nama         | Sarah Johnson        |
    | No.Telepon   | 7890123456           |
    | Lainny       | Website              |
    | Lainnya      | Note                 |
  And I click on the "Simpan dan Tutup" button
  Then I should see a success message "Partner created successfully"
  And the partner's details should include the website and note information

Scenario: Cancel Partner Creation
  Given I am on the "Create New Partner" form
  When I fill in the following information:
    | Field        | Value                |
    | Tipe Mitra   | Business Partner     |
    | No. Mitra    | DEF456               |
    | Nama         | Peter Johnson        |
    | No.Telepon   | 1112223333           |
  And I click on the "Batal" button
  Then I should be redirected to the Partner Management page
  And the new partner should not be listed on the page

Scenario: Create New Partner and Save as Draft
  Given I am on the "Create New Partner" form
  When I fill in the following information:
    | Field        | Value                |
    | Tipe Mitra   | Customer             |
    | No. Mitra    | GHI789               |
    | Nama         | Emily Smith          |
    | No.Telepon   | 4445556666           |
  And I click on the "Simpan" button and select "Simpan sebagai Draf"
  Then I should see a success message "Partner saved as draft"
  And the partner should not be listed on the Partner Management page until fully submitted

Scenario: Create New Partner with Long Input Values
  Given I am on the "Create New Partner" form
  When I fill in the following long information:
    | Field        | Value                                |
    | Tipe Mitra   | Supplier                             |
    | No. Mitra    | VVV0000000000000000000000000000000000 |
    | Nama         | Very Long Partner Name That Exceeds Maximum Length Limit |
    | No.Telepon   | 1234567890123456789012345678901234567 |
  And I click on the "Simpan dan Tutup" button
  Then I should see validation error messages for the fields with exceeded maximum length limit
  And I should not be able to submit the form
  
Scenario: Create New Partner with Valid Email
  Given I am on the "Create New Partner" form
  When I fill in the following information:
    | Field        | Value                 |
    | Tipe Mitra   | <enum-1>              |
    | No. Mitra    | <enum-12>             |
    | Nama         | David Johnson         |
    | Email        | david@mailinator.com  |
    | No.Telepon   | 9876543210            |
  And I click on the "Simpan dan Tutup" button
  Then I should see a success message "Partner created successfully"
  And the newly created partner should have the email "david@example.com"

To summarize, thats the approach that I like to implement to validate the following form behaviour. Aside from that, we can reuse the following test case to reuse as in Gherkin step in automation framework that support BDD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment