Liking cljdoc? Tell your friends :D

jux.test.script


scriptclj

(script description initial-state & script-values)

Takes a test script description, its initial state and a sequence of steps.

Each step is made of 3 or 4 values:

  • User
  • function to be called on the state
  • param (ommited if function does not take it)
  • Expected result

Executes the function in each step, checking for the expected result. If an exception is thrown, the expected result is compared to the exception message. The state returned by the function is passed on to the next step.

Returns the state after the last step. This is useful for starting new scripts using the state created in previous ones.

Example: (def initial-state {}) (def with-users (script "Users become active when they log in." inital-state :ann login nil :bob login nil :ann active-users [:ann :bob])) (script "Users become inactive when they log out." with-users :bob logout nil :ann active-users [:ann])

Takes a test script description, its initial state and a sequence of steps.

Each step is made of 3 or 4 values:
 - User
 - function to be called on the state
 - param (ommited if function does not take it)
 - Expected result

Executes the function in each step, checking for the expected result.
If an exception is thrown, the expected result is compared to the exception message.
The state returned by the function is passed on to the next step.

Returns the state after the last step. This is useful for starting new scripts using
the state created in previous ones.

Example:
(def initial-state {})
(def with-users (script "Users become active when they log in."
  inital-state
  :ann login nil
  :bob login nil
  :ann active-users [:ann :bob]))
(script "Users become inactive when they log out."
  with-users
  :bob logout nil
  :ann active-users [:ann])
raw docstring

script-userclj

(script-user single-user description initial-state & script-values)

Same as script, but takes an initial user argument, allowing the user to be omitted from the steps.

Same as script, but takes an initial user argument, allowing the user to be
omitted from the steps.
raw docstring

this-namespaceclj

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close