zoncoen/scenarigo

【Feature Request】Support regex for expect body value

tetsuya28 opened this issue · 1 comments

Thanks to develop this awesome tool.

Feature Request

I want to use regex format for expect.body.xxxx in scenario yaml to check a response from an API response, like following yaml.
Or already scenarigo has a solution for the situation?

title: Scenario
steps:
- title: POST user
  protocol: http
  request:
    method: POST
    url: "http://localhost:8080/v0/users"
  expect:
    code: OK
    body:
      result:
        user_id: "hoge-.*" # Using regex format

@tetsuya28 Sorry for my late reply.
Scenarigo provides the string assertion by regexp. You can check response bodies by Go's regexp syntax.

title: Scenario
steps:
- title: POST user
  protocol: http
  request:
    method: POST
    url: "http://localhost:8080/v0/users"
  expect:
    code: OK
    body:
      result:
        user_id: '{{assert.regexp("hoge-.*")}}' # Using regex format

I'll write about it on the README. 🙇