ekino / veggies

:sparkles: :rocket: Veggies is an awesome cucumberjs library for API/CLI testing. Great for testing APIs built upon Express, Koa, HAPI, Loopback and others. It's also the perfect companion for testing CLI applications built with commander, meow & Co.
https://ekino.github.io/veggies/
MIT License
90 stars 18 forks source link

Adding more concise matchers support #16

Closed plouc closed 3 years ago

plouc commented 7 years ago

For now we have a pretty verbose way to express assertions to be made on complex objects, like this:

And json response should match
    | field | matcher | value     |
    | id    | contain | 123       |
    | name  | equal   | John      |
    | corp  | match   | ^(.+)ing$ |

I think we could provide the ability to use shorter notation, like this:

And json response should match
    | id *= 123         |
    | name = John       |
    | corp ~= ^(.+)ing$ |

Here is my proposal to do so (heavily inspired by CSS attribute selectors):

matcher operator
equals =
match regexp ~=
contains *=
ends with $=
starts with ^=
plouc commented 7 years ago

ping @bnadim, @aticus7886, what do you think?

bnadim commented 7 years ago

why not it's easier to read :)