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

Current snapshot implementation does not work with scenario outlines #24

Open plouc opened 6 years ago

plouc commented 6 years ago

Steps to reproduce

Having a scenario like this:

    Scenario Outline: I get all posts filtered using '<filter>=<value>' directive
        Given I set request query
            | <filter> | <value> |
        When I GET /api/v1/posts/all
        Then response status code should be 200
        And response body should match snapshot

        Examples:
            | filter | value           |
            | title  | car industry    |

Current behavior

Running this test, I end up with the following error:

Error: Can not do a snapshot. Scenario not found in file test/functional/features/posts/get_posts.feature on line 13

Expected behavior

Test running :)

Environment

lelbil commented 6 years ago

Hello @plouc

if @bnadim is busy, I can have a try at this. I've been digging around and apparently, Snapshot class method extractScenarios only matches /^[\s]*Scenario:[\s]*(.*[^\s])[\s]*$/, so when it's a Scenario Outline it doesn't match. Moreover, the line number for a single scenario in the outline, is the line number where the example is specified.

Anyway, I can give it a shot if that doesn't bother you.

plouc commented 6 years ago

@lelbil, no problem, depending on your planing of course :)