Difference between revisions of "LSL Test Harness"

From Second Life Wiki
Jump to navigation Jump to search
(16 intermediate revisions by 7 users not shown)
Line 1: Line 1:
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: [http://creativecommons.org/licenses/by-sa/2.5/ Attribution-ShareAlike 2.5]) to download and use.  
{{Multi-lang}}{{LSL Header}}{{LSLC|}}
The LSL Test Harness is a platform for testing LSL scripts developed for Linden Lab by [http://www.i3dnow.com i3D Inc.]. 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: [http://creativecommons.org/licenses/by-sa/2.5/ 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 LSL Test Harness consists of three or more inworld objects. You can create any object, even use the default plywood cube prim, just ensure that you place the appropriate scripts and notecards in the proper objects.  


= The Controller =
= The Controller =
Line 13: Line 14:


* Rez or create an object, name it Coordinator
* Rez or create an object, name it Coordinator
* Add the following scripts: (available <here>)
* Add the following scripts: (available to copy/paste at the linked locations)
** Coordinator.Coordinator
** [[Coordinator_Coordinator.lsl | Coordinator.Coordinator]]
** Coordinator_TestUnits
** [[Coordinator_TestUnits.lsl | Coordinator_TestUnits]]
** Coordinator_TestUnitsReports
** [[Coordinator_TestUnitsReports.lsl | Coordinator_TestUnitsReports]]
* Now add the notecard Coordinator_nc (here) and open it
* Now add the notecard [[Coordinator_nc | Coordinator_nc]] and open it
** If you wish to have the harness send you reports via email, add your email address to the email field
** If you wish to have the harness send you reports via email, add your email address to the email field
** If you want the harness to http post the reports, add your url to the Http: field
** If you want the harness to http post the reports, add your url to the Http: field


= The Test Unit(s) =
= 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.  
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 facilitate 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).
* Rez or create an object and call it something descriptive (e.g. Test Unit - Rotations).
* Add the script TestUnit_TestHarness
* Add the script [[TestUnit_TestHarness.lsl | TestUnit_TestHarness]]
* Add the notecard TestUnit_nc
** Here's how: [[TestUnit_Integration | TestUnit_Integration]]
** Open the notcard and edit the UnitName and GroupName fields
* Add the notecard [[TestUnit_nc | TestUnit_nc]]
** Open the notecard and edit the UnitName and GroupName fields
*** UnitName is the name you want for this particular test
*** 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").
*** 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]
* 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.
** You can use [[TestUnit_TestScript.lsl | TestUnit_TestScript.lsl]] as a template
** Define your global variable(s) for each individual pass/fail function in your unit
** Just add your test lsl to the indicated section and report the result
** 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.
* Alternatively, there are some sample test scripts at [[Test_Harness_Test_Units | Test Harness Sample Tests]]
** Edit the Report() method to output the results of the test


= Commands =
= Commands =
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>)
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 control channel (default is 1234)


* '''ActivateRegistration''' will make the coordinator round up all test units in chat range
* '''ActivateRegistration''' will make the coordinator round up all test units in chat range
Line 56: Line 57:
* '''SetBroadcastChannel''' chat channel for report output (typically 0)
* '''SetBroadcastChannel''' chat channel for report output (typically 0)


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


[[Test Harness Control Buttons]]
[[Test Harness Control Buttons]]
Line 66: Line 68:
[[Test Harness PHP]]
[[Test Harness PHP]]


[[Misc]]
= Tests =
All known tests should be in [[:Category:Conformance Test]].
 
[[Category:Automated Testing]]
[[Category:QA]]

Revision as of 20:31, 31 March 2010

The LSL Test Harness is a platform for testing LSL scripts developed for Linden Lab by i3D Inc.. 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 ensure 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 facilitate 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 notecard 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]
  • Alternatively, there are some sample test scripts at Test Harness Sample Tests

Commands

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 control channel (default is 1234)

  • 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
    • SetReportMethod::EMAIL::address::you@yourdomain.com
    • SetReportMethod::HTTP::url::www.yoururl.com
  • 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)

Repository for the LSL test harness

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

Tests

All known tests should be in Category:Conformance Test.