Skip to content

RESTStepdefs

Antoine Neveux edited this page Feb 5, 2015 · 1 revision

#REST Stepdefs

Version 1.0, written by aneveux, generated by Docukes on Thu Feb 05 18:39:13 CET 2015

##Description

RESTStepdefs are all the step definitions you can use in your Cucumberfeatures in order to test REST services. It allows you to execute RESTrequests, but also to parse and validate the results, etc.

##Stepdefs

###call A Resource

Syntax: When: "^I call the \"([^\"]*)\" resource$"

Documentation:

Allows to send a GET request

###check A Response Property

Syntax: Then: "^the response property \"(.*)\" is (\"?.*\"?)$"

Documentation:

Allows to validate that the result of a REST call is containingexpectations

###check If Response Property Is Empty

Syntax: Then: "^the response property \"(.*)\" has a value$"

Documentation:

Allows to validate that the result of a REST call is containingexpectations

###validate A Response Property Equals To

Syntax: Then: "^the response property \"(.*)\" equals \"(.*)\"$"

Documentation:

Allows to validate that the result of a REST call is containingexpectations

###validate A Response Property Doesnt Contain

Syntax: Then: "^the response property \"(.*)\" not contains \"([^\"]*)\"$"

Documentation:

Allows to validate that the result of a REST call is containingexpectations

###validate A Response Property Contains

Syntax: Then: "^the response property \"(.*)\" contains \"([^\"]*)\"$"

Documentation:

Allows to validate that the result of a REST call is containingexpectations

###validate HTTP Response Code Is

Syntax: Then: "^the http response code is (\"?[0-9]*\"?)$"

Documentation:

Allows to validate that the response status of a REST call is matchingwith expectations.Asserts that a response status equals the status passed as parameter

###validate Response Is

Syntax: Then: "^the response contains \"(.*)\"$"

Documentation:

Allows to validate that the result of a REST call is containingexpectations, using a specific format

###validate Response Doesnt Contain

Syntax: Then: "^the response not contains \"(.*)\"$"

Documentation:

Allows to validate that the result of a REST call is containingexpectations, using a specific format

###validate JSON Response Is

Syntax: Then: "^the response content is:$"

Documentation:

{javadoc}

###check If Response Header Is Not Empty

Syntax: Then: "^the response header \"(.*)\" has a value$"

Documentation:

Allows to validate that the authentication ticket isn't null

###check If Response Header Is

Syntax: Then: "^the response header \"(.*)\" is \"(.*)\"$"

Documentation:

###check If Response Header Matches

Syntax: Then: "^the response header \"(.*)\" matches \"(.*)\"$"

Documentation:

###send Request With Parameters

Syntax: When: "^I (post|put|delete) to \"([^\"]*)\" the parameters:$"

Documentation:

Allows to send a REST request with some JSON parameters

###send Request Without Parameters

Syntax: When: "^I (post|put|delete) to \"(.*)\"$"

Documentation:

Allows to send a REST request with some JSON parameters

###set A Parameter To A Response Property

Syntax: Then: "^I set the parameter \"(.*?)\" to response property \"(.*?)\"$"

Documentation:

###set A Parameter To A Response Content

Syntax: Then: "^I set the parameter \"(.*?)\" to response content$"

Documentation:

###set A Parameter To A Keyword

Syntax: Given: "^I set the parameter \"(.*?)\" to (today|yesterday|tomorrow)$"

Documentation:

{javadoc}

###set A Parameter To A Date

Syntax: Given: "^I set the date parameter \"(.*?)\" to (\"?.*\"?)$"

Documentation:

{javadoc}

###set A Parameter To A Dynamic Value

Syntax: Given: "^I set the parameter \"(.*?)\" to \"(.*?)\"$"

Documentation:

{javadoc}

###set A Parameter To A Random Property From Response Array

Syntax: Given: "^I set randomly the parameter \"(.*?)\" to property \"(.*?)\" in response array$"

Documentation:

{javadoc}

###set A Parameter To A Random Item From Response Array

Syntax: Given: "^I set randomly the parameter \"(.*?)\" to an item in response array$"

Documentation:

{javadoc}

###set Max Attempts

Syntax: Given: "^I set max attempts to (\\d+)$"

Documentation:

{javadoc}

###set Retry Interval

Syntax: Given: "^I set retry interval to (\\d+) seconds$"

Documentation:

{javadoc}

###send Get Request And Retry Till Response Property Is

Syntax: When: "^I retry get to \"(.*?)\" until response property \"(.*?)\" is (\"?.*\"?)$"

Documentation:

{javadoc}

###send Get Request And Retry Till Response Contains

Syntax: When: "^I retry get to \"(.*?)\" until response contains \"(.*?)\"$"

Documentation:

{javadoc}

###send Get Request And Retry Till Success

Syntax: When: "^I retry get to \"(.*?)\" until succeed$"

Documentation:

{javadoc}

###send Get Request

Syntax: When: "^I send get to \"(.*?)\"$"

Documentation:

{javadoc}

###set A Parameter To AHTML Input Value

Syntax: Then: "^I set the parameter \"(.*?)\" to html input value \"(.*?)\"$"

Documentation:

{javadoc}

###send Post Request With Parameters

Syntax: Then: "^I send post to \"(.*?)\" the parameters:$"

Documentation:

{javadoc}

###set A Parameter To Response Header

Syntax: Then: "^I set the parameter \"(.*?)\" to response header \"(.*?)\"$"

Documentation:

{javadoc}

###set The Request Header

Syntax: Then: "^I set the request header \"(.*?)\" to \"(.*?)\"$"

Documentation:

{javadoc}

###check If Parameter Contains

Syntax: Then: "^the parameter \"(.*?)\" contains \"(.*?)\"$"

Documentation:

{javadoc}

###check If Parameter Equals

Syntax: Then: "^the parameter \"(.*?)\" equals \"(.*?)\"$"

Documentation:

{javadoc}

###set Date Format

Syntax: Given: "^I set date format \"(.*?)\"$"

Documentation:

{javadoc}

Clone this wiki locally