Introducing Kaltura’s Server Test Infrastructure

by Roni Cohen

In the up coming Kaltura server version, “Eagle” (CE5), we have developed the new, exciting Kaltura Server Testing Infrastructure. The new infrastructure utilizes PHPUnit (http://www.phpunit.de/manual/current/en/) to help you write, run and maintain tests easily.

 

PHPUnit command line test runner result

 

The infrastructure provides the following key features:

Key Features:

  • Separation between the test logic, test data and test configuration – Adding, updating or deleting test cases is done by simply editing the data file – no logic changes.
  • Global data file – This enables you to define data once that is then shared between all tests such as Kaltura Partner ID, all test configurations are set when the tests are deployed.
  • Base assert functions for Kaltura API and server objects.
  • Detailed failure report on what fields, objects and tests were not valid. Example can be found here: http://blog.kaltura.org/?p=883
  • Automated generation of mock objects – the test data generator will create mock objects for your tests from a given server (database) and the objects ids.
  • One of the most exciting features is: automated correction of data files based on the failure report– after running a test, a new data file is generated and all failed fields are set with new updated values. All you have to do is go over the failure report and see if they are valid failures you want to override, if not, go, FIX your CODE and use the old data file again.
  • Automated API tests generator – adaptively create tests for every action and service, including plugins for the tested server.
    For example – if you have a new plugin you can create tests for it automatically.
  • You can still use all of PHPUnit’s capabilities.

And those are just the key features. There are plenty more features such as opening a client for API tests and easy deployment on any server.

 

Example of test data file

 

 

Current use of the testing infrastructure

At Kaltura we use this infrastructure to enhance our server stabilization in multiple ways:

  1. Full regression tests
  2. Nightly test of the latest API code
  3. Nightly test of the latest installation package
  4. Nightly running of the server’s unit tests

Tune in for our next posts were we’ll share how to install, use and deploy the infrastructure.
Let us known the comments if you are interested in more use cases or have ideas about extending this infrastructure.
Contact us if you think this infrastructure can help you on your installation or general use of the Kaltura server.

Happy Testing :)