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

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

fnoks's picture

Hi,

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

 

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's picture

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.