Follow

Writing Test Steps in a KWD Test Suite

Keyword Driven Syntax

<STEP-NAME> | <IN-PARAMS> | <OUT-PARAM>
Where,
STEP-NAME: any step defined in java or in excel/csv
IN- PARAMS: array of required parameter for the step, blank array if step has no arguments.
OUT-PARAM: parameter to hold step results if step returns something

Various Input Parameters

1.To refer out parameter from another step as in parameter use ${parameter_name}.
2.To provide list or array argument value, enclose comma separated values with [], For example
    a.[1,2,3] represent array/ collection / list of int
    b.[“aaa”,”bbb”] represents array / collection / list of String
3.To provide map use {} representation key value pair of map for example Map<string, int=""> implementation is   {'company':'Infostretch','location':'ahmedabad'}
4.Date must be provided in dd-mm-yyyy format.

Create Custom Step Declaration:

STEP-DEF | |
|< IN-PARAMS>|< OUT-PARAM>
|< IN-PARAMS>|< OUT-PARAM>
.
.

END

Where,
Name: name of the excel/csv step. It must be unique across the project including java steps.
Description: Description of the excel/csv step

Example :

  1. @QAFTestStep(description = "verify web result card at index {0}", stepName = "verifyResultCardAtGivenIndex")
    public void verifyCard(int i) {
             ---
             ---
    }
    Step Call Syntax :
    verifyResultCardAtGivenIndex|[20]|
  2. @QAFTestStep(description = "search flight for {0}", stepName = "searchFlight")
    public void searchFlight(String value) {
             ---
             ---
    }
    Step Call Syntax :
    searchFlight|[Mumbai]|
    searchFlight|[O''Fallon]|
  3. @QAFTestStep(description = "get ages {0}", stepName = "getAges")
    public void getAges(int[] values) {
             ---
             ---
    }
    Step Call Syntax :
    getAges|[[10,20,30,40]]|

  4. @QAFTestStep(description = "search flights for {0}", stepName = "searchFlightsFor")
    public void searchFlightsFor(String value[]) {
             ---
             ---
    }
    Step Call Syntax :
    searchFlightsFor|[["Delhi","Mumbai","Pune"]]|



  5. @QAFTestStep(description = "search flight for Date {0}", stepName = "searchFlightForDate")
    public void searchFlightForDate(Date d) {
             ---
             ---
    }
    Step Call Syntax :
    searchFlightForDate|[25-02-1992]|
  6. @QAFTestStep(description = "Login with username and password {0}", stepName = "verfiyLogin")
    public void verifyLogin(Map<String, String> map) {
             ---
             ---
    }
    Step Call Syntax :
    verfiyLogin|[{"username":"admin","password":"admin123"}]|

How to use Property value :

For example:
store|[{"company":"InfoStretch","Location":"ahmedabad"},"data"]|
comment|["${data}"]|

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk