httpunit icon indicating copy to clipboard operation
httpunit copied to clipboard

Support Negative String/Text Match

Open kylebrandt opened this issue 10 years ago • 1 comments

There are instances where instead of looking for a string, it is better to look for the absence of the string. For example at Stack we have an http ping route which returns a bunch of "true" values in the JSON. the Text/String field could just make sure that false is not anywhere in the document as text (Other routes are like this but not json structured, this is just an off hand example).

Bug part: I'm calling this "String/Text" because the ReadMe says the field is called "String", but from what I can tell it seems like that is a mistake and it should be Text, in the TOML section:

Each [[plan]] lists:

  • label = A label for documentation purposes. It must be unique.
  • url = The URL to retrieve.
  • ips = For http/https, a list of IPs to send the URL to. Default is "use DNS". Otherwise the connection is made to the IP address listed, ignoring DNS.
  • code = For http/https, the expected status code, default 200.
  • string = For http/https, a string we expect to find in the result.
  • regex = For http/https, a regular expression we expect to match in the result

kylebrandt avatar Jul 05 '15 14:07 kylebrandt

If it isn't already, it would also be useful to support multiple string / regex declarations, and have them all AND'd together.

kylebrandt avatar Jul 05 '15 14:07 kylebrandt