add match method: startswith

This commit is contained in:
httprunner
2017-07-05 15:14:10 +08:00
parent af09573119
commit fc6e4c8eef
2 changed files with 7 additions and 1 deletions

View File

@@ -288,6 +288,8 @@ def match_expected(value, expected, comparator="eq"):
assert re.match(expected, value)
elif comparator in ["str_len", "string_length"]:
assert len(value) == int(expected)
elif comparator in ["startswith"]:
assert str(value).startswith(str(expected))
else:
raise ParamsError("comparator not supported!")