Class BaseStepDefinition


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

      • BaseStepDefinition

        public BaseStepDefinition()
    • Method Detail

      • loadStandardProcessors

        public static void loadStandardProcessors()
        Load action processors.
      • 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 (.*) api action")
        public void readRequestByPathParam​(String dummy,
                                           String dummy1)
        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)
        Read request.
        Parameters:
        nameIgnore - the name ignore
        parameterMap - the parameter map
      • readAllCookieParams

        @Given("add (.*) with given cookie params$")
        public void readAllCookieParams​(String nameIgnore,
                                        Map<String,​String> parameterMap)
        Read request.
        Parameters:
        nameIgnore - the name ignore
        parameterMap - the parameter map
      • 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 Exception
        Load global param.
        Throws:
        IOException - the io exception
        Exception
      • validateGlobalParam

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

        @Given("^create variable (.*) as key and (.*) as value$")
        public void addVariableSwap​(String key,
                                    String responseValue)
                             throws Exception
        Throws:
        Exception
      • addVariable

        @Given("^add the (.*) value of the key as (.*)$")
        public void addVariable​(String responseValue,
                                String key)
                         throws Exception
        Add variable.
        Parameters:
        responseValue - the response value
        key - the key
        Throws:
        Exception
      • modifyDecimalVariableSwap

        @Given("^evaluate key as (.*) and (.*) as decimal value$")
        public void modifyDecimalVariableSwap​(String key,
                                              String responseValue)
                                       throws Exception
        Throws:
        Exception
      • modifyDecimalVariable

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

        @Given("^evaluate key as (.*) and (.*) as integer value$")
        public void modifyIntVariableSwap​(String key,
                                          String responseValue)
                                   throws Exception
        Throws:
        Exception
      • modifyIntVariable

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

        @Given("^evaluate key as (.*) and (.*) as function value$")
        public void modifyfunctionVariableSwap​(String key,
                                               String responseValue)
                                        throws Exception
        Throws:
        Exception
      • modifyfunctionVariable

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

        @Given("^perform the (.*) condition to skip scenario$")
        public void modifyBooleanVariable​(String condition)
                                   throws Exception
        perform the skip scenario
        Parameters:
        condition - the response value excel based
        Throws:
        IOException - the io exception
        Exception
      • evaluateVariable

        @Given("^evaluate the (.*) condition success$")
        public void evaluateVariable​(String condition)
                              throws Exception
        perform the success met
        Parameters:
        condition - the response value excel based
        Throws:
        IOException - the io exception
        Exception
      • evaluateVariableFail

        @Given("^evaluate the (.*) condition fail$")
        public void evaluateVariableFail​(String condition)
                                  throws Exception
        perform the failure met
        Parameters:
        condition - the response value excel based
        Throws:
        IOException - the io exception
        Exception
      • modifyBooleanVariableSwap

        @Given("^evaluate key as (.*) and (.*) as boolean value$")
        public void modifyBooleanVariableSwap​(String key,
                                              String responseValue)
                                       throws Exception
        Throws:
        Exception
      • modifyBooleanVariable

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

        @Given("^modify key as (.*) and (.*) as value$")
        public void modifyStringVariableSwap​(String responseValue,
                                             String key)
                                      throws Exception
        Throws:
        Exception
      • modifyStringVariable

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

        @Given("^store (.*) as key and api\'s (.*) as value$")
        public void storeResponseAskeySwap​(String key,
                                           String responseKey)
                                    throws Exception
        Throws:
        Exception
      • storeStandarReposne

        @Given("^store-standard type\'s (.*) with (.*) as key and api\'s (.*) as value$")
        public void storeStandarReposne​(String type,
                                        String key,
                                        String responseKey)
                                 throws Exception
        Throws:
        Exception
      • storeResponseAskey

        @Given("^store the (.*) value of the key as (.*)$")
        public void storeResponseAskey​(String responseKey,
                                       String key)
                                throws Exception
        Load as global param.
        Parameters:
        responseKey - the response key
        key - the key
        Throws:
        Exception
      • readParamsRequest

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

        @Given("^add (.*) with (.*) given form params$")
        public void readMultiParamsRequest​(String nameIgnore,
                                           String contentType,
                                           Map<String,​String> parameterMap)
        Read request.
        Parameters:
        nameIgnore - the name ignore
        contentType - the content type
        parameterMap - the parameter map
      • readPathParamsRequest

        @Given("^add (.*) with (.*) given multipart-form params$")
        public void readPathParamsRequest​(String nameIgnore,
                                          String contentType,
                                          Map<String,​String> parameterMap)
        Read request.
        Parameters:
        nameIgnore - the name ignore
        contentType - the content type
        parameterMap - the parameter map
      • readRequest

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

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

        @Given("^populate (.*) with contentType(.*) given input$")
        public void loadRequest​(String nameIgnore,
                                String contentType,
                                Map<String,​String> parameterMap)
        Load request.
        Parameters:
        nameIgnore - the name ignore
        contentType - the content type
        parameterMap - the parameter map
      • loadRequest

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

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

        @Given("add (.*) data file with (.*) given input$")
        public void createFileRequest​(String fileBody,
                                      String contentType)
                               throws IOException
        Create request.
        Parameters:
        fileBody - the body
        contentType - the content type
        Throws:
        IOException - the io exception
      • createInlineRequest

        @Given("add (.*) data inline with (.*) given input$")
        public void createInlineRequest​(String fileBody,
                                        String contentType,
                                        List<String> input)
                                 throws IOException
        Create request.
        Parameters:
        fileBody - the body
        contentType - the content type
        input - the input
        Throws:
        IOException - the io exception
      • createRequest

        @Given("^create (.*) with contentType (.*) given input$")
        public void createRequest​(String nameIgnore,
                                  String contentType,
                                  Map<String,​String> parameterMap)
                           throws Exception
        Create request.
        Parameters:
        nameIgnore - the name ignore
        contentType - the content type
        parameterMap - the parameter map
        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
      • deleteRequest

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

        @Given("^update (.*) with contentType (.*) given input$")
        public void updateRequest​(String nameIgnore,
                                  String contentType,
                                  Map<String,​String> parameterMap)
                           throws Exception
        Update request.
        Parameters:
        nameIgnore - the name ignore
        contentType - the content type
        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)
                           throws Exception
        Create request.
        Parameters:
        dummyString - the dummy string
        acceptContentType - the accept content type
        resource - the resource
        system - the system
        Throws:
        Exception
      • readRequest

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

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

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

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

        public void before​(io.cucumber.java.Scenario scenario)
        Before.
        Parameters:
        scenario - the scenario
      • verifyStatusCode

        @Then("^verify the status code is (\\d+)") @Then("^the status code is (\\d+)")
        public void verifyStatusCode​(int statusCode)
                              throws Exception
        Verify status code
        Parameters:
        statusCode - the status code
        Throws:
        Exception
      • assertToSchema

        @Given("^verify (.*) schema validation for resource on (.*)")
        public void assertToSchema​(String dummy,
                                   String resource,
                                   io.cucumber.datatable.DataTable schemaMap)
      • attachResponse

        public void attachResponse​(String body,
                                   byte[] bodyArray)
      • attachResponse

        public void attachResponse​(String body,
                                   byte[] bodyArray,
                                   String category)
      • verifyFormatedMapson

        @And("^verify-standard (.*) all inline (.*) api includes following in the response$")
        public void verifyFormatedMapson​(String type,
                                         String resource,
                                         List<String> readData)
                                  throws Throwable
        Verify response.
        Parameters:
        type - the data
        resource - the resource
        readData - the data
        Throws:
        Throwable - the throwable
      • verifyAggregatorResponse

        @Given("verify (.*) for api-aggregated-std-type (.*) on (.*)$")
        public void verifyAggregatorResponse​(String dummy,
                                             String type,
                                             String resource,
                                             List<String> csvson)
                                      throws Throwable
        Verify response.
        Parameters:
        dummy - the desc
        type - the data
        resource - the resource
        csvson - the csvson
        Throws:
        Throwable - the throwable
      • verifyFormatedMapson

        @Given("^verify-standard (.*) all (.*) file (.*) api includes following in the response$")
        public void verifyFormatedMapson​(String type,
                                         String file,
                                         String resource)
                                  throws Throwable
        Verify response.
        Parameters:
        type - the data
        file - the data
        resource - the resource
        Throws:
        Throwable - the throwable
      • 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
      • verifyFileResponse

        @And("^verify (.*) response inline includes in the response$")
        public void verifyFileResponse​(String resource,
                                       List<String> xmlString)
                                throws Throwable
        Mock single response.
        Parameters:
        resource - the resource
        xmlString - the xml string
        Throws:
        Throwable - the throwable
      • verifyXMLResponse

        @And("^verify (.*) response XML File (.*) includes in the response$")
        public void verifyXMLResponse​(String resource,
                                      String fileBody)
                               throws Throwable
        Mock single response.
        Parameters:
        resource - the resource
        fileBody - the file body
        Throws:
        Throwable - the throwable
      • verifyXMLByPathResponse

        @And("^verify (.*) response (.*) include byPath (.*) includes in the response$")
        public void verifyXMLByPathResponse​(String resource,
                                            String contentType,
                                            String fileBody,
                                            List<String> xpaths)
                                     throws Exception
        Mock single response.
        Parameters:
        resource - the resource
        contentType - the content type
        fileBody - the file body
        xpaths - the xpaths
        Throws:
        Exception - the exception
      • verifySingleResponse

        @And("^verify (.*) response with (.*) includes in the response$")
        public void verifySingleResponse​(String resource,
                                         String context)
        Mock single response.
        Parameters:
        resource - the resource
        context - the context
      • verify

        @And("^verify (.*) response csvson includes in the response$")
        public void verify​(String path,
                           List<String> csvson)
                    throws Exception
        Verify.
        Parameters:
        path - the path
        csvson - the csvson
        Throws:
        Exception - the exception
      • verifyExactOrderMatch

        @And("^verify (.*) response csvson includes exact-order-match in the response$")
        public void verifyExactOrderMatch​(String path,
                                          List<String> csvson)
                                   throws Exception
        Verify exact order match.
        Parameters:
        path - the path
        csvson - the csvson
        Throws:
        Exception - the exception
      • verifyExactMatch

        @And("^verify (.*) response csvson includes exact-match in the response$")
        public void verifyExactMatch​(String path,
                                     List<String> csvson)
                              throws Exception
        Verify exact match.
        Parameters:
        path - the path
        csvson - the csvson
        Throws:
        Exception - the exception
      • 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