Package io.virtualan.cucumblan.core
Class BaseStepDefinition
- java.lang.Object
-
- io.virtualan.cucumblan.core.BaseStepDefinition
-
public class BaseStepDefinition extends Object
The type Base step definition for api.- Author:
- Elan Thangamani
-
-
Constructor Summary
Constructors Constructor Description BaseStepDefinition()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddVariable(String responseValue, String key)Add variable.voidaddVariableSwap(String key, String responseValue)voidassertToSchema(String dummy, String resource, io.cucumber.datatable.DataTable schemaMap)voidattachResponse(String body, byte[] bodyArray)voidattachResponse(String body, byte[] bodyArray, String category)voidauth(String username, String password)Read request by path param.voidbearer(String auth, String token)Read request by path param.voidbefore(io.cucumber.java.Scenario scenario)Before.voidcert(String identifier, String value)Read request by path param.voidcreateFileRequest(String fileBody, String contentType)Create request.voidcreateInlineRequest(String fileBody, String contentType, List<String> input)Create request.voidcreateRequest(String body, String contentType)Create request.voidcreateRequest(String dummyString, String acceptContentType, String resource, String system)Create request.voidcreateRequest(String nameIgnore, String contentType, Map<String,String> parameterMap)Create request.voidcreateRequest(String nameIgnore, Map<String,String> parameterMap)Create request.voiddeleteById(String dummyString, String acceptContentType, String resource, String system)Delete by id.voiddeleteRequest(String nameIgnore, Map<String,String> parameterMap)Delete request.voidevaluateVariable(String condition)perform the success metvoidevaluateVariableFail(String condition)perform the failure metvoidloadGlobalParam(Map<String,String> globalParams)Load global param.voidloadGlobalParamFromFile()Load global param.voidloadRequest(String nameIgnore, String contentType, Map<String,String> parameterMap)Load request.voidloadRequest(String nameIgnore, Map<String,String> parameterMap)Load request.static voidloadStandardProcessors()Load action processors.voidmodifyBooleanVariable(String condition)perform the skip scenariovoidmodifyBooleanVariable(String responseValue, String key)Modify variable.voidmodifyBooleanVariableSwap(String key, String responseValue)voidmodifyDecimalVariable(String responseValue, String key)Modify variable.voidmodifyDecimalVariableSwap(String key, String responseValue)voidmodifyfunctionVariable(String responseValue, String key)Modify variable.voidmodifyfunctionVariableSwap(String key, String responseValue)voidmodifyIntVariable(String responseValue, String key)Modify variable.voidmodifyIntVariableSwap(String key, String responseValue)voidmodifyRequest(String dummyString, String acceptContentType, String resource, String system)Modify request.voidmodifyStringVariable(String responseValue, String key)Modify variable.voidmodifyStringVariableSwap(String responseValue, String key)voidpatchRequest(String dummyString, String acceptContentType, String resource, String system)Pathch request.voidreadAllCookieParams(String nameIgnore, Map<String,String> parameterMap)Read request.voidreadAllHeaderParams(String nameIgnore, Map<String,String> parameterMap)Read request.voidreadMultiParamsRequest(String nameIgnore, String contentType, Map<String,String> parameterMap)Read request.voidreadParamsRequest(String nameIgnore, Map<String,String> parameterMap)Read request.voidreadPathParamsRequest(String nameIgnore, String contentType, Map<String,String> parameterMap)Read request.voidreadRequest(String dummyString, String acceptContentType, String resource, String system)Read request.voidreadRequest(String nameIgnore, String contentType, Map<String,String> parameterMap)Read request.voidreadRequest(String nameIgnore, Map<String,String> parameterMap)Read request.voidreadRequestByHeaderParam(String dummy, String identifier, String value)Read request by header param.voidreadRequestByPathParam(String dummy, String dummy1)Read request by path param.voidreadRequestByPathParam(String dummy, String identifier, String value)Read request by path param.voidreadRequestByQueryParam(String dummy, String identifier, String value)Read request by query param.voidstoreResponseAskey(String responseKey, String key)Load as global param.voidstoreResponseAskey(String type, String responseKey, String key)voidstoreResponseAskeySwap(String key, String responseKey)voidstoreStandarReposne(String type, String key, String responseKey)voidupdateRequest(String nameIgnore, String contentType, Map<String,String> parameterMap)Update request.voidupdateRequest(String nameIgnore, Map<String,String> parameterMap)Update request.voidvalidateGlobalParam()Validate global param.voidverify(String path, List<String> csvson)Verify.voidverifyAggregatorResponse(String dummy, String type, String resource, List<String> csvson)Verify response.voidverifyExactMatch(String path, List<String> csvson)Verify exact match.voidverifyExactOrderMatch(String path, List<String> csvson)Verify exact order match.voidverifyFileResponse(String resource, List<String> xmlString)Mock single response.voidverifyFormatedMapson(String type, String file, String resource)Verify response.voidverifyFormatedMapson(String type, String resource, List<String> readData)Verify response.voidverifyResponse(String dummyString, io.cucumber.datatable.DataTable data)Verify response.voidverifyResponseMapson(String resource, io.cucumber.datatable.DataTable data)Verify response.voidverifySingleResponse(String resource, String context)Mock single response.voidverifyStatusCode(int statusCode)Verify status codevoidverifyXMLByPathResponse(String resource, String contentType, String fileBody, List<String> xpaths)Mock single response.voidverifyXMLResponse(String resource, String fileBody)Mock single response.
-
-
-
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 dummyidentifier- the identifiervalue- the value
-
cert
@Given("^enable cert for (.*) of (.*)") public void cert(String identifier, String value)Read request by path param.- Parameters:
identifier- the identifiervalue- the value
-
auth
@Given("^basic authentication with (.*) and (.*)") public void auth(String username, String password)Read request by path param.- Parameters:
username- the identifierpassword- the value
-
bearer
@Given("^(.*) auth with (.*) token$") public void bearer(String auth, String token)Read request by path param.- Parameters:
auth- the identifiertoken- 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 dummyidentifier- the identifiervalue- the value
-
readAllHeaderParams
@Given("add (.*) with given header params$") public void readAllHeaderParams(String nameIgnore, Map<String,String> parameterMap)Read request.- Parameters:
nameIgnore- the name ignoreparameterMap- 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 ignoreparameterMap- 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 dummyidentifier- the identifiervalue- the value
-
loadGlobalParam
@Given("^provided all the feature level parameters$") public void loadGlobalParam(Map<String,String> globalParams) throws IOExceptionLoad 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 ExceptionLoad global param.- Throws:
IOException- the io exceptionException
-
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 ExceptionAdd variable.- Parameters:
responseValue- the response valuekey- 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 ExceptionModify variable.- Parameters:
responseValue- the response valuekey- the key- Throws:
IOException- the io exceptionException
-
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 ExceptionModify variable.- Parameters:
responseValue- the response valuekey- the key- Throws:
IOException- the io exceptionException
-
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 ExceptionModify variable.- Parameters:
responseValue- the response valuekey- the key- Throws:
IOException- the io exceptionException
-
modifyBooleanVariable
@Given("^perform the (.*) condition to skip scenario$") public void modifyBooleanVariable(String condition) throws Exceptionperform the skip scenario- Parameters:
condition- the response value excel based- Throws:
IOException- the io exceptionException
-
evaluateVariable
@Given("^evaluate the (.*) condition success$") public void evaluateVariable(String condition) throws Exceptionperform the success met- Parameters:
condition- the response value excel based- Throws:
IOException- the io exceptionException
-
evaluateVariableFail
@Given("^evaluate the (.*) condition fail$") public void evaluateVariableFail(String condition) throws Exceptionperform the failure met- Parameters:
condition- the response value excel based- Throws:
IOException- the io exceptionException
-
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 ExceptionModify variable.- Parameters:
responseValue- the response valuekey- the key- Throws:
IOException- the io exceptionException
-
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 ExceptionModify variable.- Parameters:
responseValue- the response valuekey- the key- Throws:
IOException- the io exceptionException
-
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 ExceptionLoad as global param.- Parameters:
responseKey- the response keykey- the key- Throws:
Exception
-
storeResponseAskey
public void storeResponseAskey(String type, String responseKey, String key) throws Exception
- Throws:
Exception
-
readParamsRequest
@Given("^add (.*) with given path params$") public void readParamsRequest(String nameIgnore, Map<String,String> parameterMap)Read request.- Parameters:
nameIgnore- the name ignoreparameterMap- 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 ignorecontentType- the content typeparameterMap- 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 ignorecontentType- the content typeparameterMap- 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 ignoreparameterMap- 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 ignorecontentType- the content typeparameterMap- 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 ignorecontentType- the content typeparameterMap- the parameter map
-
loadRequest
@Given("^populate (.*) with given input$") public void loadRequest(String nameIgnore, Map<String,String> parameterMap)Load request.- Parameters:
nameIgnore- the name ignoreparameterMap- the parameter map
-
createRequest
@Given("^add (.*) data with (.*) given input$") public void createRequest(String body, String contentType)Create request.- Parameters:
body- the bodycontentType- the content type
-
createFileRequest
@Given("add (.*) data file with (.*) given input$") public void createFileRequest(String fileBody, String contentType) throws IOExceptionCreate request.- Parameters:
fileBody- the bodycontentType- 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 IOExceptionCreate request.- Parameters:
fileBody- the bodycontentType- the content typeinput- 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 ExceptionCreate request.- Parameters:
nameIgnore- the name ignorecontentType- the content typeparameterMap- the parameter map- Throws:
Exception- the exception
-
createRequest
@Given("^create (.*) with given input$") public void createRequest(String nameIgnore, Map<String,String> parameterMap) throws ExceptionCreate request.- Parameters:
nameIgnore- the name ignoreparameterMap- the parameter map- Throws:
Exception- the exception
-
updateRequest
@Given("^update (.*) with given input$") public void updateRequest(String nameIgnore, Map<String,String> parameterMap) throws ExceptionUpdate request.- Parameters:
nameIgnore- the name ignoreparameterMap- the parameter map- Throws:
Exception- the exception
-
deleteRequest
@Given("^delete (.*) with given input$") public void deleteRequest(String nameIgnore, Map<String,String> parameterMap) throws ExceptionDelete request.- Parameters:
nameIgnore- the name ignoreparameterMap- 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 ExceptionUpdate request.- Parameters:
nameIgnore- the name ignorecontentType- the content typeparameterMap- 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 ExceptionCreate request.- Parameters:
dummyString- the dummy stringacceptContentType- the accept content typeresource- the resourcesystem- the system- Throws:
Exception
-
readRequest
@When("^(.*) get (.*) in (.*) resource on (.*)") public void readRequest(String dummyString, String acceptContentType, String resource, String system) throws ExceptionRead request.- Parameters:
dummyString- the dummy stringacceptContentType- the accept content typeresource- the resourcesystem- the system- Throws:
Exception
-
modifyRequest
@When("^(.*) put (.*) in (.*) resource on (.*)") public void modifyRequest(String dummyString, String acceptContentType, String resource, String system) throws ExceptionModify request.- Parameters:
dummyString- the dummy stringacceptContentType- the accept content typeresource- the resourcesystem- the system- Throws:
Exception
-
patchRequest
@When("^(.*) patch (.*) in (.*) resource on (.*)") public void patchRequest(String dummyString, String acceptContentType, String resource, String system) throws ExceptionPathch request.- Parameters:
dummyString- the dummy stringacceptContentType- the accept content typeresource- the resourcesystem- the system- Throws:
Exception
-
deleteById
@When("^(.*) delete (.*) in (.*) resource on (.*)") public void deleteById(String dummyString, String acceptContentType, String resource, String system) throws ExceptionDelete by id.- Parameters:
dummyString- the dummy stringacceptContentType- the accept content typeresource- the resourcesystem- 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 ExceptionVerify 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)
-
verifyFormatedMapson
@And("^verify-standard (.*) all inline (.*) api includes following in the response$") public void verifyFormatedMapson(String type, String resource, List<String> readData) throws ThrowableVerify response.- Parameters:
type- the dataresource- the resourcereadData- 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 ThrowableVerify response.- Parameters:
dummy- the desctype- the dataresource- the resourcecsvson- 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 ThrowableVerify response.- Parameters:
type- the datafile- the dataresource- 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 ThrowableVerify response.- Parameters:
resource- the resourcedata- the data- Throws:
Throwable- the throwable
-
verifyFileResponse
@And("^verify (.*) response inline includes in the response$") public void verifyFileResponse(String resource, List<String> xmlString) throws ThrowableMock single response.- Parameters:
resource- the resourcexmlString- 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 ThrowableMock single response.- Parameters:
resource- the resourcefileBody- 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 ExceptionMock single response.- Parameters:
resource- the resourcecontentType- the content typefileBody- the file bodyxpaths- 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 resourcecontext- the context
-
verify
@And("^verify (.*) response csvson includes in the response$") public void verify(String path, List<String> csvson) throws ExceptionVerify.- Parameters:
path- the pathcsvson- 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 ExceptionVerify exact order match.- Parameters:
path- the pathcsvson- 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 ExceptionVerify exact match.- Parameters:
path- the pathcsvson- the csvson- Throws:
Exception- the exception
-
-