Class BaseStepDefinition


  • public class BaseStepDefinition
    extends Object
    The type Base step definition.
    Author:
    Elan Thangamani
    • Constructor Detail

      • BaseStepDefinition

        public BaseStepDefinition()
    • Method Detail

      • readRequestByPathParam

        @Given("^(.*) with an path param (.*) of (.*)")
        public void readRequestByPathParam​(String dummy,
                                           String identifier,
                                           String value)
        Read request by path param.
        Parameters:
        dummy - the dummy
        identifier - the identifier
        value - the value
      • cert

        @Given("^enable cert for (.*) of (.*)")
        public void cert​(String identifier,
                         String value)
        Read request by path param.
        Parameters:
        identifier - the identifier
        value - the value
      • auth

        @Given("^basic authentication with (.*) and (.*)")
        public void auth​(String username,
                         String password)
        Read request by path param.
        Parameters:
        username - the identifier
        password - the value
      • bearer

        @Given("^(.*) auth with (.*) token$")
        public void bearer​(String auth,
                           String token)
        Read request by path param.
        Parameters:
        auth - the identifier
        token - the value
      • readRequestByPathParam

        @Given("^(.*) perform a api action")
        public void readRequestByPathParam​(String dummy)
        Read request by path param.
        Parameters:
        dummy - the dummy
      • readRequestByHeaderParam

        @Given("^(.*) with an header param (.*) of (.*)")
        public void readRequestByHeaderParam​(String dummy,
                                             String identifier,
                                             String value)
        Read request by header param.
        Parameters:
        dummy - the dummy
        identifier - the identifier
        value - the value
      • readAllHeaderParams

        @Given("add (.*) with given header params$")
        public void readAllHeaderParams​(String nameIgnore,
                                        Map<String,​String> parameterMap)
                                 throws Exception
        Read request.
        Parameters:
        nameIgnore - the name ignore
        parameterMap - the parameter map
        Throws:
        Exception - the exception
      • readRequestByQueryParam

        @Given("^(.*) with an query param (.*) of (.*)")
        public void readRequestByQueryParam​(String dummy,
                                            String identifier,
                                            String value)
        Read request by query param.
        Parameters:
        dummy - the dummy
        identifier - the identifier
        value - the value
      • loadGlobalParam

        @Given("^Provided all the feature level parameters$")
        public void loadGlobalParam​(Map<String,​String> globalParams)
                             throws IOException
        Load global param.
        Parameters:
        globalParams - the global params
        Throws:
        IOException - the io exception
      • loadGlobalParamFromFile

        @Given("^Provided all the feature level parameters from file$")
        public void loadGlobalParamFromFile()
                                     throws IOException
        Load global param.
        Throws:
        IOException - the io exception
      • validateGlobalParam

        @Then("^Verify all the feature level parameters exists")
        public void validateGlobalParam()
        Validate global param.
      • addVariable

        @Given("^Add the (.*) value of the key as (.*)")
        public void addVariable​(String responseValue,
                                String key)
        Add variable.
        Parameters:
        responseValue - the response value
        key - the key
      • modifyDecimalVariable

        @Given("^evaluate the (.*) decimal value of the key as (.*)")
        public void modifyDecimalVariable​(String responseValue,
                                          String key)
                                   throws IOException
        Modify variable.
        Parameters:
        responseValue - the response value
        key - the key
        Throws:
        IOException - the io exception
      • modifyIntVariable

        @Given("^evaluate the (.*) integer value of the key as (.*)")
        public void modifyIntVariable​(String responseValue,
                                      String key)
                               throws IOException
        Modify variable.
        Parameters:
        responseValue - the response value
        key - the key
        Throws:
        IOException - the io exception
      • modifyBooleanVariable

        @Given("^evaluate the (.*) boolean value of the key as (.*)")
        public void modifyBooleanVariable​(String responseValue,
                                          String key)
                                   throws IOException
        Modify variable.
        Parameters:
        responseValue - the response value
        key - the key
        Throws:
        IOException - the io exception
      • modifyStringVariable

        @Given("^Modify the (.*) value of the key as (.*)")
        public void modifyStringVariable​(String responseValue,
                                         String key)
                                  throws IOException
        Modify variable.
        Parameters:
        responseValue - the response value
        key - the key
        Throws:
        IOException - the io exception
      • loadAsGlobalParam

        @Given("^Store the (.*) value of the key as (.*)")
        public void loadAsGlobalParam​(String responseKey,
                                      String key)
        Load as global param.
        Parameters:
        responseKey - the response key
        key - the key
      • readPathParamsRequest

        @Given("^add (.*) with given path params$")
        public void readPathParamsRequest​(String nameIgnore,
                                          Map<String,​String> parameterMap)
                                   throws Exception
        Read request.
        Parameters:
        nameIgnore - the name ignore
        parameterMap - the parameter map
        Throws:
        Exception - the exception
      • readRequest

        @Given("add (.*) with given query params$")
        public void readRequest​(String nameIgnore,
                                Map<String,​String> parameterMap)
                         throws Exception
        Read request.
        Parameters:
        nameIgnore - the name ignore
        parameterMap - the parameter map
        Throws:
        Exception - the exception
      • loadRequest

        @Given("^Populate (.*) with given input$")
        public void loadRequest​(String nameIgnore,
                                Map<String,​String> parameterMap)
                         throws Exception
        Load request.
        Parameters:
        nameIgnore - the name ignore
        parameterMap - the parameter map
        Throws:
        Exception - the exception
      • createRequest

        @Given("^add (.*) data with (.*) given input$")
        public void createRequest​(String body,
                                  String contentType)
                           throws Exception
        Create request.
        Parameters:
        body - the body
        contentType - the content type
        Throws:
        Exception - the exception
      • createRequest

        @Given("^Create (.*) with given input$")
        public void createRequest​(String nameIgnore,
                                  Map<String,​String> parameterMap)
                           throws Exception
        Create request.
        Parameters:
        nameIgnore - the name ignore
        parameterMap - the parameter map
        Throws:
        Exception - the exception
      • updateRequest

        @Given("^Update (.*) with given input$")
        public void updateRequest​(String nameIgnore,
                                  Map<String,​String> parameterMap)
                           throws Exception
        Update request.
        Parameters:
        nameIgnore - the name ignore
        parameterMap - the parameter map
        Throws:
        Exception - the exception
      • createRequest

        @When("^(.*) post (.*) in (.*) resource on (.*)")
        public void createRequest​(String dummyString,
                                  String acceptContentType,
                                  String resource,
                                  String system)
        Create request.
        Parameters:
        dummyString - the dummy string
        acceptContentType - the accept content type
        resource - the resource
        system - the system
      • readRequest

        @When("^(.*) get (.*) in (.*) resource on (.*)")
        public void readRequest​(String dummyString,
                                String acceptContentType,
                                String resource,
                                String system)
        Read request.
        Parameters:
        dummyString - the dummy string
        acceptContentType - the accept content type
        resource - the resource
        system - the system
      • modifyRequest

        @When("^(.*) put (.*) in (.*) resource on (.*)")
        public void modifyRequest​(String dummyString,
                                  String acceptContentType,
                                  String resource,
                                  String system)
        Modify request.
        Parameters:
        dummyString - the dummy string
        acceptContentType - the accept content type
        resource - the resource
        system - the system
      • patchRequest

        @When("^(.*) patch (.*) in (.*) resource on (.*)")
        public void patchRequest​(String dummyString,
                                 String acceptContentType,
                                 String resource,
                                 String system)
        Pathch request.
        Parameters:
        dummyString - the dummy string
        acceptContentType - the accept content type
        resource - the resource
        system - the system
      • deleteById

        @When("^(.*) delete (.*) in (.*) resource on (.*)")
        public void deleteById​(String dummyString,
                               String acceptContentType,
                               String resource,
                               String system)
        Delete by id.
        Parameters:
        dummyString - the dummy string
        acceptContentType - the accept content type
        resource - the resource
        system - the system
      • verifyStatusCode

        @Then("^Verify the status code is (\\d+)")
        public void verifyStatusCode​(int statusCode)
        Verify status code.
        Parameters:
        statusCode - the status code
      • verifyResponseMapson

        @And("^Verify-all (.*) api includes following in the response$")
        public void verifyResponseMapson​(String resource,
                                         io.cucumber.datatable.DataTable data)
                                  throws Throwable
        Verify response.
        Parameters:
        resource - the resource
        data - the data
        Throws:
        Throwable - the throwable
      • mockSingleResponse

        @And("^Verify (.*) response with (.*) includes in the response$")
        public void mockSingleResponse​(String resource,
                                       String context)
                                throws Throwable
        Mock single response.
        Parameters:
        resource - the resource
        context - the context
        Throws:
        Throwable - the throwable
      • verifyResponse

        @And("^Verify (.*) includes following in the response$")
        public void verifyResponse​(String dummyString,
                                   io.cucumber.datatable.DataTable data)
                            throws Throwable
        Verify response.
        Parameters:
        dummyString - the dummy string
        data - the data
        Throws:
        Throwable - the throwable