Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check only one value in jsonArray #52

Open
Jerome1337 opened this issue Mar 2, 2016 · 0 comments
Open

Check only one value in jsonArray #52

Jerome1337 opened this issue Mar 2, 2016 · 0 comments

Comments

@Jerome1337
Copy link

I'm using the And the response should contain json: step, this is working when I check a json body with { "foo": "bar" }
But when my body is a jsonArray like this[{ "foo": "bar", "bar": "foo" }] I must send all the correct datas of the first element of the jsonArray to have this step valid. This is problematic when you have a DataTime that change at every data fixtures loading...

I tried to made a custom step in my FeatureContext who will check if there is a jsonArray or not and make the good value check but I need to get the returned response of the request who's not accessible the response in WebApiExtension

Is it possible to check only one value in the first element of a jsonArray with WebApiContext or I must make a custom step ?
If I must made a custom step how can I have access to the request response in my FeatureContext ?

This the type of scenario I'm trying to test and making work :

 Scenario: I find all my DNS zones as customer
   Given I am authenticated as customer
   And I send a GET request to "/api/dns"
   Then the response code should be 200
   And the response should contain json:
   """
   [{
     "name":"club-internet.fr"
   }]
   """
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant