Reputation: 455
I am trying to assert the response for a HTTP GET
execution:
- executor: selenium
scenario: dashboard
iterations: 1
reporting:
- module: final-stats
dump-xml: results/test.xml
dump-csv: results/test2.csv
- module: junit-xml
filename: results/testfinal.xml
data-source: pass-fail
modules:
console:
disable: true
scenarios:
dashboard:
browser: Chrome
timeout: 60s
default-address: https://${URL}
requests:
- label: ignore
url: https://${URL}
actions:
- waitByXPath(/html/body/div/div[2]/div/div/div/div[4]/div[2]/form/input[4]): Visible
- keysByXPath(/html/body/div/div[2]/div/div/div/div[4]/div[2]/form/input[4]): ${USERNAME}
- keysByXPath(/html/body/div/div[2]/div/div/div/div[4]/div[2]/form/input[5]): ${PASSWORD}
- clickByXPath(/html/body/div/div[2]/div/div/div/div[4]/div[2]/form/div[4]/button)
- url: /Sites/testsite/api/level1/status/auth-service-health-check
method: GET
assert:
- contains:
- 200
subject: status-code
Error i am getting is "TypeError: first argument must be string or compiled pattern"
Please can any one help with this All what i need to check is whether the reponse status is 200 for url: /Sites/testsite/api/level1/status/auth-service-health-check
issue is on here exactly
- contains:
- 200
subject: status-code
if i add like this error disappeared but then it checking the response body not status code
- contains:
- '200'
subject: status-code
Upvotes: 0
Views: 1564
Reputation: 288
The suggestion to check http-code instead of status-code is correct. To expand on that, check out the explanation here: https://gettaurus.org/docs/JMeter/#HTTP-Requests
Scroll down a bit and there's a discussion of how exactly assertions work in Taurus, with some examples. Of particular note is this part:
Possible subjects are:
body
headers
http-code
Upvotes: 3
Reputation: 150
Have you tried changing the subject
to http-code
?:
subject: http-code
Upvotes: 1