Open oursinyi opened 5 years ago
Hi @oursinyi,
you can create a custom_comparators.py
and use with --import_extensions "custom_comparators"
COMPARATORS = {
'int_lt': lambda a, b: int(a) < int(b),
'int_gt': lambda a, b: int(a) > int(b),
'int_eq': lambda a, b: int(a) == int(b)
}
Now you can comapre json data and template variable as integer.
- compare: {jsonpath_mini: "total_num", comparator: "int_gt", expected: {template: "$totalnums"}}
Pacsi ;)
@svanoort
Hi There,
I faced with weird behaviour when I tried co compare two values. The testset:
The first comparation's result:
ERROR:Test Failure, failure type: Validator Failed, Reason: Comparison failed, evaluating gt(8, 7) returned False
And the second comparision's result:
ERROR:Test Failure, failure type: Validator Failed, Reason: Comparison failed, evaluating eq(7, 7) returned False
I am not sure why get False if 8 grater than 7 and 7 equal with 7? (These data are from same field, which means these are same type)
Thanks in advance!