Hop.TestTask Class
Used to impelement the .do interface for defineTest
so .do("MyClass.myFunc") is implemented by this class
Constructor
Hop.TestTask
-
funcName
Parameters:
-
funcNameStringThe name of the function this test should call
Item Index
Methods
errorContains
-
value
Insure the error contains a specific string
This will also test to insure the output is null
Parameters:
-
valueStringThe string to insure the error contains
inputSameAsOutput
()
chainable
Require that the input object is contained within the output object
This will test to insure that the output object minially contains all the same parameters as the input object
noError
()
chainable
Require that the function does not return an error
This will not test the result in anyway, since having both a null error and null result is acceptable
outputArrayContains
()
chainable
Test the output array contains
outputContains
-
value
Test to insure that the output contains a specific object
This test will insure that the output is a superset of the specified object
Parameters:
-
valueObjectThe object to compare the output to
outputHasProperty
-
property
Insure that the output has a specified property
This will test for existence of a specific property
Parameters:
-
propertyStringThe name of the property
outputIsArray
()
chainable
Test the output to make sure it is an array
outputIsArrayWithLength
-
length
Test the output to make sure it an array with a specified length
Parameters:
-
lengthStringThe length of the array
outputIsNull
()
chainable
Test to insure the output is null
outputNotNull
()
chainable
Test to insure the output is not null
This test will also insure that the error is null
outputPropertyChanged
-
value
Require that the specified property has been changed from what was in the input
This test will also insure that the error is null and that the result is not null
Parameters:
-
valueStringThe name of the property in the output
outputSameAs
-
savedValue
Test the output to make sure it is the same as the specified object or saved object
Parameters:
-
savedValueStringThe name of the saved result
Example:
Test.do("User.save").with(user).outputSameAs({ name:'foo', email:'bar@bar.com'});
Test.do("User.save").with(user).outputSameAs("#{savedUser}");
Test.do("User.save").with(user).outputSameAs("#{savedUsers[1]}");
saveOutputAs
-
name
Save the output into a name variable for usage later
Parameters:
-
nameStringThe name of the value to save
with
-
inputValue -
extend
Defines the input to be used for the API call
This may either be a JavaScript Object or a named value (as created by .saveOutputAs)
Parameters:
-
inputValueMixedThe input value to use. Can be an object or string
-
extendObjectThe object to extend the input value with. Can be an object or string
Example:
test.do("Object.method").with({a:1, b:2});
test.do("Object.method").with("savedValue");
test.do("Object.method").with("savedValue",{a: 6} );
