Use shorthand syntax whenever it is possible.

This commit is contained in:
jcamiel 2021-09-11 22:38:55 +02:00
parent 6a9943407b
commit de14afedac

View File

@ -86,7 +86,7 @@ GET https://example.net
HTTP/1.1 200
[Asserts]
xpath "normalize-space(//head/title)" equals "Hello world!"
xpath "normalize-space(//head/title)" == "Hello world!"
```
It is well adapted for REST/json apis
@ -100,8 +100,8 @@ POST https://api.example.net/tests
HTTP/1.1 200
[Asserts]
jsonpath "$.status" equals "RUNNING" # Check the status code
jsonpath "$.tests" countEquals 25 # Check the number of items
jsonpath "$.status" == "RUNNING" # Check the status code
jsonpath "$.tests" count == 25 # Check the number of items
```
@ -131,7 +131,7 @@ GET http://api.example.org/v1/pets
HTTP/1.0 200
[Asserts]
duration lessThan 1000 # Duration in ms
duration < 1000 # Duration in ms
```
## Powered by curl
@ -341,12 +341,12 @@ screencapability: low
HTTP/1.1 200
[Asserts]
jsonpath "$.validated" equals true
jsonpath "$.userInfo.firstName" equals "Franck"
jsonpath "$.userInfo.lastName" equals "Herbert"
jsonpath "$.hasDevice" equals false
jsonpath "$.links" countEquals 12
jsonpath "$.state" not equals null
jsonpath "$.validated" == true
jsonpath "$.userInfo.firstName" == "Franck"
jsonpath "$.userInfo.lastName" == "Herbert"
jsonpath "$.hasDevice" == false
jsonpath "$.links" count == 12
jsonpath "$.state" != null
```
[Doc](https://hurl.dev/docs/asserting-response.html#jsonpath-assert)
@ -367,8 +367,8 @@ GET https//example.org/order/435
# Testing status code is in a 200-300 range
HTTP/1.1 *
[Asserts]
status greaterThanOrEquals 200
status lessThan 300
status >= 200
status < 300
```
[Doc](https://hurl.dev/docs/asserting-response.html#status-assert)
@ -384,9 +384,9 @@ Content-Type: text/html; charset=UTF-8
[Asserts]
xpath "string(/html/head/title)" contains "Example" # Check title
xpath "count(//p)" equals 2 # Check the number of p
xpath "//p" countEquals 2 # Similar assert for p
xpath "boolean(count(//h2))" equals false # Check there is no h2
xpath "count(//p)" == 2 # Check the number of p
xpath "//p" count == 2 # Similar assert for p
xpath "boolean(count(//h2))" == false # Check there is no h2
xpath "//h2" not exists # Similar assert for h2
```
@ -399,12 +399,12 @@ GET http://myserver.com/home
HTTP/1.0 200
[Asserts]
cookie "JSESSIONID" equals "8400BAFE2F66443613DC38AE3D9D6239"
cookie "JSESSIONID[Value]" equals "8400BAFE2F66443613DC38AE3D9D6239"
cookie "JSESSIONID" == "8400BAFE2F66443613DC38AE3D9D6239"
cookie "JSESSIONID[Value]" == "8400BAFE2F66443613DC38AE3D9D6239"
cookie "JSESSIONID[Expires]" contains "Wed, 13 Jan 2021"
cookie "JSESSIONID[Secure]" exists
cookie "JSESSIONID[HttpOnly]" exists
cookie "JSESSIONID[SameSite]" equals "Lax"
cookie "JSESSIONID[SameSite]" == "Lax"
```
[Doc](https://hurl.dev/docs/asserting-response.html#cookie-assert)
@ -418,7 +418,7 @@ GET https://sample.org/helloworld
HTTP/* *
[Asserts]
duration lessThan 1000 # Check that response time is less than one second
duration < 1000 # Check that response time is less than one second
```
[Doc](https://hurl.dev/docs/asserting-response.html#duration-assert)