LSL Test Harness

From Second Life Wiki
Revision as of 10:29, 26 September 2007 by Tillie Ariantho (Talk | contribs)

Jump to: navigation, search

The LSL Test Harness is a platform for testing LSL scripts developed for Linden Lab by i3Dnow. Second Life developers may want to use this to confirm that their scripts function consistently from update to update. The test harness is freely available (under Creative Commons license: Attribution-ShareAlike 2.5) to download and use.

The LSL Test Harness consists of three or more inworld objects. You can create any object, even use the default plywood cube prim, just insure that you place the appropriate scripts and notecards in the proper objects.

The Controller

The controller provides the interface for you to issue instructions to the test harness. It will listen to your commands on a chat channel and execute them. Alternatively you can make a touch-based controller.

  • Rez or create an object, name it Controller.
  • Add the script Controller_Controller (available to copy/paste here).

The Coordinator

The coordinator handles the communication between the controller and the actual test units themselves.

The Test Unit(s)

The Test Units actually conduct the LSL tests. Therefore they consist of a generic script for running tests, plus the specific script (which you write) which holds the testing code. You may create as many test units as you need. To faciliate development of test scripts, several examples are included in the code repository (here) and these may be used as templates.

  • Rez or create an object and call it something descriptive (e.g. Test Unit - Rotations).
  • Add the script TestUnit_TestHarness
  • Add the notecard TestUnit_nc
    • Open the notcard and edit the UnitName and GroupName fields
      • UnitName is the name you want for this particular test
      • GroupName specifies a family of tests, in case you want to do something like run all your math testing test units (you'd define a groupName "Math").
  • Add your test script which should be called [GroupName]_[UnitName]
    • Best way to do this is to pick one of our example test scripts and edit it.
    • Define your global variable(s) for each individual pass/fail function in your unit
    • Replace the existing RunTest() method with your own code. It should execute your test and set the global variable pass/fail depending on the outcome.
    • Edit the Report() method to output the results of the test


Once you have the Controller, Coordinator, and all your Test Units rezzed, ensure that they are within chat distance of each other, and then you can issue the following commands in the toALL channel (defined as <insert default>)

  • ActivateRegistration will make the coordinator round up all test units in chat range
  • ActivateTest will start all selected test units
  • ActivateReport will generate your specified report (chat, email, http)
  • Reset will reset all test units
  • SetTestSelected will specify which test units should execute
    • SetTestSelected::All all test units in range
    • SetTestSelected::[GroupName] all units in that group
    • SetTestSelected::[UnitName] a specific unit
  • SetReportMethod you can choose from three report methods
    • SetReportMethod::CHAT::channel::0 for open chat
  • SetReportType - specify report type as NORMAL, QUITE, VERBOSE, STATS
    • SetReportType::NORMAL
  • SetControlChannel used to change the internal comm channel
  • SetBroadcastChannel chat channel for report output (typically 0)

This is the repository for the LSL test harness - update this wiki as you update the harness!

Test Harness Control Buttons

Test Harness Controller

Test Harness Test Units

Test Harness PHP