T E S B O

Tesbo

Custom Steps : Design your step by writing java code

Custom Step #

We built Tesbo with the vision to write the less code or no code but there are some situation where we need to write the code or function, And Tesbo has the facility to define the code by Creating the custom step.  You need to create CustomStep package inside the test folder to define your Custom Step. You need to create the method for Custom Step with @Step(<Tag Name>) annotation with the Tag name of that code. Code class is by default using the Web Driver and so you don’t need to define or initialize the Web Driver in your Code class you can create as many as java class for the managing the custom step. Follow the steps to create the Custom Step class in framework. 1.  Right click on the test package and New > Directory2. Enter the name of directory as CustomStep3. Right click on the CustomStep and go to New > Java Class and create a Java class to write the External Codes required for the automation. For example, 

  public class <Class Name> extends ExtendTesboDriver {
           public <Class Name>(WebDriver driver) {
               super(driver);
           }
       }

Code Sample Example #

      package ExtTestCode;
      import ExtCode.ExtCode;
      public class TestingCustomStep extends ExtendTesboDriver {
          public TestingCustomStep(WebDriver driver) {
              super(driver);
          }
          @Step("Browser Resize")          // Tag Name : Browser Resize
          public void browserResize() {
              Dimension dimension = new Dimension(900, 750);
              driver.manage().window().setSize(dimension);
          }
      }

How to use above code in .tests file #

      Test: Resize browser using External Code
      #CustomStep #regression
      Step: Open URL 'https://www.amazon.in/'
      Code: Browser Resize          // Pass Step: <Tag Name>
      Step: pause 2 sec
      End      

Powered by BetterDocs

Leave a Comment