test.validate
custom test function arguments changed to(content, response, request, context)
. This simplifies the process to access response content, instead of needing to referenceresponse.result
. This also exposes request chaincontext
that includescontext.history
for accessing parent results.test.validate
can no longer returntrue
/false
. Usethrow new Error(message)
to fail the test instead. This is for clarity, a thrown error will propagate an error message whiletrue
/false
cannot.- Refactor
history
objects to simplify lookup and preserve more request values (url, payload, ect). Does not affect external functionality, but any custom functions that rely on manual history manipulation may need to change. Utillookup
functions continue to work as expected. - Rename
history
tocontext
in function callbacks and internal code, as the history array is actually incontext.history
and the context object contains other fields now. This won't affect most test cases, but any custom callbacks depending on the internal structure of history objects will need to be updated. Thecontext
structure should be considered stable at this point.
- The main
cheesefist()
method now returns a promise or accepts an optional callback. The promise/callback resolve based on the results of the full test run, if any test fails error state is the first thrownError
. The promise/callback can be safely ignored. - An optional
options
argument can be passed into the maincheesefist()
method as the 4th argument. The currently supported options are defined in Global Options. - With the above changes, the full method signature is:
cheesefist(server, testSuite, testFramework, options, callback)
.options
andcallback
are optional. Includingcallback
disables promise functionality. - The
options
object can have additional test plugins defined. See Validation Plugins. - Fields in
payload
andoverride
can be generated by using a generate functionfunction(fieldName, context, request)
for the field value. The function will execute at runtime, the return value will replace the function. Util functions for history lookup are provided inutil/lookup
. The fullpayload
can be generated as well. - The
options
object can have atest
object with validation rules, they enable global testing for each rule. Validations defined inrequest.test
override global values.request.test = false
will still disable all tests on that request andoptions.test = false
will disable all default validations. See Global Validation.