-
Notifications
You must be signed in to change notification settings - Fork 2
Predefined pass fail functions
ok, fail, match, unmatch, has, hasnt, eq, ne, gt, lt, ge, le
pass if cond is 0, None, or considered as True, otherwise fail. passdesc is logged when pass, or faildesc is logged The pass criteria can be set using ReturnPassSet function.
When passdesc is None, it logs Cond's value when passed, if faildesc is None, it logs Cond's value or passdesc when fail.
always fail, and log desc
pass if o1 match o2, otherwise fail. Here o2 is a regular expression, match is to search o1 to see if return True.
log "value(o1) =~ value(o2)?" when passdesc and faildesc are not defined. Or log passdesc/faildesc when pass/fail
# Example
from test_steps import match
match("Writing test scripts is not easy", "(test|development).scripts")
# pass, log "Writing test scripts is not easy" =~ "(test|development).scripts"
pass if o1 unmatch o2, otherwise fail. Here o2 is a regular expression, unmatch is to search o1 to see if return False.
log "value(o1) !~ value(o2)?" when passdesc and faildesc are not defined. Or log passdesc/faildesc when pass/fail
pass if o2 in o2, otherwise fail. Here O1 could be a string, a list, or a dictionary, o2 could be a string or an item is a list or key in a dictionary.
log "value(o1) => value(o2)?" when passdesc and faildesc are not defined. Or log passdesc/faildesc when pass/fail
# Example
from test_steps import has
has("Writing test scripts is not easy", "test")
# pass, log "Writing test scripts is not easy" => "test"
has(['shanghai', 'beijing', 'chengdu'], "wuhan")
# fail, log ['shanghai', 'beijing', 'chengdu'] => "wuhan" ?
pass if not o2 in o2, otherwise fail. Here O1 could be a string, a list, or a dictionary, o2 could be a string or an item is a list or key in a dictionary.
log "value(o1) !> value(o2)?" when passdesc and faildesc are not defined. Or log passdesc/faildesc when pass/fail
pass if o1 == o2, otherwise fail.
log "value(o1) == value(o2)?" when passdesc and faildesc are not defined. Or log passdesc/faildesc when pass/fail
pass if o1 != o2, otherwise fail.
log "value(o1) != value(o2)?" when passdesc and faildesc are not defined. Or log passdesc/faildesc when pass/fail
pass if o1 > o2, otherwise fail.
log "value(o1) > value(o2)?" when passdesc and faildesc are not defined. Or log passdesc/faildesc when pass/fail
pass if o1 < o2, otherwise fail.
log "value(o1) < value(o2)?" when passdesc and faildesc are not defined. Or log passdesc/faildesc when pass/fail
pass if o1 >= o2, otherwise fail.
log "value(o1) >= value(o2)?" when passdesc and faildesc are not defined. Or log passdesc/faildesc when pass/fail
pass if o1 <= o2, otherwise fail.
log "value(o1) <= value(o2)?" when passdesc and faildesc are not defined. Or log passdesc/faildesc when pass/fail