How to write the web unit test case for presentation and video interactions for drupal?

Submitted by maheswarim on Fri, 07/14/2017 - 14:03

How to write the web unit test case for presentation and video interactions for drupal?

fnoks

Mon, 07/24/2017 - 11:03

Permalink

Hi,I have never heard the

Hi,

I have never heard the term "web unit test case" before - could you please elaborate?

maheswarim

Mon, 07/24/2017 - 12:04

Permalink

I have used Drupal for my

I have used Drupal for my project , integrated h5p in my site. For drupal we need to write test case written by developer (White box testing). Using Simple test plugin.

https://www.drupal.org/docs/7/testing/simpletest-testing-tutorial-drupal-7

I dont know how to write the test case for creating interaction.

fnoks

Tue, 07/25/2017 - 10:11

Permalink

Hi,What you are trying to

Hi,

What you are trying to create is integration tests (not unit tests). I have limited knowledge of Drupal's simpletest, but there's a section in that documentation named Create specific test: Creating a node, which should be a good starting point.

For H5P, you would need to post at least the form fields with the following names:

  • json_content (the content of the H5P as JSON)
  • h5p_library (the name and version of the library, e.g.: "H5P.DragText 1.6")
  • h5p_type (value="create")

A tip is to use the browser's developer console to see what values are sent in the POST.