[Drupal] What are the test cases to be considered while testing Contact form in Drupal?

| | 2 min read

A contact form is included with websites mainly to allow users to communicate with the site administrator, share their feedback/messages regarding the website or reaching out to the business owner of the site for services/support. In this article, I have covered a set of test cases that can be used to test the Drupal site contact form.reach

In Drupal you can limit the number of submissions that can be accepted from an IP within an hour. Further submissions within that period will not be accepted by the system. See the attached contact form.

contact form example

These are the default fields found in a default Drupal contact form, along with the captcha. 

Following are its test cases/checklists:

Validation check

  1. Ensure an error message is displayed on submitting the form by leaving the mandatory fields empty. Expected error messages for the above example is:
    • "Your name field is required."
    • "Your e-mail address field is required."
    • "Subject field is required."
    • "Message field is required."
    • "Math question field is required."

 

 

Name field

  1. Ensure that the system accepts a valid name. For example, the name "@run", which, when given in the field, will be accepted. By default, text fields in Drupal take alphanumeric values. If the field is customized, then test accordingly.
  2. Ensure the system rejects the invalid name (input:*##456456@#).

E-mail field

  1. Ensure that the system accepts valid e-mail ids. For example, an id: [email protected] should be accepted.
  2. Ensure that the system rejects invalid e-mail ids. For example, inputs "tester@example", "tester.example@com" should not be accepted.

Subject field

  1. Ensure that the system accepts the valid subject. Usually, all alphanumeric entries will be accepted. If there are any other specifications like character limits etc., check that as well.

 

 

Message field

  1. Ensure that the system accepts valid messages. Usually, all alphanumeric entries will be accepted. If there is any other specifications like character limits etc, check that as well.

Captcha field

  1. Ensure that the system accepts a valid captcha.
  2. Ensure that the system rejects the invalid captcha.
  3. Ensure that the captcha code resets as the system reloads.
  4. Ensure that the captcha changes as the user enters the wrong value.

Submit button

  1. Ensure that the spelling and position of the button are correct.
  2. Ensure that the button is clickable.
  3. Ensure that on submitting a valid form, the value gets saved, and the administrator receives the same.
  4. Ensure that the administrator receives the contact form at the email address which has been configured. The administrator can set/edit email id on the Contact form by selecting the contact form from the administrator menu bar - Menu » Site Building » Contact form » List.

These test cases are not just for Drupal contact forms, but can be used with any web applications and forms. Happy testing :).

You can automate your test cases with a tool like Playwright, Cypress or Selenium to save time and improve the efficiency of your web application testing team.  If you need support, please let us know, and our test automation consultant can help you in the automation.