Difference between revisions of "Testing"

From LIBISIS
Jump to navigation Jump to search
m
 
(One intermediate revision by the same user not shown)
Line 39: Line 39:
 
| only test the graphics package part of libisis
 
| only test the graphics package part of libisis
 
|}
 
|}
 +
 +
 +
 +
===User Interaction Elements===
 +
 +
 +
There are some elements that require user interaction. For the dxy test a message will appear, click ok then press return for it to begin. You are required to click the plots, click 6 times on places with and without data then press return. Sometimes the number of clicks allowed will be less than 6 and the plot will automatically be renewed.
 +
 +
 +
Saving and loading files also requires user interaction. You will be asked for a filename. Locate the gtk_example.dat file in the test folder and use this. Plots made from these files are not necessarily interesting and may appear to be incorrect when they are not.
 +
 +
  
  
Line 48: Line 60:
 
     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.
 +
 +
 +
==Performing Individual Tests==
 +
 +
While the test scripts are setup to be a continuous test, one can open them and perform individual tests. Type
 +
 +
>> global lite_tag
 +
>> lite_tag = true
 +
 +
This will insure that any variables loaded are not too big. If on a powerful machine, don't bother doing this.
 +
 +
Now you can load a set of variables to use for testing into the matlab workspace by typing
 +
 +
>> gtk_load_data_script
 +
 +
Now there will be some dataset_1d and dataset_2d objects to test with, copy and past segments from the gtk_test_script or libisis_test_script.

Latest revision as of 09:59, 21 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


User Interaction Elements

There are some elements that require user interaction. For the dxy test a message will appear, click ok then press return for it to begin. You are required to click the plots, click 6 times on places with and without data then press return. Sometimes the number of clicks allowed will be less than 6 and the plot will automatically be renewed.


Saving and loading files also requires user interaction. You will be asked for a filename. Locate the gtk_example.dat file in the test folder and use this. Plots made from these files are not necessarily interesting and may appear to be incorrect when they are not.



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.


Performing Individual Tests

While the test scripts are setup to be a continuous test, one can open them and perform individual tests. Type

>> global lite_tag >> lite_tag = true

This will insure that any variables loaded are not too big. If on a powerful machine, don't bother doing this.

Now you can load a set of variables to use for testing into the matlab workspace by typing

>> gtk_load_data_script

Now there will be some dataset_1d and dataset_2d objects to test with, copy and past segments from the gtk_test_script or libisis_test_script.