Jala Test

Class jala.Test

Object
   |
   +--jala.Test

class 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

functionsFailed

Number functionsFailed

functionsPassed

Number functionsPassed

results

Array results

testsFailed

Boolean testsFailed

testsRun

Number testsRun

FAILED

<static> <final> String FAILED

PASSED

<static> <final> String PASSED

Constructor Detail

jala.Test

jala.Test()

Method Detail

assertEqual

void assertEqual(<Object> val1, <Object> val2)

assertEqualFile

void assertEqualFile(<Object> val, <String|helma.File> file)

assertFalse

void assertFalse(<Object> val)

assertMatch

void assertMatch(<String> val, <RegExp> rxp)

assertNaN

void assertNaN(<Object> val)

assertNotEqual

void assertNotEqual(<Object> val1, <Object> val2)

assertNotNaN

void assertNotNaN(<Object> val)

assertNotNull

void assertNotNull(<Object> val)

assertNotUndefined

void assertNotUndefined(<Object> val)

assertNull

void assertNull(<Object> val)

assertStringContains

void assertStringContains(<String> val, <String> str)

assertThrows

void assertThrows(<Object> func, <Object> exception)

assertTrue

void assertTrue(<Object> val)

assertUndefined

void assertUndefined(<Object> val)

directory_macro

String directory_macro()

execute

void execute(<String|Array> what)

executeTest

void executeTest(<helma.File> testFile)

executeTestFunction

Object executeTestFunction(<String> functionName, <helma.scripting.rhino.GlobalObject> scope)

list_macro

void list_macro()

renderResult

void renderResult(result)

renderResults

void renderResults()

results_macro

void results_macro()

argsContainComment

<static> Boolean argsContainComment(<Array> args, <Number> argsExpected)

evalArguments

<static> Boolean evalArguments(<Object> args, argsExpected)

getComment

<static> String getComment(<Array> args, argsExpected)

getStackTrace

<static> String getStackTrace(<java.lang.StackTraceElement> trace)

getTestFile

<static> helma.File getTestFile(<String> fileName)

getTestFiles

<static> Array getTestFiles()

getTestsDirectory

<static> helma.File getTestsDirectory()

getValue

<static> Object getValue(<Array> args, argsExpected, <Number> idx)

include

<static> void include(<Object> scope, file)

valueToString

<static> String valueToString(val)

Jala Test

Documentation generated by JSDoc on Tue Jan 8 15:50:17 2008