Namespace: CoreTest

CoreTest is the unit testing library for SproutCore. It includes a test runner based on QUnit with some useful extensions for testing SproutCore- based applications.

You can use CoreTest just like you would use QUnit in your tests directory.

Defined in: core.js

Field Summary

Class Methods

Field Detail

CoreTest.equiv

Tests for equality any JavaScript type and structure without unexpected results.

Discussions and reference: http://philrathe.com/articles/equiv Test suites: http://philrathe.com/tests/equiv Author: Philippe Rathé prathe@gmail.com


Defined in: equiv.js.
CoreTest.ERROR
Test raised exception
CoreTest.FAIL
Test failed
CoreTest.OK
Test is OK
CoreTest.Runner

Defined in: runner.js.
Since:
SproutCore 1.0
CoreTest.WARN
Test raised warning

Class Method Detail

argumentsArray(args)
Parameters:
args
beget(obj)
Copied from SproutCore Runtime Core. Included here to avoid dependencies.
Parameters:
obj
{Object} the object to beget
Returns:
Object
the new object.
defaultPlan()

Defined in: plan.js.
dump(obj, type)

Defined in: dump.js.
Parameters:
obj
type
fmt(str)
Borrowed from SproutCore Runtime Core
Parameters:
str
K()
Empty function. Useful for some operations.
mixin(target, properties)
Copied from SproutCore Runtime Core. Included here to avoid dependencies.
Parameters:
target
{Object} the target object to extend
properties
{Object} one or more objects with properties to copy.
Returns:
Object
the target object.
Spy()
spyOn(object, method)
Parameters:
object
method
Stub()
stub(name, func)

Returns a stub function that records any passed arguments and a call count. You can pass no parameters, a single function or a hash.

If you pass no parameters, then this simply returns a function that does nothing but record being called.

If you pass a function, then the function will execute when the method is called, allowing you to stub in some fake behavior.

If you pass a hash, you can supply any properties you want attached to the stub function. The two most useful are "action", which is the function that will execute when the stub runs (as if you just passed a function), and "expect" which should evaluate the stub results.

In your unit test you can verify the stub by calling stub.expect(X), where X is the number of times you expect the function to be called. If you implement your own test function, you can actually pass whatever you want.

Calling stub.reset() will reset the record on the stub for further testing.

Parameters:
name String
the name of the stub to use for logging
func Function|Hash
the function or hash
Returns:
Function
stub function
stubMethod(object, method)
Parameters:
object
method
Documentation generated by JsDoc Toolkit 2.4.0 on Wed Apr 08 2015 10:02:20 GMT-0600 (CST)