and(): decide whether a release can ship
Medium
A build pipeline runs several test suites and reports the number of failures in each, plus the code coverage as a percentage.
Return true when the release can ship: every suite has 0 failures and coverage is at least 80.
Watch out
- A comparison against a list gives one Boolean per suite, and
and()accepts those alongside its other arguments. and()reads an empty list as true, since nothing failed — but a release that was never tested must not ship.
Inputs
ri!failures— List of Integer, one count per suiteri!coverage— Integer
ri! Rule Inputs
ri!failuresList of Integer{
0,
0,
0
}ri!coverageInteger85
Example 1 — All green
Input: ri!failures
{
0,
0,
0
}Input: ri!coverage
85
Output:
true
Example 2 — One suite failing
Input: ri!failures
{
0,
2,
0
}Input: ri!coverage
90
Output:
false
Example 3 — Coverage just short
Input: ri!failures
{
0,
0
}Input: ri!coverage
79
Output:
false
Example 4 — Coverage exactly 80
Input: ri!failures
{0}Input: ri!coverage
80
Output:
true
Example 5 — No suites ran
Input: ri!failures
{}Input: ri!coverage
95
Output:
false
Appian Expression Tips
- • Use
ri!variableNamefor rule inputs - • Use
a!localVariables(local!x: …, body)for locals - • Use
a!forEach(items: …, expression: fv!item)to iterate - • Use
where()/reject(fn!isnull, list)to filter