Defines run, which runs a seq of features that match a supplied tags map, using the step functions defined in a supplied step-registry
Defines run, which runs a seq of features that match a supplied tags map, using the step functions defined in a supplied step-registry
(add-step-fns step-registry features)
Assign a step function, from step-registry, to each step map (under its ::fn key) of each scenario of each feature in features.
Assign a step function, from step-registry, to each step map (under its ::fn key) of each scenario of each feature in features.
(add-step-fns-to-feature step-registry feature)
Assign a step function, from step-registry, to each step map (under its ::fn key) of each scenario of feature.
Assign a step function, from step-registry, to each step map (under its ::fn key) of each scenario of feature.
(add-step-fns-to-scenario step-registry scenario)
Assign a step function, from step-registry, to each step map (under its ::fn key) of scenario.
Assign a step function, from step-registry, to each step map (under its ::fn key) of scenario.
(analyze-executed-executable executable)
Given an executed ::executable
, return a reduced map containing the
original ::feature
and ::scenario keys as well as a new ::outcome key, whose value is a
keyword---:pass, :fail, or :error---indicating its outcome, and count keys
detailing how many steps passed, failed and were untested.
Given an executed ``::executable``, return a reduced map containing the original ``::feature`` and ::scenario keys as well as a new ::outcome key, whose value is a keyword---:pass, :fail, or :error---indicating its outcome, and count keys detailing how many steps passed, failed and were untested.
(call-step-fn step ctx)
Call the step function in step, passing in context ctx. Returns 2-vec where the second element is an error data structure that indicates whether the step triggered an error or whether an assertion failed.
Call the step function in step, passing in context ctx. Returns 2-vec where the second element is an error data structure that indicates whether the step triggered an error or whether an assertion failed.
(exec-executables ctx
{:keys [:tegere.runner/stop :tegere.runner/prev-feature
:tegere.runner/prev-scenario]
:as config}
[executable & rest-executables])
Execute all of the ::executable
maps in the ::executables
collection
passed as the third argument. Recursive so that we can break out of execution
if an ::executable
fails.
Execute all of the ``::executable`` maps in the ``::executables`` collection passed as the third argument. Recursive so that we can break out of execution if an ``::executable`` fails.
(execute initial-ctx stop features)
Execute each scenario within each feature of features by running all of the step functions of each scenario in order. Return a seq of 'steps maps', maps that describe a single step set of a single scenario. Each step of each steps map each will contain an ::execution key whose value is a map representing the execution of the step. The stop param is a boolean; if true, then we will skip execution of subsequent steps after the first failure; if false, we run all step sets, ignoring previous failures.
Execute each scenario within each feature of features by running all of the step functions of each scenario in order. Return a seq of 'steps maps', maps that describe a single step set of a single scenario. Each step of each steps map each will contain an ::execution key whose value is a map representing the execution of the step. The stop param is a boolean; if true, then we will skip execution of subsequent steps after the first failure; if false, we run all step sets, ignoring previous failures.
(execute-step step ctx)
Execute step by calling its step function on ctx; return a map documenting the execution of the step. Documents start and end times immediately before and after the step is executed. Catches any exception and sets the ::err key to a string representation of the exception. The updated context will be set to ::ctx-after-exec. If the return value is not a map, we embed it in a map under :step-return-value.
Execute step by calling its step function on ctx; return a map documenting the execution of the step. Documents start and end times immediately before and after the step is executed. Catches any exception and sets the ::err key to a string representation of the exception. The updated context will be set to ::ctx-after-exec. If the return value is not a map, we embed it in a map under :step-return-value.
(execute-steps ctx [first-step & rest-steps])
Execute all steps in order by calling step-0 with ctx, then step-1 with the
output of step-0, etc. Recursive. Each executed step will have an
::execution
key.
Execute all steps in order by calling step-0 with ctx, then step-1 with the output of step-0, etc. Recursive. Each executed step will have an ``::execution`` key.
(executed-without-error? executed)
Return true if the final step of the supplied steps map executed without error, false otherwise.
Return true if the final step of the supplied steps map executed without error, false otherwise.
(features-are-empty? features)
Return true if there are no scenarios in features
Return true if there are no scenarios in features
(format-missing-step-fns missing-step-fns)
Return a string representation of the Clojure code that should be written in order to define the missing step functions.
Return a string representation of the Clojure code that should be written in order to define the missing step functions.
(get-executables [first-feature & rest-features])
(get-executables first-feature features [first-scenario & rest-scenarios])
Return an ::executables
collection, i.e., a lazy sequence of
::executable
maps. There is one ::executable
for each scenario in each
feature in the supplied coll of features.
Return an ``::executables`` collection, i.e., a lazy sequence of ``::executable`` maps. There is one ``::executable`` for each scenario in each feature in the supplied coll of features.
(get-features-to-run query features)
Return the substructure of the features
coll such that all
feature/scenario pairs within it match the supplied ::tegere.query/query
query
.
Return the substructure of the ``features`` coll such that all feature/scenario pairs within it match the supplied ``::tegere.query/query`` ``query``.
(get-missing-step-fns features)
Return the set of step maps in the features coll such that each step is missing a step function under ::fn.
Return the set of step maps in the features coll such that each step is missing a step function under ::fn.
(get-outcome-summary outcome-map)
Given a ::run-outcome
, return an ::outcome-summary
.
Given a ``::run-outcome``, return an ``::outcome-summary``.
(get-outcome-summary-report
{:keys [:tegere.runner/features-passed :tegere.runner/features-failed
:tegere.runner/scenarios-passed :tegere.runner/scenarios-failed
:tegere.runner/steps-passed :tegere.runner/steps-failed
:tegere.runner/steps-untested]})
Convert a map summarizing the output of running the features to a human-readable string summarizing the same information. Input is something like::
{::features {:passed 0 :failed 1}
::scenarios {:passed 0 :failed 1}
::p/steps {:passed 0 :failed 4}}
and the corresponding output would be::
0 features passed, 1 failed
0 scenarios passed, 1 failed
0 steps passed, 4 failed, 2 untested
TODO: add the total test execution time, e.g., 'Took 0m0.080s' and fill in the '???' blanks in the following prescriptive template.
0 features passed, 1 failed, ??? skipped, ??? untested
0 scenarios passed, 1 failed, ??? skipped, ??? untested
0 steps passed, 4 failed, ??? skipped, ??? undefined, 2 untested
Convert a map summarizing the output of running the features to a human-readable string summarizing the same information. Input is something like:: {::features {:passed 0 :failed 1} ::scenarios {:passed 0 :failed 1} ::p/steps {:passed 0 :failed 4}} and the corresponding output would be:: 0 features passed, 1 failed 0 scenarios passed, 1 failed 0 steps passed, 4 failed, 2 untested TODO: add the total test execution time, e.g., 'Took 0m0.080s' and fill in the '???' blanks in the following prescriptive template. 0 features passed, 1 failed, ??? skipped, ??? untested 0 scenarios passed, 1 failed, ??? skipped, ??? untested 0 steps passed, 4 failed, ??? skipped, ??? undefined, 2 untested
(get-run-outcome executables)
Convert an ::executables
collection to a ::run-outcome
map. A
::run-outcome
maps ::feature
maps to ::feature-outcome
maps, which
in turn map ::scenario
maps to ::analysis
maps.
Convert an ``::executables`` collection to a ``::run-outcome`` map. A ``::run-outcome`` maps ``::feature`` maps to ``::feature-outcome`` maps, which in turn map ``::scenario`` maps to ``::analysis`` maps.
(get-step-fn step-registry
{step-type :tegere.parser/type step-text :tegere.parser/text})
Get the step function in step-registry that matches step. If the function takes arguments from the step text, we still return a unary function over contexts, but it is a closure that receives the required string arguments from the matching step text. If there are multiple matches, return the one with the longest step function text---a simple heuristic for the most specific match.
Get the step function in step-registry that matches step. If the function takes arguments from the step text, we still return a unary function over contexts, but it is a closure that receives the required string arguments from the matching step text. If there are multiple matches, return the one with the longest step function text---a simple heuristic for the most specific match.
(get-step-fn-args step-fn-text step-text)
Return a vector of arguments (strings) from step-text that match any patterns present in step-fn-text. If there is no match, return nil; if there are no args, return []. Examples: 'I ate {fruit-type}' 'I ate a banana' => ['a banana'] 'I ate a banana' 'I ate a banana' => [] 'I saw {fruit-type}' 'I ate a banana' => nil 'I ate a pear' 'I ate a banana' => nil
Return a vector of arguments (strings) from step-text that match any patterns present in step-fn-text. If there is no match, return nil; if there are no args, return []. Examples: 'I ate {fruit-type}' 'I ate a banana' => ['a banana'] 'I ate a banana' 'I ate a banana' => [] 'I saw {fruit-type}' 'I ate a banana' => nil 'I ate a pear' 'I ate a banana' => nil
(is-executable? features)
Return an error either if features are not executable, where the second item in the 2-vector is a string indicating how to write the missing step functions.
Return an error either if features are not executable, where the second item in the 2-vector is a string indicating how to write the missing step functions.
(run features step-registry)
(run features
step-registry
{query :tegere.query/query-tree stop :tegere.runner/stop}
&
{:keys [initial-ctx] :or {initial-ctx {}}})
Run seq of features matching tags using the step functions defined in
step-registry. Return a ::run
map representing the result of running the
features.
Run seq of features matching tags using the step functions defined in step-registry. Return a ``::run`` map representing the result of running the features.
(summarize-run executables)
Given an ::executables
collection, return a map with spec-conformant keys
::outcome-summary
and ::outcome-summary-report
, the latter being a
string like:
0 features passed, 1 failed
0 scenarios passed, 1 failed
0 steps passed, 4 failed, 1 untested
Given an ``::executables`` collection, return a map with spec-conformant keys ``::outcome-summary`` and ``::outcome-summary-report``, the latter being a string like: 0 features passed, 1 failed 0 scenarios passed, 1 failed 0 steps passed, 4 failed, 1 untested
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close