Difference between revisions of "Testing"

From LIBISIS
Jump to navigation Jump to search
m
Line 48: Line 48:
 
     toby_interp(w1)
 
     toby_interp(w1)
 
   end
 
   end
 +
 +
The scripts are split into sections by cells (i.e. using %% in comments) in an attempt to make the script easier to read. It is better to add new tests to the bottom of these cells so that old tests are not interrupted. At the very end of the script the data is cleared, insure any new tests are done before this.
 +
 +
Also, take note of the objects that are created and use them. Use debug mode within the script to make it easier to assertain which variables will be available at any part of the test. There are files located in the test directory for use. If new files are required, place them into the test directory.

Revision as of 14:35, 5 August 2008

Tests are contained in

 C:\libisis\tests\matlab_tests

Libisis_test

libisis_test is a function designed to test the basics of Libisis and check that there are no critical errors it does NOT check that outputs are exactly as expected, only that they are valid (for instance, if an algorithm is mis-binning data then it will not generally be picked up). If making large changes to Libisis, this function should be used as a first check that the changes do not 'break' Libisis. The test takes around 5 minutes.

This test can be run with several different options from the Matlab command line. Several options may be given at the same time using the syntax.


 >> libisis_test(option1, option2, option3, ...)

Option Description
'lite' data is rebinned so that datasets are smaller, fewer plots are made. The test performs quicker and on slower machines but is less rigorous.
'full' currently the same as running without any options
'extra only' runs the series of 'extra' tests only. These are tests that have been added recently, so a full test is not performed but new functions are tested.
'detailed' The test will stop at regular intervals so that variables and plots can be inspected.
'continuous' Some of the tests require user interaction, these will be skipped if continuous is used
'libisis only' only test the data manipulation part of libisis
'gtk only' only test the graphics package part of libisis


Adding New Tests

To add new tests, look at gtk_test_script.m and libisis_test_script.m. These two functions contain all of the tests. Note that a series of flags are set by the optional inputs, see these in the libisis_test.m file. Use the data from these in conditional statements. For instance, if the check requires user interaction, then use a statement like

 if ~continuous_flag
   toby_interp(w1)
 end

The scripts are split into sections by cells (i.e. using %% in comments) in an attempt to make the script easier to read. It is better to add new tests to the bottom of these cells so that old tests are not interrupted. At the very end of the script the data is cleared, insure any new tests are done before this.

Also, take note of the objects that are created and use them. Use debug mode within the script to make it easier to assertain which variables will be available at any part of the test. There are files located in the test directory for use. If new files are required, place them into the test directory.