| 
Jala Test | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Object | +--jala.Test
   
Provides various methods for automated tests.
 This is essentially a port of JSUnit (http://www.edwardh.com/jsunit/)
 suitable for testing Helma applications.
 
Defined in Global/jala.Test.js
   
| Nested Class Summary | |
   <static class> | 
   jala.Test.Exception | 
   
   <static class> | 
   jala.Test.TestException | 
   
   <static class> | 
   jala.Test.ArgumentsException | 
   
   <static class> | 
   jala.Test.EvaluatorException | 
   
   <static class> | 
   jala.Test.TestResult | 
   
   <static class> | 
   jala.Test.TestFunctionResult | 
   
   <static class> | 
   jala.Test.HttpClient | 
   
   <static class> | 
   jala.Test.DatabaseMgr | 
   
   <static class> | 
   jala.Test.SmtpServer | 
   
| Field Summary | |
    Number | 
   functionsFailed
   Contains the number of test functions that failed  | 
   
    Number | 
   functionsPassed
   Contains the number of test functions that passed  | 
   
    Array | 
   results
   An Array containing the results of this Test instance.  | 
   
    Boolean | 
   testsFailed
   Contains the number of tests that failed  | 
   
    Number | 
   testsRun
   Contains the number of tests that were executed  | 
   
   <static>  <final> String | 
   FAILED
   Constant indicating "failed" status  | 
   
   <static>  <final> String | 
   PASSED
   Constant indicating "passed" status  | 
   
| Constructor Summary | |
      
	 
	    jala.Test 
	 
	 ()
      
      Constructs a new Test instance.  | 
|
| Method Summary | |
	 
	     void
	 
       | 
      
	 
	    
	       assertEqual(<Object> val1, <Object> val2)
	 
	 Checks if the values passed as arguments are equal.  | 
   
	 
	     void
	 
       | 
      
	 
	    
	       assertEqualFile(<Object> val, <String|helma.File> file)
	 
	 Checks if the value passed as argument equals the content of a file on disk.  | 
   
	 
	     void
	 
       | 
      
	 
	    
	       assertFalse(<Object> val)
	 
	 Checks if the value passed as argument is boolean false.  | 
   
	 
	     void
	 
       | 
      
	 
	    
	       assertMatch(<String> val, <RegExp> rxp)
	 
	 Checks if the regular expression matches the string.  | 
   
	 
	     void
	 
       | 
      
	 
	    
	       assertNaN(<Object> val)
	 
	 Checks if the value passed as argument is NaN.  | 
   
	 
	     void
	 
       | 
      
	 
	    
	       assertNotEqual(<Object> val1, <Object> val2)
	 
	 Checks if the values passed as arguments are not equal.  | 
   
	 
	     void
	 
       | 
      
	 
	    
	       assertNotNaN(<Object> val)
	 
	 Checks if the value passed as argument is not NaN.  | 
   
	 
	     void
	 
       | 
      
	 
	    
	       assertNotNull(<Object> val)
	 
	 Checks if the value passed as argument is not null.  | 
   
	 
	     void
	 
       | 
      
	 
	    
	       assertNotUndefined(<Object> val)
	 
	 Checks if the value passed as argument is not undefined.  | 
   
	 
	     void
	 
       | 
      
	 
	    
	       assertNull(<Object> val)
	 
	 Checks if the value passed as argument is null.  | 
   
	 
	     void
	 
       | 
      
	 
	    
	       assertStringContains(<String> val, <String> str)
	 
	 Checks if the value passed as argument contains the pattern specified.  | 
   
	 
	     void
	 
       | 
      
	 
	    
	       assertThrows(<Object> func, <Object> exception)
	 
	 Checks if the function passed as argument throws a defined exception.  | 
   
	 
	     void
	 
       | 
      
	 
	    
	       assertTrue(<Object> val)
	 
	 Checks if the value passed as argument is boolean true.  | 
   
	 
	     void
	 
       | 
      
	 
	    
	       assertUndefined(<Object> val)
	 
	 Checks if the value passed as argument is undefined.  | 
   
	 
	     String
	 
       | 
      
	 
	    
	       directory_macro()
	 
	 Returns the absolute path to the directory containing the tests  | 
   
	 
	     void
	 
       | 
      
	 
	    
	       execute(<String|Array> what)
	 
	 Main test execution function  | 
   
	 
	     void
	 
       | 
      
	 
	    
	       executeTest(<helma.File> testFile)
	 
	 Executes a single test file  | 
   
	 
	     Object
	 
       | 
      
	 
	    
	       executeTestFunction(<String> functionName, <helma.scripting.rhino.GlobalObject> scope)
	 
	 Executes a single test function  | 
   
	 
	     void
	 
       | 
      
	 
	    
	       list_macro()
	 
	 Renders the list of available tests  | 
   
	 
	     void
	 
       | 
      
	 
	    
	       renderResult(result)
	 
	 Renders the result of a single test  | 
   
	 
	     void
	 
       | 
      
	 
	    
	       renderResults()
	 
	 Renders the results of all tests done by this test instance to response.  | 
   
	 
	     void
	 
       | 
      
	 
	    
	       results_macro()
	 
	 Renders the test results  | 
   
	 
	    <static> Boolean
	 
       | 
      
	 
	    
	       argsContainComment(<Array> args, <Number> argsExpected)
	 
	 Returns true if the arguments array passed as argument contains an additional comment.  | 
   
	 
	    <static> Boolean
	 
       | 
      
	 
	    
	       evalArguments(<Object> args, argsExpected)
	 
	  | 
   
	 
	    <static> String
	 
       | 
      
	 
	    
	       getComment(<Array> args, argsExpected)
	 
	 Cuts out the comment from the arguments array passed as argument and returns it.  | 
   
	 
	    <static> String
	 
       | 
      
	 
	    
	       getStackTrace(<java.lang.StackTraceElement> trace)
	 
	 Creates a stack trace and parses it for display.  | 
   
	 
	    <static> helma.File
	 
       | 
      
	 
	    
	       getTestFile(<String> fileName)
	 
	 Returns the testfile with the given name  | 
   
	 
	    <static> Array
	 
       | 
      
	 
	    
	       getTestFiles()
	 
	 Returns an array containing the test files located in the directory.  | 
   
	 
	    <static> helma.File
	 
       | 
      
	 
	    
	       getTestsDirectory()
	 
	 Returns the directory containing the test files.  | 
   
	 
	    <static> Object
	 
       | 
      
	 
	    
	       getValue(<Array> args, argsExpected, <Number> idx)
	 
	 Returns the argument on the index position in the array passed as arguments.  | 
   
	 
	    <static> void
	 
       | 
      
	 
	    
	       include(<Object> scope, file)
	 
	 Evaluates a javascript file in the global test scope.  | 
   
	 
	    <static> String
	 
       | 
      
	 
	    
	       valueToString(val)
	 
	 Helper method useable for displaying a value  | 
   
| Field Detail | 
Number functionsFailed
Number functionsPassed
Array results
Boolean testsFailed
Number testsRun
<static> <final> String FAILED
<static> <final> String PASSED
| Constructor Detail | 
jala.Test()
capacity -  The capacity of the cache  
     | Method Detail | 
void assertEqual(<Object> val1, <Object> val2)
val1 -  The value that should be compared to the second argument.  
      val2 -  The value that should be compared to the first argument.  
      void assertEqualFile(<Object> val, <String|helma.File> file)
val -  The value that should be compared with the content of  the file on disk.  
      file -  Either a file name (including a path), or  an instance of helma.File representing the file to use for comparison.  
      void assertFalse(<Object> val)
val -  The value that should be boolean false.  
      void assertMatch(<String> val, <RegExp> rxp)
val -  The string that should contain the regular expression pattern  
      rxp -  The regular expression that should match the value  
      void assertNaN(<Object> val)
val -  The value that should be NaN.  
      void assertNotEqual(<Object> val1, <Object> val2)
val1 -  The value that should be compared to the second argument.  
      val2 -  The value that should be compared to the first argument.  
      void assertNotNaN(<Object> val)
val -  The value that should be not NaN.  
      void assertNotNull(<Object> val)
val -  The value that should be not null.  
      void assertNotUndefined(<Object> val)
val -  The value that should be not undefined.  
      void assertNull(<Object> val)
val -  The value that should be null.  
      void assertStringContains(<String> val, <String> str)
val -  The string that should contain the pattern  
      str -  The string that should be contained  
      void assertThrows(<Object> func, <Object> exception)
func -  The function to call  
      exception -  Optional object expected to be thrown when executing  the function  
      void assertTrue(<Object> val)
val -  The value that should be boolean true.  
      void assertUndefined(<Object> val)
val -  The value that should be undefined.  
      String directory_macro()
void execute(<String|Array> what)
what -  Either the name of a single test file  or an array containing the names of several function files that should  be executed.    
      void executeTest(<helma.File> testFile)
testFile -  The file containing the test to run    
      Object executeTestFunction(<String> functionName, <helma.scripting.rhino.GlobalObject> scope)
functionName -  The name of the test function to execute  
      scope -  The scope to execute  the test method in
      void list_macro()
void renderResult(result)
The -  result to render    
      void renderResults()
void results_macro()
<static> Boolean argsContainComment(<Array> args, <Number> argsExpected)
args -  The arguments array to check for an existing comment.  
      argsExpected -  The number of arguments expected by the  assertion function.  
      <static> Boolean evalArguments(<Object> args, argsExpected)
args -  The arguments array.  
      nr -  The number of arguments to be expected  
      <static> String getComment(<Array> args, argsExpected)
args -  The arguments array.  
      <static> String getStackTrace(<java.lang.StackTraceElement> trace)
trace -  The trace to parse. If not given  a stacktrace will be generated  
      <static> helma.File getTestFile(<String> fileName)
fileName -  The name of the test file  
      <static> Array getTestFiles()
<static> helma.File getTestsDirectory()
<static> Object getValue(<Array> args, argsExpected, <Number> idx)
args -  The arguments to retrieve the non-comment  value from.  
      idx -  The index position on which the value to  retrieve is to be expected if no comment is existing.  
      <static> void include(<Object> scope, file)
scope -  The scope in which the file should be evaluated  
      fileName -  The name of the file to include, including the path    
      <static> String valueToString(val)
The -  value to render  
      
  | 
Jala Test | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||