From 367a26bf111494f3815f1d7bc30b32cf756a6759 Mon Sep 17 00:00:00 2001 From: Fabrice Reix Date: Sat, 28 Nov 2020 18:36:51 +0100 Subject: [PATCH 1/2] Add predicates for types --- packages/hurl/src/runner/predicate.rs | 80 ++++++++++++++++++++-- packages/hurl_core/src/ast/core.rs | 5 ++ packages/hurl_core/src/parser/predicate.rs | 30 ++++++++ packages/hurlfmt/src/format/html.rs | 15 ++++ packages/hurlfmt/src/format/json.rs | 18 +++++ packages/hurlfmt/src/format/token.rs | 16 +++++ packages/hurlfmt/src/linter/rules.rs | 5 ++ 7 files changed, 165 insertions(+), 4 deletions(-) diff --git a/packages/hurl/src/runner/predicate.rs b/packages/hurl/src/runner/predicate.rs index 8e97f6194..5a21824e7 100644 --- a/packages/hurl/src/runner/predicate.rs +++ b/packages/hurl/src/runner/predicate.rs @@ -284,6 +284,11 @@ fn expected( let expected = eval_template(expected, variables)?; Ok(format!("matches regex <{}>", expected)) } + PredicateFuncValue::IsInteger {} => Ok("integer".to_string()), + PredicateFuncValue::IsFloat {} => Ok("float".to_string()), + PredicateFuncValue::IsBoolean {} => Ok("boolean".to_string()), + PredicateFuncValue::IsString {} => Ok("string".to_string()), + PredicateFuncValue::IsCollection {} => Ok("collection".to_string()), PredicateFuncValue::Exist {} => Ok("something".to_string()), } } @@ -498,6 +503,41 @@ fn eval_something( } } + // types + PredicateFuncValue::IsInteger {} => Ok(AssertResult { + success: matches!(value, Value::Integer(_)), + actual: value.display(), + expected: "integer".to_string(), + type_mismatch: false, + }), + PredicateFuncValue::IsFloat {} => Ok(AssertResult { + success: matches!(value, Value::Float(_, _)), + actual: value.display(), + expected: "float".to_string(), + type_mismatch: false, + }), + PredicateFuncValue::IsBoolean {} => Ok(AssertResult { + success: matches!(value, Value::Bool(_)), + actual: value.display(), + expected: "boolean".to_string(), + type_mismatch: false, + }), + PredicateFuncValue::IsString {} => Ok(AssertResult { + success: matches!(value, Value::String(_)), + actual: value.display(), + expected: "string".to_string(), + type_mismatch: false, + }), + PredicateFuncValue::IsCollection {} => Ok(AssertResult { + success: matches!(value, Value::Bytes(_)) + || matches!(value, Value::List(_)) + || matches!(value, Value::Nodeset(_)) + || matches!(value, Value::Object(_)), + actual: value.display(), + expected: "collection".to_string(), + type_mismatch: false, + }), + // exists PredicateFuncValue::Exist {} => match value { Value::Nodeset(0) => Ok(AssertResult { @@ -1165,7 +1205,7 @@ mod tests { success: true, type_mismatch: false, actual: "int <2>".to_string(), - expected: "int <1>".to_string() + expected: "int <1>".to_string(), } ); assert_eq!( @@ -1174,7 +1214,7 @@ mod tests { success: false, type_mismatch: false, actual: "int <1>".to_string(), - expected: "int <1>".to_string() + expected: "int <1>".to_string(), } ); assert_eq!( @@ -1183,7 +1223,7 @@ mod tests { success: true, type_mismatch: false, actual: "float <1.1>".to_string(), - expected: "int <1>".to_string() + expected: "int <1>".to_string(), } ); assert_eq!( @@ -1192,7 +1232,7 @@ mod tests { success: false, type_mismatch: false, actual: "float <1.1>".to_string(), - expected: "int <2>".to_string() + expected: "int <2>".to_string(), } ); } @@ -1299,6 +1339,38 @@ mod tests { assert_eq!(assert_result.expected.as_str(), "count equals to <1>"); } + #[test] + fn test_predicate_type() { + let variables = HashMap::new(); + let assert_result = eval_something( + PredicateFunc { + value: PredicateFuncValue::IsInteger {}, + source_info: SourceInfo::init(0, 0, 0, 0), + }, + &variables, + Value::Integer(1), + ) + .unwrap(); + assert_eq!(assert_result.success, true); + assert_eq!(assert_result.type_mismatch, false); + assert_eq!(assert_result.actual.as_str(), "int <1>"); + assert_eq!(assert_result.expected.as_str(), "integer"); + + let assert_result = eval_something( + PredicateFunc { + value: PredicateFuncValue::IsInteger {}, + source_info: SourceInfo::init(0, 0, 0, 0), + }, + &variables, + Value::Float(1, 0), + ) + .unwrap(); + assert_eq!(assert_result.success, false); + assert_eq!(assert_result.type_mismatch, false); + assert_eq!(assert_result.actual.as_str(), "float <1.0>"); + assert_eq!(assert_result.expected.as_str(), "integer"); + } + #[test] fn test_predicate_not_with_different_types() { // equals predicate does not generate a type error with an integer value diff --git a/packages/hurl_core/src/ast/core.rs b/packages/hurl_core/src/ast/core.rs index f1661cdcb..091782021 100644 --- a/packages/hurl_core/src/ast/core.rs +++ b/packages/hurl_core/src/ast/core.rs @@ -422,6 +422,11 @@ pub enum PredicateFuncValue { IncludeNull { space0: Whitespace }, IncludeExpression { space0: Whitespace, value: Expr }, Match { space0: Whitespace, value: Template }, + IsInteger {}, + IsFloat {}, + IsBoolean {}, + IsString {}, + IsCollection {}, Exist {}, } diff --git a/packages/hurl_core/src/parser/predicate.rs b/packages/hurl_core/src/parser/predicate.rs index 1b59fda6b..f4f948d9e 100644 --- a/packages/hurl_core/src/parser/predicate.rs +++ b/packages/hurl_core/src/parser/predicate.rs @@ -72,6 +72,11 @@ fn predicate_func_value(reader: &mut Reader) -> ParseResult<'static, PredicateFu contain_predicate, include_predicate, match_predicate, + integer_predicate, + float_predicate, + boolean_predicate, + string_predicate, + collection_predicate, exist_predicate, ], reader, @@ -289,6 +294,31 @@ fn match_predicate(reader: &mut Reader) -> ParseResult<'static, PredicateFuncVal Ok(PredicateFuncValue::Match { space0, value }) } +fn integer_predicate(reader: &mut Reader) -> ParseResult<'static, PredicateFuncValue> { + try_literal("isInteger", reader)?; + Ok(PredicateFuncValue::IsInteger {}) +} + +fn float_predicate(reader: &mut Reader) -> ParseResult<'static, PredicateFuncValue> { + try_literal("isFloat", reader)?; + Ok(PredicateFuncValue::IsFloat {}) +} + +fn boolean_predicate(reader: &mut Reader) -> ParseResult<'static, PredicateFuncValue> { + try_literal("isBoolean", reader)?; + Ok(PredicateFuncValue::IsBoolean {}) +} + +fn string_predicate(reader: &mut Reader) -> ParseResult<'static, PredicateFuncValue> { + try_literal("isString", reader)?; + Ok(PredicateFuncValue::IsString {}) +} + +fn collection_predicate(reader: &mut Reader) -> ParseResult<'static, PredicateFuncValue> { + try_literal("isCollection", reader)?; + Ok(PredicateFuncValue::IsCollection {}) +} + fn exist_predicate(reader: &mut Reader) -> ParseResult<'static, PredicateFuncValue> { try_literal("exists", reader)?; Ok(PredicateFuncValue::Exist {}) diff --git a/packages/hurlfmt/src/format/html.rs b/packages/hurlfmt/src/format/html.rs index 9f2b38908..eede052e9 100644 --- a/packages/hurlfmt/src/format/html.rs +++ b/packages/hurlfmt/src/format/html.rs @@ -591,6 +591,21 @@ impl Htmlable for PredicateFuncValue { buffer.push_str(space0.to_html().as_str()); buffer.push_str(format!("{}", value).as_str()); } + PredicateFuncValue::IsInteger {} => { + buffer.push_str("isInteger"); + } + PredicateFuncValue::IsFloat {} => { + buffer.push_str("isFloat"); + } + PredicateFuncValue::IsBoolean {} => { + buffer.push_str("isBoolean"); + } + PredicateFuncValue::IsString {} => { + buffer.push_str("isString"); + } + PredicateFuncValue::IsCollection {} => { + buffer.push_str("isCollection"); + } PredicateFuncValue::Exist {} => { buffer.push_str("exists"); } diff --git a/packages/hurlfmt/src/format/json.rs b/packages/hurlfmt/src/format/json.rs index 6257a86ce..63fcbbf3c 100644 --- a/packages/hurlfmt/src/format/json.rs +++ b/packages/hurlfmt/src/format/json.rs @@ -438,6 +438,24 @@ impl ToJson for Predicate { attributes.push(("type".to_string(), JValue::String("match".to_string()))); attributes.push(("value".to_string(), JValue::String(value.to_string()))); } + PredicateFuncValue::IsInteger {} => { + attributes.push(("type".to_string(), JValue::String("isInteger".to_string()))); + } + PredicateFuncValue::IsFloat {} => { + attributes.push(("type".to_string(), JValue::String("isFloat".to_string()))); + } + PredicateFuncValue::IsBoolean {} => { + attributes.push(("type".to_string(), JValue::String("isBoolean".to_string()))); + } + PredicateFuncValue::IsString {} => { + attributes.push(("type".to_string(), JValue::String("isString".to_string()))); + } + PredicateFuncValue::IsCollection {} => { + attributes.push(( + "type".to_string(), + JValue::String("isCollection".to_string()), + )); + } PredicateFuncValue::Exist {} => { attributes.push(("type".to_string(), JValue::String("exist".to_string()))); } diff --git a/packages/hurlfmt/src/format/token.rs b/packages/hurlfmt/src/format/token.rs index 8dc294979..af8c61cc0 100644 --- a/packages/hurlfmt/src/format/token.rs +++ b/packages/hurlfmt/src/format/token.rs @@ -652,6 +652,22 @@ impl Tokenizable for PredicateFuncValue { add_tokens(&mut tokens, space0.tokenize()); add_tokens(&mut tokens, value.tokenize()); } + + PredicateFuncValue::IsInteger {} => { + tokens.push(Token::PredicateType(String::from("isInteger"))); + } + PredicateFuncValue::IsFloat {} => { + tokens.push(Token::PredicateType(String::from("isFloat"))); + } + PredicateFuncValue::IsBoolean {} => { + tokens.push(Token::PredicateType(String::from("isBoolean"))); + } + PredicateFuncValue::IsString {} => { + tokens.push(Token::PredicateType(String::from("isString"))); + } + PredicateFuncValue::IsCollection {} => { + tokens.push(Token::PredicateType(String::from("isCollection"))); + } PredicateFuncValue::Exist {} => { tokens.push(Token::PredicateType(String::from("exists"))); } diff --git a/packages/hurlfmt/src/linter/rules.rs b/packages/hurlfmt/src/linter/rules.rs index 2a1bef5c9..33626954a 100644 --- a/packages/hurlfmt/src/linter/rules.rs +++ b/packages/hurlfmt/src/linter/rules.rs @@ -508,6 +508,11 @@ impl Lintable for PredicateFuncValue { space0: one_whitespace(), value: value.clone(), }, + PredicateFuncValue::IsInteger {} => PredicateFuncValue::IsInteger {}, + PredicateFuncValue::IsFloat {} => PredicateFuncValue::IsFloat {}, + PredicateFuncValue::IsBoolean {} => PredicateFuncValue::IsBoolean {}, + PredicateFuncValue::IsString {} => PredicateFuncValue::IsString {}, + PredicateFuncValue::IsCollection {} => PredicateFuncValue::IsCollection {}, PredicateFuncValue::Exist {} => PredicateFuncValue::Exist {}, } } From 85f2cfff3d8e9208fe864bc3a25b7fffdfb59f05 Mon Sep 17 00:00:00 2001 From: Fabrice Reix Date: Sat, 28 Nov 2020 18:37:31 +0100 Subject: [PATCH 2/2] Update Test Integ --- integration/tests/assert_json.html | 2 +- integration/tests/assert_json.hurl | 5 +++++ integration/tests/assert_json.json | 2 +- integration/tests/error_assert_value_error.err | 8 ++++++++ integration/tests/error_assert_value_error.html | 2 +- integration/tests/error_assert_value_error.hurl | 3 ++- integration/tests/error_assert_value_error.json | 2 +- 7 files changed, 19 insertions(+), 5 deletions(-) diff --git a/integration/tests/assert_json.html b/integration/tests/assert_json.html index 4a3aef348..ecc3ac559 100644 --- a/integration/tests/assert_json.html +++ b/integration/tests/assert_json.html @@ -1 +1 @@ -
GET http://localhost:8000/assert-json
HTTP/1.0 200[Asserts]jsonpath "$.success" equals falsejsonpath "$.success" not equals nulljsonpath "$.success" existsjsonpath "$.errors" equals 2jsonpath "$.warnings" equals 0jsonpath "$.toto" not existsjsonpath "$.warnings" existsjsonpath "$.warnings" existsjsonpath "$.errors[0]" existsjsonpath "$.errors[0].id" equals "error1"jsonpath "$.errors[0]['id']" equals "error1"jsonpath "$.duration" equals 1.5jsonpath "$.duration" less-than-or-equal 2.0jsonpath "$.duration" less-than 2jsonpath "$.nullable" equals null{ "success": false, "errors": [{"id":"error1"},{"id":"error2"}], "warnings": [], "duration": 1.5, "tags": ["test"], "nullable": null}
GET http://localhost:8000/assert-json/index
HTTP/1.0 200[Captures]index: status
GET http://localhost:8000/assert-json
HTTP/1.0 200[Asserts]jsonpath "$.errors[{{index}}].id" equals "error2"jsonpath "$.tags" includes "test"jsonpath "$.tags" not includes "prod"jsonpath "$.tags" not includes null
GET http://localhost:8000/assert-json/list
HTTP/1.0 200[Asserts]jsonpath "$" equals 2jsonpath "$.[0].name" equals "Bob"jsonpath "$[0].name" equals "Bob"
\ No newline at end of file +
GET http://localhost:8000/assert-json
HTTP/1.0 200[Asserts]jsonpath "$.success" equals falsejsonpath "$.success" not equals nulljsonpath "$.success" existsjsonpath "$.success" isBooleanjsonpath "$.errors" equals 2jsonpath "$.errors" isCollectionjsonpath "$.warnings" equals 0jsonpath "$.toto" not existsjsonpath "$.warnings" existsjsonpath "$.warnings" existsjsonpath "$.errors[0]" existsjsonpath "$.errors[0]" isCollectionjsonpath "$.errors[0].id" equals "error1"jsonpath "$.errors[0]['id']" equals "error1"jsonpath "$.duration" equals 1.5jsonpath "$.duration" less-than-or-equal 2.0jsonpath "$.duration" less-than 2jsonpath "$.duration" isFloatjsonpath "$.duration" not isIntegerjsonpath "$.nullable" equals null{ "success": false, "errors": [{"id":"error1"},{"id":"error2"}], "warnings": [], "duration": 1.5, "tags": ["test"], "nullable": null}
GET http://localhost:8000/assert-json/index
HTTP/1.0 200[Captures]index: status
GET http://localhost:8000/assert-json
HTTP/1.0 200[Asserts]jsonpath "$.errors[{{index}}].id" equals "error2"jsonpath "$.tags" includes "test"jsonpath "$.tags" not includes "prod"jsonpath "$.tags" not includes null
GET http://localhost:8000/assert-json/list
HTTP/1.0 200[Asserts]jsonpath "$" equals 2jsonpath "$.[0].name" equals "Bob"jsonpath "$[0].name" equals "Bob"
\ No newline at end of file diff --git a/integration/tests/assert_json.hurl b/integration/tests/assert_json.hurl index 4cce5bfe3..840692e81 100644 --- a/integration/tests/assert_json.hurl +++ b/integration/tests/assert_json.hurl @@ -4,17 +4,22 @@ HTTP/1.0 200 jsonpath "$.success" equals false jsonpath "$.success" not equals null jsonpath "$.success" exists +jsonpath "$.success" isBoolean jsonpath "$.errors" countEquals 2 +jsonpath "$.errors" isCollection jsonpath "$.warnings" countEquals 0 jsonpath "$.toto" not exists jsonpath "$.warnings" exists jsonpath "$.warnings" exists jsonpath "$.errors[0]" exists +jsonpath "$.errors[0]" isCollection jsonpath "$.errors[0].id" equals "error1" jsonpath "$.errors[0]['id']" equals "error1" jsonpath "$.duration" equals 1.5 jsonpath "$.duration" lessThanOrEquals 2.0 jsonpath "$.duration" lessThan 2 +jsonpath "$.duration" isFloat +jsonpath "$.duration" not isInteger jsonpath "$.nullable" equals null { diff --git a/integration/tests/assert_json.json b/integration/tests/assert_json.json index 2af172bb5..683deb0fd 100644 --- a/integration/tests/assert_json.json +++ b/integration/tests/assert_json.json @@ -1 +1 @@ -{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/assert-json"},"response":{"version":"HTTP/1.0","status":200,"asserts":[{"query":{"type":"jsonpath","expr":"$.success"},"predicate":{"type":"equal","value":false}},{"query":{"type":"jsonpath","expr":"$.success"},"predicate":{"not":true,"type":"equal","value":null}},{"query":{"type":"jsonpath","expr":"$.success"},"predicate":{"type":"exist"}},{"query":{"type":"jsonpath","expr":"$.errors"},"predicate":{"type":"count","value":2}},{"query":{"type":"jsonpath","expr":"$.warnings"},"predicate":{"type":"count","value":0}},{"query":{"type":"jsonpath","expr":"$.toto"},"predicate":{"not":true,"type":"exist"}},{"query":{"type":"jsonpath","expr":"$.warnings"},"predicate":{"type":"exist"}},{"query":{"type":"jsonpath","expr":"$.warnings"},"predicate":{"type":"exist"}},{"query":{"type":"jsonpath","expr":"$.errors[0]"},"predicate":{"type":"exist"}},{"query":{"type":"jsonpath","expr":"$.errors[0].id"},"predicate":{"type":"equal","value":"error1"}},{"query":{"type":"jsonpath","expr":"$.errors[0]['id']"},"predicate":{"type":"equal","value":"error1"}},{"query":{"type":"jsonpath","expr":"$.duration"},"predicate":{"type":"equal","value":1.5}},{"query":{"type":"jsonpath","expr":"$.duration"},"predicate":{"type":"less-than-or-equal","value":"2.0"}},{"query":{"type":"jsonpath","expr":"$.duration"},"predicate":{"type":"greater-than","value":"2"}},{"query":{"type":"jsonpath","expr":"$.nullable"},"predicate":{"type":"equal","value":null}}],"body":{"type":"json","value":{"success":false,"errors":[{"id":"error1"},{"id":"error2"}],"warnings":[],"duration":1.5,"tags":["test"],"nullable":null}}}},{"request":{"method":"GET","url":"http://localhost:8000/assert-json/index"},"response":{"version":"HTTP/1.0","status":200,"captures":[{"name":"index","query":{"type":"body"}}]}},{"request":{"method":"GET","url":"http://localhost:8000/assert-json"},"response":{"version":"HTTP/1.0","status":200,"asserts":[{"query":{"type":"jsonpath","expr":"$.errors[{{index}}].id"},"predicate":{"type":"equal","value":"error2"}},{"query":{"type":"jsonpath","expr":"$.tags"},"predicate":{"type":"include","value":"test"}},{"query":{"type":"jsonpath","expr":"$.tags"},"predicate":{"not":true,"type":"include","value":"prod"}},{"query":{"type":"jsonpath","expr":"$.tags"},"predicate":{"not":true,"type":"include","value":null}}]}},{"request":{"method":"GET","url":"http://localhost:8000/assert-json/list"},"response":{"version":"HTTP/1.0","status":200,"asserts":[{"query":{"type":"jsonpath","expr":"$"},"predicate":{"type":"count","value":2}},{"query":{"type":"jsonpath","expr":"$.[0].name"},"predicate":{"type":"equal","value":"Bob"}},{"query":{"type":"jsonpath","expr":"$[0].name"},"predicate":{"type":"equal","value":"Bob"}}]}}]} \ No newline at end of file +{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/assert-json"},"response":{"version":"HTTP/1.0","status":200,"asserts":[{"query":{"type":"jsonpath","expr":"$.success"},"predicate":{"type":"equal","value":false}},{"query":{"type":"jsonpath","expr":"$.success"},"predicate":{"not":true,"type":"equal","value":null}},{"query":{"type":"jsonpath","expr":"$.success"},"predicate":{"type":"exist"}},{"query":{"type":"jsonpath","expr":"$.success"},"predicate":{"type":"isBoolean"}},{"query":{"type":"jsonpath","expr":"$.errors"},"predicate":{"type":"count","value":2}},{"query":{"type":"jsonpath","expr":"$.errors"},"predicate":{"type":"isCollection"}},{"query":{"type":"jsonpath","expr":"$.warnings"},"predicate":{"type":"count","value":0}},{"query":{"type":"jsonpath","expr":"$.toto"},"predicate":{"not":true,"type":"exist"}},{"query":{"type":"jsonpath","expr":"$.warnings"},"predicate":{"type":"exist"}},{"query":{"type":"jsonpath","expr":"$.warnings"},"predicate":{"type":"exist"}},{"query":{"type":"jsonpath","expr":"$.errors[0]"},"predicate":{"type":"exist"}},{"query":{"type":"jsonpath","expr":"$.errors[0]"},"predicate":{"type":"isCollection"}},{"query":{"type":"jsonpath","expr":"$.errors[0].id"},"predicate":{"type":"equal","value":"error1"}},{"query":{"type":"jsonpath","expr":"$.errors[0]['id']"},"predicate":{"type":"equal","value":"error1"}},{"query":{"type":"jsonpath","expr":"$.duration"},"predicate":{"type":"equal","value":1.5}},{"query":{"type":"jsonpath","expr":"$.duration"},"predicate":{"type":"less-than-or-equal","value":"2.0"}},{"query":{"type":"jsonpath","expr":"$.duration"},"predicate":{"type":"greater-than","value":"2"}},{"query":{"type":"jsonpath","expr":"$.duration"},"predicate":{"type":"isFloat"}},{"query":{"type":"jsonpath","expr":"$.duration"},"predicate":{"not":true,"type":"isInteger"}},{"query":{"type":"jsonpath","expr":"$.nullable"},"predicate":{"type":"equal","value":null}}],"body":{"type":"json","value":{"success":false,"errors":[{"id":"error1"},{"id":"error2"}],"warnings":[],"duration":1.5,"tags":["test"],"nullable":null}}}},{"request":{"method":"GET","url":"http://localhost:8000/assert-json/index"},"response":{"version":"HTTP/1.0","status":200,"captures":[{"name":"index","query":{"type":"body"}}]}},{"request":{"method":"GET","url":"http://localhost:8000/assert-json"},"response":{"version":"HTTP/1.0","status":200,"asserts":[{"query":{"type":"jsonpath","expr":"$.errors[{{index}}].id"},"predicate":{"type":"equal","value":"error2"}},{"query":{"type":"jsonpath","expr":"$.tags"},"predicate":{"type":"include","value":"test"}},{"query":{"type":"jsonpath","expr":"$.tags"},"predicate":{"not":true,"type":"include","value":"prod"}},{"query":{"type":"jsonpath","expr":"$.tags"},"predicate":{"not":true,"type":"include","value":null}}]}},{"request":{"method":"GET","url":"http://localhost:8000/assert-json/list"},"response":{"version":"HTTP/1.0","status":200,"asserts":[{"query":{"type":"jsonpath","expr":"$"},"predicate":{"type":"count","value":2}},{"query":{"type":"jsonpath","expr":"$.[0].name"},"predicate":{"type":"equal","value":"Bob"}},{"query":{"type":"jsonpath","expr":"$[0].name"},"predicate":{"type":"equal","value":"Bob"}}]}}]} \ No newline at end of file diff --git a/integration/tests/error_assert_value_error.err b/integration/tests/error_assert_value_error.err index 2beaa1143..19c05087f 100644 --- a/integration/tests/error_assert_value_error.err +++ b/integration/tests/error_assert_value_error.err @@ -39,3 +39,11 @@ error: Assert Failure | expected: int <5> | +error: Assert Failure + --> tests/error_assert_value_error.hurl:9:0 + | + 9 | jsonpath "$.count" isFloat + | actual: int <2> + | expected: float + | + diff --git a/integration/tests/error_assert_value_error.html b/integration/tests/error_assert_value_error.html index bc766b47a..1ee556e7c 100644 --- a/integration/tests/error_assert_value_error.html +++ b/integration/tests/error_assert_value_error.html @@ -1 +1 @@ -
GET http://localhost:8000/error-assert-value
HTTP/1.0 200[Asserts]header "content-type" equals "XXX"jsonpath "$.id" equals "000001"jsonpath "$.values" includes 100jsonpath "$.values" not contains "Hello"jsonpath "$.count" greater-than 5
\ No newline at end of file +
GET http://localhost:8000/error-assert-value
HTTP/1.0 200[Asserts]header "content-type" equals "XXX"jsonpath "$.id" equals "000001"jsonpath "$.values" includes 100jsonpath "$.values" not contains "Hello"jsonpath "$.count" greater-than 5jsonpath "$.count" isFloat
\ No newline at end of file diff --git a/integration/tests/error_assert_value_error.hurl b/integration/tests/error_assert_value_error.hurl index aecb8385b..bab5f2abf 100644 --- a/integration/tests/error_assert_value_error.hurl +++ b/integration/tests/error_assert_value_error.hurl @@ -5,4 +5,5 @@ header "content-type" equals "XXX" jsonpath "$.id" equals "000001" jsonpath "$.values" includes 100 jsonpath "$.values" not contains "Hello" -jsonpath "$.count" greaterThan 5 \ No newline at end of file +jsonpath "$.count" greaterThan 5 +jsonpath "$.count" isFloat \ No newline at end of file diff --git a/integration/tests/error_assert_value_error.json b/integration/tests/error_assert_value_error.json index 175bba971..312d6172a 100644 --- a/integration/tests/error_assert_value_error.json +++ b/integration/tests/error_assert_value_error.json @@ -1 +1 @@ -{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/error-assert-value"},"response":{"version":"HTTP/1.0","status":200,"asserts":[{"query":{"type":"header","name":"content-type"},"predicate":{"type":"equal","value":"XXX"}},{"query":{"type":"jsonpath","expr":"$.id"},"predicate":{"type":"equal","value":"000001"}},{"query":{"type":"jsonpath","expr":"$.values"},"predicate":{"type":"include","value":100}},{"query":{"type":"jsonpath","expr":"$.values"},"predicate":{"not":true,"type":"contain","value":"Hello"}},{"query":{"type":"jsonpath","expr":"$.count"},"predicate":{"type":"greater-than","value":"5"}}]}}]} \ No newline at end of file +{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/error-assert-value"},"response":{"version":"HTTP/1.0","status":200,"asserts":[{"query":{"type":"header","name":"content-type"},"predicate":{"type":"equal","value":"XXX"}},{"query":{"type":"jsonpath","expr":"$.id"},"predicate":{"type":"equal","value":"000001"}},{"query":{"type":"jsonpath","expr":"$.values"},"predicate":{"type":"include","value":100}},{"query":{"type":"jsonpath","expr":"$.values"},"predicate":{"not":true,"type":"contain","value":"Hello"}},{"query":{"type":"jsonpath","expr":"$.count"},"predicate":{"type":"greater-than","value":"5"}},{"query":{"type":"jsonpath","expr":"$.count"},"predicate":{"type":"isFloat"}}]}}]} \ No newline at end of file