T E S B O

Tesbo

Pass Parameter into .java files from Steps

Tesbo provides features to pass the parameters into the .java file from the .tests files. This will help when performing the same step for various data values. Tesbo support the two ways to pass the parameter

  1. Pass the value as a parameter directly
  2. Pass the value from the dataset

1. Pass the value as a parameter directly #

Step declaration in .java file.

@Step("Click on Date from Calendar")
public void clickOnDateButton(String i) {
driver.findElement(By.xpath("(//a[contains(text(),'"+i+"')])[2]")).click();
}

 Example  :

Test: Select Date from Calendar
Step: Open URL 'http://www.example.com/'
Code: Click on Date from Calendar(1)
Step: Click on @Done button
Verify: @TodaysDate is displayed
End

2.  Pass the value from the dataset #

DataSet:{
        "date" : {
              "fixDate" :  "1",
            }
          }

Test: Select Date from Calendar
Step: Open URL 'http://www.example.com/'
Code: Click on Date from Calendar({fixDate})
Step: Click on @Done button
Verify: @TodaysDate is displayed
End

Please note that :

Tesbo support only the String type parameter so if you require the other data type
then you need to convert them in .java files. 

Powered by BetterDocs

Leave a Comment